Package nom.tam.util
Interface ArrayDataInput
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,java.io.DataInput,FitsIO
- All Known Subinterfaces:
RandomAccess
- All Known Implementing Classes:
BufferedDataInputStream,BufferedFile
public interface ArrayDataInput extends java.io.DataInput, FitsIO
-
-
Field Summary
-
Fields inherited from interface nom.tam.util.FitsIO
BITS_OF_1_BYTE, BITS_OF_2_BYTES, BITS_OF_3_BYTES, BITS_OF_4_BYTES, BITS_OF_5_BYTES, BITS_OF_6_BYTES, BITS_OF_7_BYTES, BYTE_1_OF_LONG_MASK, BYTE_2_OF_LONG_MASK, BYTE_3_OF_LONG_MASK, BYTE_4_OF_LONG_MASK, BYTE_MASK, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_FLOAT, BYTES_IN_INTEGER, BYTES_IN_LONG, BYTES_IN_SHORT, DEFAULT_BUFFER_SIZE, HIGH_INTEGER_MASK, INTEGER_MASK, SHORT_MASK, SHORT_OF_LONG_MASK
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidmark(int readlimit)See the general contract of themarkmethod ofInputStream.intread(boolean[] buf)Read an array of boolean's.intread(boolean[] buf, int offset, int size)Read a segment of an array of boolean's.intread(byte[] buf)Read an array of byte's.intread(byte[] buf, int offset, int size)Read a segment of an array of byte's.intread(char[] buf)Read an array of char's.intread(char[] buf, int offset, int size)Read a segment of an array of char's.intread(double[] buf)Read an array of double's.intread(double[] buf, int offset, int size)Read a segment of an array of double's.intread(float[] buf)Read an array of float's.intread(float[] buf, int offset, int size)Read a segment of an array of float's.intread(int[] buf)Read an array of int's.intread(int[] buf, int offset, int size)Read a segment of an array of int's.intread(long[] buf)Read a segment of an array of long's.intread(long[] buf, int offset, int size)Read a segment of an array of long's.intread(short[] buf)Read an array of short's.intread(short[] buf, int offset, int size)Read a segment of an array of short's.intreadArray(java.lang.Object o)Deprecated.usereadLArray(Object)instead.voidreadFully(byte[] b, int off, int len)Read a buffer and signal an EOF if the requested elements cannot be read.longreadLArray(java.lang.Object o)Read an object.voidreset()See the general contract of theresetmethod ofInputStream.longskip(long distance)Skip the number of bytes.voidskipAllBytes(int toSkip)Skip the number of bytes.voidskipAllBytes(long toSkip)Skip the number of bytes.
-
-
-
Method Detail
-
mark
void mark(int readlimit) throws java.io.IOException
See the general contract of themarkmethod ofInputStream.- Parameters:
readlimit- the maximum limit of bytes that can be read before the mark position becomes invalid.- Throws:
java.io.IOException- if the operation failed- See Also:
BufferedInputStream.reset()
-
read
int read(byte[] buf) throws java.io.IOException
Read an array of byte's.- Parameters:
buf- array of byte's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed- See Also:
DataInput.readFully(byte[])
-
read
int read(byte[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of byte's.- Parameters:
buf- array of byte's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed- See Also:
readFully(byte[], int, int)
-
read
int read(boolean[] buf) throws java.io.IOException
Read an array of boolean's.- Parameters:
buf- array of boolean's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(boolean[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of boolean's.- Parameters:
buf- array of boolean's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(char[] buf) throws java.io.IOException
Read an array of char's.- Parameters:
buf- array of char's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(char[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of char's.- Parameters:
buf- array of char's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(double[] buf) throws java.io.IOException
Read an array of double's.- Parameters:
buf- array of double's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(double[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of double's.- Parameters:
buf- array of double's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(float[] buf) throws java.io.IOException
Read an array of float's.- Parameters:
buf- array of float's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(float[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of float's.- Parameters:
buf- array of float's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(int[] buf) throws java.io.IOException
Read an array of int's.- Parameters:
buf- array of int's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(int[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of int's.- Parameters:
buf- array of int's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(long[] buf) throws java.io.IOException
Read a segment of an array of long's.- Parameters:
buf- array of long's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(long[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of long's.- Parameters:
buf- array of long's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(short[] buf) throws java.io.IOException
Read an array of short's.- Parameters:
buf- array of short's.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
read
int read(short[] buf, int offset, int size) throws java.io.IOExceptionRead a segment of an array of short's.- Parameters:
buf- array of short's.offset- start index in the arraysize- number of array elements to read- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if one of the underlying read operations failed
-
readArray
@Deprecated int readArray(java.lang.Object o) throws java.io.IOExceptionDeprecated.usereadLArray(Object)instead.Read a generic (possibly multidimensional) primitive array. An Object[] array is also a legal argument if each element of the array is a legal.The ArrayDataInput classes do not support String input since it is unclear how one would read in an Array of strings.
- Parameters:
o- A [multidimensional] primitive (or Object) array.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if the underlying stream failed
-
readLArray
long readLArray(java.lang.Object o) throws java.io.IOExceptionRead an object. An EOF will be signaled if the object cannot be fully read. This version works even if the underlying data is more than 2 Gigabytes.- Parameters:
o- The object to be read. This object should be a primitive (possibly multi-dimensional) array.- Returns:
- number of bytes read.
- Throws:
java.io.IOException- if the underlying stream failed
-
reset
void reset() throws java.io.IOExceptionSee the general contract of theresetmethod ofInputStream.If
markposis-1(no mark has been set or the mark has been invalidated), anIOExceptionis thrown. Otherwise,posis set equal tomarkpos.- Throws:
java.io.IOException- if this stream has not been marked or, if the mark has been invalidated, or the stream has been closed by invoking itsFitsIO.close()method, or an I/O error occurs.- See Also:
BufferedInputStream.mark(int)
-
skip
long skip(long distance) throws java.io.IOException
Skip the number of bytes. This differs from the skip method in that it will throw an EOF if a forward skip cannot be fully accomplished... (However that isn't supposed to happen with a random access file, so there is probably no operational difference).- Parameters:
distance- the number of bytes to skip- Returns:
- the number of bytes really skipped
- Throws:
java.io.IOException- if the underlying stream failed
-
skipAllBytes
void skipAllBytes(long toSkip) throws java.io.IOExceptionSkip the number of bytes. This differs from the skip method in that it will throw an EOF if a forward skip cannot be fully accomplished... (However that isn't supposed to happen with a random access file, so there is probably no operational difference).- Parameters:
toSkip- the number of bytes to skip- Throws:
java.io.IOException- if the underlying stream failed
-
skipAllBytes
void skipAllBytes(int toSkip) throws java.io.IOExceptionSkip the number of bytes. This differs from the skip method in that it will throw an EOF if a forward skip cannot be fully accomplished... (However that isn't supposed to happen with a random access file, so there is probably no operational difference).- Parameters:
toSkip- the number of bytes to skip- Throws:
java.io.IOException- if the underlying stream failed
-
readFully
void readFully(byte[] b, int off, int len) throws java.io.IOExceptionRead a buffer and signal an EOF if the requested elements cannot be read. This differs from read(b,off,len) since that call will not signal and end of file unless no bytes can be read. However both of these routines will attempt to fill their buffers completely.- Specified by:
readFullyin interfacejava.io.DataInput- Parameters:
b- The input buffer.off- The requested offset into the buffer.len- The number of bytes requested.- Throws:
java.io.IOException
-
-