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.FilterInputStream
java.io.IOException
InputStream.available()
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
InputStream.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.FilterInputStream
len
- length to read, must be a multiple of the stream's
record sizejava.io.IOException
public long skip(long len) throws java.io.IOException
skips the full given length unless EOF is reached.
skip
in class java.io.FilterInputStream
len
- length to read, must be a multiple of the stream's
record sizejava.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterInputStream
java.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.IOException
private void readFully(byte[] b, int off, int len) throws java.io.IOException
java.io.IOException
public long getBytesRead()