class TapeInputStream
extends java.io.FilterInputStream
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
blockBuffer |
private int |
blockSize |
private long |
bytesRead |
private int |
currBlkIdx |
private boolean |
isCompressed |
private int |
readOffset |
private static int |
RECORD_SIZE |
| Constructor and Description |
|---|
TapeInputStream(java.io.InputStream in)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close()
Close the input stream.
|
long |
getBytesRead()
Get number of bytes read.
|
byte[] |
peek()
Peek at the next record from the input stream and return the data.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
private void |
readBlock(boolean decompress)
Read next block.
|
private void |
readFully(byte[] b,
int off,
int len)
Read buffer
|
byte[] |
readRecord()
Read a record from the input stream and return the data.
|
void |
resetBlockSize(int recsPerBlock,
boolean isCompressed)
Set the DumpArchive Buffer's block size.
|
long |
skip(long len)
Skip bytes.
|
private byte[] blockBuffer
private int currBlkIdx
private int blockSize
private static final int RECORD_SIZE
private int readOffset
private boolean isCompressed
private long bytesRead
public void resetBlockSize(int recsPerBlock,
boolean isCompressed)
throws java.io.IOException
recsPerBlock - records per blockisCompressed - true if the archive is compressedjava.io.IOException - more than one block has been readjava.io.IOException - there was an error reading additional blocks.public int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.available()public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionInputStream.read()public int read(byte[] b,
int off,
int len)
throws java.io.IOException
reads the full given length unless EOF is reached.
read in class java.io.FilterInputStreamlen - length to read, must be a multiple of the stream's
record sizejava.io.IOExceptionpublic long skip(long len)
throws java.io.IOException
skips the full given length unless EOF is reached.
skip in class java.io.FilterInputStreamlen - length to read, must be a multiple of the stream's
record sizejava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOException - on errorpublic byte[] peek()
throws java.io.IOException
java.io.IOException - on errorpublic byte[] readRecord()
throws java.io.IOException
java.io.IOException - on errorprivate void readBlock(boolean decompress)
throws java.io.IOException
decompress - if false the buffer will not be decompressed.
This is an optimization for longer seeks.java.io.IOExceptionprivate void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
java.io.IOExceptionpublic long getBytesRead()