public abstract class AbstractArrayDataIO extends Object implements ArrayDataInput, ArrayDataOutput
nom.tam.util
-compatible FITS I/O handler.
The ArrayDataInput interface contains a lot of methods declared like
int read(type[]) throws IOException;whose behaviour is not documented - when do they throw an exception and what do they return? The behaviour implemented here follows that of the
BufferedFile
implementation (which is similarly
undocumented). It is as follows:
BufferedFile
implementation for more details.Constructor and Description |
---|
AbstractArrayDataIO() |
Modifier and Type | Method and Description |
---|---|
protected abstract byte |
get()
Reads one byte from the current position.
|
protected abstract void |
get(byte[] buf,
int offset,
int length)
Reads bytes into a buffer from the current position.
|
abstract long |
length()
Returns the size of this buffer.
|
protected abstract void |
put(byte b)
Writes a single byte at the current position.
|
protected abstract void |
put(byte[] buf,
int offset,
int length)
Writes bytes from a buffer to the current position.
|
int |
read(boolean[] buf) |
int |
read(boolean[] buf,
int start,
int length) |
int |
read(byte[] buf) |
int |
read(byte[] buf,
int start,
int length) |
int |
read(char[] buf) |
int |
read(char[] buf,
int start,
int length) |
int |
read(double[] buf) |
int |
read(double[] buf,
int start,
int length) |
int |
read(float[] buf) |
int |
read(float[] buf,
int start,
int length) |
int |
read(int[] buf) |
int |
read(int[] buf,
int start,
int length) |
int |
read(long[] buf) |
int |
read(long[] buf,
int start,
int length) |
int |
read(short[] buf) |
int |
read(short[] buf,
int start,
int length) |
int |
readArray(Object o)
Read a generic (possibly multidimenionsional) primitive array.
|
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] buf) |
void |
readFully(byte[] buf,
int start,
int len)
Reads a specified number of bytes into an array.
|
int |
readInt() |
long |
readLArray(Object o) |
String |
readLine()
Deprecated.
|
long |
readLong() |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
String |
readUTF() |
protected abstract long |
remaining()
Returns the number of bytes remaining between the current position
and the end of the file.
|
void |
write(boolean[] buf) |
void |
write(boolean[] buf,
int start,
int length) |
void |
write(byte[] buf) |
void |
write(byte[] buf,
int start,
int length) |
void |
write(char[] buf) |
void |
write(char[] buf,
int start,
int length) |
void |
write(double[] buf) |
void |
write(double[] buf,
int start,
int length) |
void |
write(float[] buf) |
void |
write(float[] buf,
int start,
int length) |
void |
write(int val) |
void |
write(int[] buf) |
void |
write(int[] buf,
int start,
int length) |
void |
write(long[] buf) |
void |
write(long[] buf,
int start,
int length) |
void |
write(short[] buf) |
void |
write(short[] buf,
int start,
int length) |
void |
write(String[] strings) |
void |
write(String[] strings,
int start,
int length) |
void |
writeArray(Object o)
Write a generic (possibly multi-dimenionsional) primitive or String
array.
|
void |
writeBoolean(boolean val) |
void |
writeByte(int val) |
void |
writeBytes(String s) |
void |
writeChar(int val) |
void |
writeChars(String s) |
void |
writeDouble(double val) |
void |
writeFloat(float val) |
void |
writeInt(int val) |
void |
writeLong(long val) |
void |
writeShort(int val) |
void |
writeUTF(String str) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, skip
close, flush
protected abstract byte get() throws IOException
IOException
protected abstract void get(byte[] buf, int offset, int length) throws IOException
buf
- destination bufferoffset
- offset of first byte in buf
to be writtenlength
- maximum number of bytes to be written to
buf
IOException
protected abstract void put(byte b) throws IOException
b
- output byteIOException
protected abstract void put(byte[] buf, int offset, int length) throws IOException
buf
- source bufferoffset
- offset of first byte in buf
to be readlength
- number of bytes from buf
to be readIOException
public abstract long length()
protected abstract long remaining()
Long.MAX_VALUE
;public boolean readBoolean() throws IOException
readBoolean
in interface DataInput
IOException
public byte readByte() throws IOException
readByte
in interface DataInput
IOException
public short readShort() throws IOException
readShort
in interface DataInput
IOException
public char readChar() throws IOException
readChar
in interface DataInput
IOException
public int readInt() throws IOException
readInt
in interface DataInput
IOException
public long readLong() throws IOException
readLong
in interface DataInput
IOException
public float readFloat() throws IOException
readFloat
in interface DataInput
IOException
public double readDouble() throws IOException
readDouble
in interface DataInput
IOException
public int readUnsignedByte() throws IOException
readUnsignedByte
in interface DataInput
IOException
public int readUnsignedShort() throws IOException
readUnsignedShort
in interface DataInput
IOException
public String readUTF() throws IOException
readUTF
in interface DataInput
IOException
@Deprecated public String readLine() throws IOException
DataInputStream.readLine()
readLine
in interface DataInput
UnsupportedOperationException
- alwaysIOException
public void readFully(byte[] buf, int start, int len) throws IOException
readFully
in interface DataInput
buf
- the byte buffer into which to readstart
- the index in buf at which to start putting byteslen
- the number of bytes which must be readEOFException
- if there are fewer than len bytes leftIOException
public int read(byte[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(boolean[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(short[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(char[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(int[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(long[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(float[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public int read(double[] buf, int start, int length) throws IOException
read
in interface ArrayDataInput
IOException
public void readFully(byte[] buf) throws IOException
readFully
in interface DataInput
IOException
public int read(byte[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(boolean[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(short[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(char[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(int[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(long[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(float[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int read(double[] buf) throws IOException
read
in interface ArrayDataInput
IOException
public int readArray(Object o) throws IOException
ArrayDataInput
The ArrayDataInput classes do not support String input since it is unclear how one would read in an Array of strings.
readArray
in interface ArrayDataInput
o
- A [multidimensional] primitive (or Object) array.IOException
public long readLArray(Object o) throws IOException
IOException
public void write(int val) throws IOException
write
in interface DataOutput
IOException
public void writeBoolean(boolean val) throws IOException
writeBoolean
in interface DataOutput
IOException
public void writeByte(int val) throws IOException
writeByte
in interface DataOutput
IOException
public void writeShort(int val) throws IOException
writeShort
in interface DataOutput
IOException
public void writeChar(int val) throws IOException
writeChar
in interface DataOutput
IOException
public void writeInt(int val) throws IOException
writeInt
in interface DataOutput
IOException
public void writeLong(long val) throws IOException
writeLong
in interface DataOutput
IOException
public void writeFloat(float val) throws IOException
writeFloat
in interface DataOutput
IOException
public void writeDouble(double val) throws IOException
writeDouble
in interface DataOutput
IOException
public void write(byte[] buf, int start, int length) throws IOException
write
in interface DataOutput
write
in interface ArrayDataOutput
IOException
public void write(boolean[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(short[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(char[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(int[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(long[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(float[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(double[] buf, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(String[] strings, int start, int length) throws IOException
write
in interface ArrayDataOutput
IOException
public void writeBytes(String s) throws IOException
writeBytes
in interface DataOutput
IOException
public void writeChars(String s) throws IOException
writeChars
in interface DataOutput
IOException
public void writeUTF(String str) throws IOException
writeUTF
in interface DataOutput
IOException
public void write(byte[] buf) throws IOException
write
in interface DataOutput
write
in interface ArrayDataOutput
IOException
public void write(boolean[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(short[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(char[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(int[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(long[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(float[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(double[] buf) throws IOException
write
in interface ArrayDataOutput
IOException
public void write(String[] strings) throws IOException
write
in interface ArrayDataOutput
IOException
public void writeArray(Object o) throws IOException
ArrayDataOutput
This routine is not called 'write' to avoid possible compilation errors in routines which define only some of the other methods of the interface (and defer to the superclass on others). In that case there is an ambiguity as to whether to call the routine in the current class but convert to Object, or call the method from the super class with the same type argument.
writeArray
in interface ArrayDataOutput
o
- The primitive or String array to be written.IOException
- if the argument is not of the proper typeCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.