public final class TarInputStream
extends java.io.FilterInputStream
TarInputStream
,
TarEntry
Modifier and Type | Field and Description |
---|---|
private TarBuffer |
m_buffer |
private TarEntry |
m_currEntry |
private boolean |
m_debug |
private int |
m_entryOffset |
private int |
m_entrySize |
private boolean |
m_hasHitEOF |
private byte[] |
m_oneBuf |
private byte[] |
m_readBuf |
Constructor and Description |
---|
TarInputStream(java.io.InputStream input)
Construct a TarInputStream using specified input
stream and default block and record sizes.
|
TarInputStream(java.io.InputStream input,
int blockSize)
Construct a TarInputStream using specified input
stream, block size and default record sizes.
|
TarInputStream(java.io.InputStream input,
int blockSize,
int recordSize)
Construct a TarInputStream using specified input
stream, block size and record sizes.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Get the available data that can be read from the current entry in the
archive.
|
void |
close()
Closes this stream.
|
void |
copyEntryContents(java.io.OutputStream output)
Copies the contents of the current tar archive entry directly into an
output stream.
|
protected void |
debug(java.lang.String message)
Utility method to do debugging.
|
TarEntry |
getNextEntry()
Get the next entry in this tar archive.
|
int |
getRecordSize()
Get the record size being used by this stream's TarBuffer.
|
void |
mark(int markLimit)
Since we do not support marking just yet, we do nothing.
|
boolean |
markSupported()
Since we do not support marking just yet, we return false.
|
int |
read()
Reads a byte from the current tar archive entry.
|
int |
read(byte[] buffer)
Reads bytes from the current tar archive entry.
|
int |
read(byte[] buffer,
int offset,
int count)
Reads bytes from the current tar archive entry.
|
void |
reset()
Since we do not support marking just yet, we do nothing.
|
void |
setDebug(boolean debug)
Sets the debugging flag.
|
void |
skip(int numToSkip)
Skip bytes in the input buffer.
|
private TarBuffer m_buffer
private TarEntry m_currEntry
private boolean m_debug
private int m_entryOffset
private int m_entrySize
private boolean m_hasHitEOF
private byte[] m_oneBuf
private byte[] m_readBuf
public TarInputStream(java.io.InputStream input)
input
- stream to create TarInputStream fromTarBuffer.DEFAULT_BLOCKSIZE
,
TarBuffer.DEFAULT_RECORDSIZE
public TarInputStream(java.io.InputStream input, int blockSize)
input
- stream to create TarInputStream fromblockSize
- the block size to useTarBuffer.DEFAULT_RECORDSIZE
public TarInputStream(java.io.InputStream input, int blockSize, int recordSize)
input
- stream to create TarInputStream fromblockSize
- the block size to userecordSize
- the record size to usepublic void setDebug(boolean debug)
debug
- The new Debug valuepublic TarEntry getNextEntry() throws java.io.IOException
java.io.IOException
- Description of Exceptionpublic int getRecordSize()
public int available() throws java.io.IOException
available
in class java.io.FilterInputStream
java.io.IOException
- when an IO error causes operation to failpublic 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
- when an IO error causes operation to failpublic void copyEntryContents(java.io.OutputStream output) throws java.io.IOException
output
- The OutputStream into which to write the entry's data.java.io.IOException
- when an IO error causes operation to failpublic void mark(int markLimit)
mark
in class java.io.FilterInputStream
markLimit
- The limit to mark.public boolean markSupported()
markSupported
in class java.io.FilterInputStream
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- when an IO error causes operation to failpublic int read(byte[] buffer) throws java.io.IOException
read
in class java.io.FilterInputStream
buffer
- The buffer into which to place bytes read.java.io.IOException
- when an IO error causes operation to failpublic int read(byte[] buffer, int offset, int count) throws java.io.IOException
read
in class java.io.FilterInputStream
buffer
- The buffer into which to place bytes read.offset
- The offset at which to place bytes read.count
- The number of bytes to read.java.io.IOException
- when an IO error causes operation to failpublic void reset()
reset
in class java.io.FilterInputStream
public void skip(int numToSkip) throws java.io.IOException
numToSkip
- The number of bytes to skip.java.io.IOException
- when an IO error causes operation to failprotected void debug(java.lang.String message)
message
- the message to use in debugging