Package nom.tam.util

Interface ReadWriteAccess

All Superinterfaces:
InputReader, OutputWriter
All Known Subinterfaces:
RandomAccess, RandomAccessFileIO
All Known Implementing Classes:
BufferedFile, ByteArrayIO, FitsFile

public interface ReadWriteAccess extends InputReader, OutputWriter
Interface for basic random access read and write operations. Because it is built on the elements used by FitsEncoder and FitsDecoder, in principle it can serve as the common point for reading and writing FITS binary data in memory (using ByteArrayIO) or in a file (using FitsFile or a subclass thereof). For that reason, addressing is assumed as 64-bit long type.
Since:
1.16
Author:
Attila Kovacs
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the current total length of this instance, that is the total number of bytes that may be read from it.
    long
    Returns the current read/write position in this instance.
    void
    position(long n)
    Sets a new position for the next read or write in this instance.

    Methods inherited from interface nom.tam.util.InputReader

    read, read

    Methods inherited from interface nom.tam.util.OutputWriter

    write, write
  • Method Details

    • position

      long position() throws IOException
      Returns the current read/write position in this instance. The position may exceed the length, depending on implementation, just as seek may go beyond the file size in RandomAccessFile.
      Returns:
      the current read/write position.
      Throws:
      IOException - if there was an IO error.
      See Also:
    • position

      void position(long n) throws IOException
      Sets a new position for the next read or write in this instance. The position may exceed the length, depending on implementation, just as seek may go beyond the file size in RandomAccessFile.
      Parameters:
      n - the new read/write position.
      Throws:
      IOException - if there was an IO error.
      See Also:
    • length

      long length() throws IOException
      Returns the current total length of this instance, that is the total number of bytes that may be read from it.
      Returns:
      the total number of bytes contained in this instance
      Throws:
      IOException - if there was an IO error.