public class TarInputStream

  1. Object
  2. InputStream
  3. BufferedInputStream
  4. TarInputStream

ImplementsAutoCloseable

Constructors

public TarInputStream(InputStream in)

Methods

public boolean markSupported()Tests if this input stream supports the mark and reset methods.
public synchronized void mark(int readlimit)Not supported
public synchronized void reset() throws IOExceptionNot supported
public int read() throws IOExceptionRead a byte
public int read(byte[] b, int off, int len) throws IOExceptionChecks if the bytes being read exceed the entry size and adjusts the byte array length.
public TarEntry getNextEntry() throws IOExceptionReturns the next entry in the tar file
protected void closeCurrentEntry() throws IOExceptionCloses the current tar entry
protected void skipPad() throws IOExceptionSkips the pad at the end of each tar entry file content
public long skip(long n) throws IOExceptionSkips ’n’ bytes on the InputStream
public boolean isDefaultSkip()
public void setDefaultSkip(boolean defaultSkip)

Inherited methods

Constructor details

TarInputStream

public TarInputStream(InputStream in)

Method details

markSupported

public boolean markSupported()
Tests if this input stream supports the mark and reset methods. The markSupported method of BufferedInputStream returns true.

Returns

a boolean indicating if this stream type supports the mark and reset methods.

mark

public synchronized void mark(int readlimit)
Not supported

Parameters

readlimit int
the maximum limit of bytes that can be read before the mark position becomes invalid.

reset

public synchronized void reset() throws IOException
Not supported

Throws

IOException
if this stream has not been marked or, if the mark has been invalidated, or the stream has been closed by invoking its #close() method, or an I/O error occurs.

read

public int read() throws IOException
Read a byte

Returns

the next byte of data, or -1 if the end of the stream is reached.

Throws

IOException
if this input stream has been closed by invoking its #close() method, or an I/O error occurs.

See also

  • java.io.FilterInputStream#read()

read

public int read(byte[] b, int off, int len) throws IOException
Checks if the bytes being read exceed the entry size and adjusts the byte array length. Updates the byte counters

Parameters

b byte[]
destination buffer.
off int
offset at which to start storing bytes.
len int
maximum number of bytes to read.

Returns

the number of bytes read, or -1 if the end of the stream has been reached.

Throws

IOException
if this input stream has been closed by invoking its #close() method, or an I/O error occurs.

See also

  • java.io.FilterInputStream#read(byte[], int, int)

getNextEntry

public TarEntry getNextEntry() throws IOException
Returns the next entry in the tar file

Returns

TarEntry

closeCurrentEntry

protected void closeCurrentEntry() throws IOException
Closes the current tar entry

skipPad

protected void skipPad() throws IOException
Skips the pad at the end of each tar entry file content

skip

public long skip(long n) throws IOException

Skips ’n’ bytes on the InputStream

Overrides default implementation of skip

Throws

IOException
if the stream does not support seek, or if this input stream has been closed by invoking its #close() method, or an I/O error occurs.

isDefaultSkip

public boolean isDefaultSkip()

setDefaultSkip

public void setDefaultSkip(boolean defaultSkip)