Class TarInputStream

All Implemented Interfaces:
AutoCloseable

public class TarInputStream extends BufferedInputStream
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Closes the current tar entry
    Returns the next entry in the tar file
    boolean
     
    void
    mark(int readlimit)
    Not supported
    boolean
    Tests if this input stream supports the mark and reset methods.
    int
    Read a byte
    int
    read(byte[] b, int off, int len)
    Checks if the bytes being read exceed the entry size and adjusts the byte array length.
    void
    Not supported
    void
    setDefaultSkip(boolean defaultSkip)
     
    long
    skip(long n)
    Skips 'n' bytes on the InputStream
    protected void
    Skips the pad at the end of each tar entry file content

    Methods inherited from class BufferedInputStream

    available, close, getConnection, getDefaultBufferSize, getInternal, getLastActivityTime, getName, getTotalBytesRead, getYield, isDisableBuffering, isPrintInput, read, setConnection, setDefaultBufferSize, setDisableBuffering, setPrintInput, setProgressListener, setYield, stop
    Modifier and Type
    Method
    Description
    int
    Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
    void
    Closes this input stream and releases any system resources associated with the stream.
    If applicable this member represents the connection object for the stream
    static int
    The default size for a stream buffer
    Allows access to the underlying input stream if desired
    long
    Returns the time of the last activity
    Indicates the name of the stream for debugging purposes
    int
    Returns the total number of bytes read from this stream so far
    int
    Allows setting a yield duration for this stream which is useful for background operations to release CPU
    boolean
    Returns
    boolean
    Prints out all the data that passes through this stream to the console.
    int
    read(byte[] b)
    Reads some number of bytes from the input stream and stores them into the buffer array b.
    void
    setConnection(Object connection)
    If applicable this member represents the connection object for the stream
    static void
    setDefaultBufferSize(int aDefaultBufferSize)
    The default size for a stream buffer
    void
    setDisableBuffering(boolean disableBuffering)
    Parameters
    void
    setPrintInput(boolean printInput)
    Prints out all the data that passes through this stream to the console.
    void
    Sets the callback for IO updates from a buffered stream
    void
    setYield(int yield)
    Allows setting a yield duration for this stream which is useful for background operations to release CPU
    void
    Stop reading from the stream, invoking this will cause the read() to return -1

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • Constructor Details

    • TarInputStream

      public TarInputStream(InputStream in)
  • Method Details

    • markSupported

      public boolean markSupported()
      Description copied from class: BufferedInputStream

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

      Returns
      Overrides:
      markSupported in class BufferedInputStream
      Returns:

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

      See also
      • java.io.InputStream#mark(int)

      • java.io.InputStream#reset()

    • mark

      public void mark(int readlimit)
      Not supported
      Overrides:
      mark in class BufferedInputStream
    • reset

      public void reset() throws IOException
      Not supported
      Overrides:
      reset in class BufferedInputStream
      Throws:
      IOException
    • read

      public int read() throws IOException

      Read a byte

      See also
      • java.io.FilterInputStream#read()
      Overrides:
      read in class BufferedInputStream
      Returns:

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

      Throws
      • IOException: @throws IOException if this input stream has been closed by invoking its #close() method, or an I/O error occurs.
      Throws:
      IOException
    • 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

      See also
      • java.io.FilterInputStream#read(byte[], int, int)
      Overrides:
      read in class BufferedInputStream
      Returns:

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

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

      public TarEntry getNextEntry() throws IOException

      Returns the next entry in the tar file

      Returns

      TarEntry

      Throws
      • IOException
      Throws:
      IOException
    • closeCurrentEntry

      protected void closeCurrentEntry() throws IOException

      Closes the current tar entry

      Throws
      • IOException
      Throws:
      IOException
    • skipPad

      protected void skipPad() throws IOException

      Skips the pad at the end of each tar entry file content

      Throws
      • IOException
      Throws:
      IOException
    • skip

      public long skip(long n) throws IOException

      Skips 'n' bytes on the InputStream

      Overrides default implementation of skip

      Overrides:
      skip in class BufferedInputStream
      Throws:
      IOException
    • isDefaultSkip

      public boolean isDefaultSkip()
    • setDefaultSkip

      public void setDefaultSkip(boolean defaultSkip)