Package nom.tam.util
Interface ReadWriteAccess
- All Superinterfaces:
InputReader
,OutputWriter
- All Known Subinterfaces:
RandomAccess
,RandomAccessFileIO
- All Known Implementing Classes:
BufferedFile
,ByteArrayIO
,FitsFile
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 TypeMethodDescriptionlong
length()
Returns the current total length of this instance, that is the total number of bytes that may be read from it.long
position()
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
Returns the current read/write position in this instance. The position may exceed the length, depending on implementation, just asseek
may go beyond the file size inRandomAccessFile
.- Returns:
- the current read/write position.
- Throws:
IOException
- if there was an IO error.- See Also:
-
position
Sets a new position for the next read or write in this instance. The position may exceed the length, depending on implementation, just asseek
may go beyond the file size inRandomAccessFile
.- Parameters:
n
- the new read/write position.- Throws:
IOException
- if there was an IO error.- See Also:
-
length
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.
-