Class ByteWiseFileAccessor

java.lang.Object
gov.nasa.pds.objectAccess.ByteWiseFileAccessor
All Implemented Interfaces:
Closeable, AutoCloseable

public class ByteWiseFileAccessor extends Object implements Closeable
Class that provides common I/O functionality for PDS data objects.
  • Constructor Details

  • Method Details

    • readRecordBytes

      public byte[] readRecordBytes(long recordNum, int offset, int length)
      Reads length bytes of data from a specified record at the given offset.
      Parameters:
      recordNum - the record number to read bytes from (1-relative)
      offset - an offset within the record
      length - the number of bytes to read from the record
      Returns:
      an array of bytes
    • readByte

      public byte readByte()
      Reads a byte from the buffer.
      Returns:
      A byte.
    • mark

      public void mark()
      Marks the buffer.
    • reset

      public void reset()
      Resets the buffer.
    • hasRemaining

      public boolean hasRemaining()
      Checks to see if the buffer can still be read.
      Returns:
      'true' if there are more bytes to be read. 'false' otherwise.
    • getCurrentPosition

      public long getCurrentPosition()
    • getTotalFileContentSize

      public long getTotalFileContentSize()
    • getTotalBytesRead

      public long getTotalBytesRead()
    • close

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

      public RandomAccessFile getRandomAccessFile()