Class Tailer.RandomAccessFileBridge

java.lang.Object
org.apache.commons.io.input.Tailer.RandomAccessFileBridge
All Implemented Interfaces:
Closeable, AutoCloseable, Tailer.RandomAccessResourceBridge
Enclosing class:
Tailer

private static final class Tailer.RandomAccessFileBridge extends Object implements Tailer.RandomAccessResourceBridge
Bridges random access to a RandomAccessFile.
  • Field Details

  • Constructor Details

  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getPointer

      public long getPointer() throws IOException
      Description copied from interface: Tailer.RandomAccessResourceBridge
      Gets the current offset in this tailable.
      Specified by:
      getPointer in interface Tailer.RandomAccessResourceBridge
      Returns:
      the offset from the beginning of the tailable, in bytes, at which the next read or write occurs.
      Throws:
      IOException - if an I/O error occurs.
    • read

      public int read(byte[] b) throws IOException
      Description copied from interface: Tailer.RandomAccessResourceBridge
      Reads up to b.length bytes of data from this tailable into an array of bytes. This method blocks until at least one byte of input is available.
      Specified by:
      read in interface Tailer.RandomAccessResourceBridge
      Parameters:
      b - the buffer into which the data is read.
      Returns:
      the total number of bytes read into the buffer, or -1 if there is no more data because the end of this tailable has been reached.
      Throws:
      IOException - If the first byte cannot be read for any reason other than end of tailable, or if the random access tailable has been closed, or if some other I/O error occurs.
    • seek

      public void seek(long position) throws IOException
      Description copied from interface: Tailer.RandomAccessResourceBridge
      Sets the file-pointer offset, measured from the beginning of this tailable, at which the next read or write occurs. The offset may be set beyond the end of the tailable. Setting the offset beyond the end of the tailable does not change the tailable length. The tailable length will change only by writing after the offset has been set beyond the end of the tailable.
      Specified by:
      seek in interface Tailer.RandomAccessResourceBridge
      Parameters:
      position - the offset position, measured in bytes from the beginning of the tailable, at which to set the tailable pointer.
      Throws:
      IOException - if pos is less than 0 or if an I/O error occurs.