edu.mines.jtk.io
Class ArrayFile

java.lang.Object
  extended by edu.mines.jtk.io.ArrayFile
All Implemented Interfaces:
ArrayInput, ArrayOutput, java.io.Closeable, java.io.DataInput, java.io.DataOutput

public class ArrayFile
extends java.lang.Object
implements ArrayInput, ArrayOutput, java.io.Closeable

An array file expands the capabilities of RandomAccessFile. Specifically, an array file has methods for efficiently reading and writing arrays of primitive values, such as ints and floats. Also, array files may be read or written with either BIG_ENDIAN or LITTLE_ENDIAN byte orders.

An array file implements the interfaces ArrayInput and ArrayOutput, which extend the standard Java interfaces DataInput and DataOutput, respectively.

An array file can be constructed by specifying a file name and access mode (as for a RandomAccessFile). Alternatively, an array file can be constructed from an existing RandomAccessFile.

Version:
2006.08.05
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
ArrayFile(java.io.File file, java.lang.String mode)
          Constructs an array file with specified file and access mode.
ArrayFile(java.io.File file, java.lang.String mode, java.nio.ByteOrder bor, java.nio.ByteOrder bow)
          Constructs an array file with specified file, access mode, and byte orders.
ArrayFile(java.io.RandomAccessFile raf, java.nio.ByteOrder bor, java.nio.ByteOrder bow)
          Constructs an array file for a specified random-access file and byte orders.
ArrayFile(java.lang.String name, java.lang.String mode)
          Constructs an array file with specified name and access mode.
ArrayFile(java.lang.String name, java.lang.String mode, java.nio.ByteOrder bor, java.nio.ByteOrder bow)
          Constructs an array file with specified name, access mode, and byte orders.
 
Method Summary
 void close()
          Closes this data file, releasing any associated system resources.
 java.nio.ByteOrder getByteOrderRead()
          Gets the byte order for reading data.
 java.nio.ByteOrder getByteOrderWrite()
          Gets the byte order for writing data.
 long getFilePointer()
          Gets the file pointer (byte offset) for this file.
 long length()
          Returns the length of this file.
 int read()
          Reads a byte value from this file.
 int read(byte[] b)
          Reads up to b.length bytes from this file.
 int read(byte[] b, int off, int len)
          Reads up to len bytes from this file.
 boolean readBoolean()
           
 byte readByte()
           
 void readBytes(byte[] v)
          Reads byte elements into a specified array.
 void readBytes(byte[][] v)
          Reads byte elements into a specified array.
 void readBytes(byte[][][] v)
          Reads byte elements into a specified array.
 void readBytes(byte[] v, int k, int n)
          Reads byte elements into a specified array.
 char readChar()
           
 void readChars(char[] v)
          Reads char elements into a specified array.
 void readChars(char[][] v)
          Reads char elements into a specified array.
 void readChars(char[][][] v)
          Reads char elements into a specified array.
 void readChars(char[] v, int k, int n)
          Reads char elements into a specified array.
 double readDouble()
           
 void readDoubles(double[] v)
          Reads double elements into a specified array.
 void readDoubles(double[][] v)
          Reads double elements into a specified array.
 void readDoubles(double[][][] v)
          Reads double elements into a specified array.
 void readDoubles(double[] v, int k, int n)
          Reads double elements into a specified array.
 float readFloat()
           
 void readFloats(float[] v)
          Reads float elements into a specified array.
 void readFloats(float[][] v)
          Reads float elements into a specified array.
 void readFloats(float[][][] v)
          Reads float elements into a specified array.
 void readFloats(float[] v, int k, int n)
          Reads float elements into a specified array.
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
 void readInts(int[] v)
          Reads int elements into a specified array.
 void readInts(int[][] v)
          Reads int elements into a specified array.
 void readInts(int[][][] v)
          Reads int elements into a specified array.
 void readInts(int[] v, int k, int n)
          Reads int elements into a specified array.
 java.lang.String readLine()
           
 long readLong()
           
 void readLongs(long[] v)
          Reads long elements into a specified array.
 void readLongs(long[][] v)
          Reads long elements into a specified array.
 void readLongs(long[][][] v)
          Reads long elements into a specified array.
 void readLongs(long[] v, int k, int n)
          Reads long elements into a specified array.
 short readShort()
           
 void readShorts(short[] v)
          Reads short elements into a specified array.
 void readShorts(short[][] v)
          Reads short elements into a specified array.
 void readShorts(short[][][] v)
          Reads short elements into a specified array.
 void readShorts(short[] v, int k, int n)
          Reads short elements into a specified array.
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 java.lang.String readUTF()
           
 void seek(long off)
          Sets the file pointer (byte offset) for this file.
 void setLength(long newLength)
          Sets the length of this file.
 int skipBytes(int n)
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeBoolean(boolean v)
           
 void writeByte(int v)
           
 void writeBytes(byte[] v)
          Writes byte elements from a specified array.
 void writeBytes(byte[][] v)
          Writes byte elements from a specified array.
 void writeBytes(byte[][][] v)
          Writes byte elements from a specified array.
 void writeBytes(byte[] v, int k, int n)
          Writes byte elements from a specified array.
 void writeBytes(java.lang.String s)
           
 void writeChar(int v)
           
 void writeChars(char[] v)
          Writes char elements from a specified array.
 void writeChars(char[][] v)
          Writes char elements from a specified array.
 void writeChars(char[][][] v)
          Writes char elements from a specified array.
 void writeChars(char[] v, int k, int n)
          Writes char elements from a specified array.
 void writeChars(java.lang.String s)
           
 void writeDouble(double v)
           
 void writeDoubles(double[] v)
          Writes double elements from a specified array.
 void writeDoubles(double[][] v)
          Writes double elements from a specified array.
 void writeDoubles(double[][][] v)
          Writes double elements from a specified array.
 void writeDoubles(double[] v, int k, int n)
          Writes double elements from a specified array.
 void writeFloat(float v)
           
 void writeFloats(float[] v)
          Writes float elements from a specified array.
 void writeFloats(float[][] v)
          Writes float elements from a specified array.
 void writeFloats(float[][][] v)
          Writes float elements from a specified array.
 void writeFloats(float[] v, int k, int n)
          Writes float elements from a specified array.
 void writeInt(int v)
           
 void writeInts(int[] v)
          Writes int elements from a specified array.
 void writeInts(int[][] v)
          Writes int elements from a specified array.
 void writeInts(int[][][] v)
          Writes int elements from a specified array.
 void writeInts(int[] v, int k, int n)
          Writes int elements from a specified array.
 void writeLong(long v)
           
 void writeLongs(long[] v)
          Writes long elements from a specified array.
 void writeLongs(long[][] v)
          Writes long elements from a specified array.
 void writeLongs(long[][][] v)
          Writes long elements from a specified array.
 void writeLongs(long[] v, int k, int n)
          Writes long elements from a specified array.
 void writeShort(int v)
           
 void writeShorts(short[] v)
          Writes shorts elements from a specified array.
 void writeShorts(short[][] v)
          Writes short elements from a specified array.
 void writeShorts(short[][][] v)
          Writes short elements from a specified array.
 void writeShorts(short[] v, int k, int n)
          Writes short elements from a specified array.
 void writeUTF(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayFile

public ArrayFile(java.lang.String name,
                 java.lang.String mode)
          throws java.io.FileNotFoundException
Constructs an array file with specified name and access mode.

Parameters:
name - the file name.
mode - the access mode; "r", "rw", "rws", or "rwd".
Throws:
java.io.FileNotFoundException

ArrayFile

public ArrayFile(java.io.File file,
                 java.lang.String mode)
          throws java.io.FileNotFoundException
Constructs an array file with specified file and access mode.

Parameters:
file - the file.
mode - the access mode; "r", "rw", "rws", or "rwd".
Throws:
java.io.FileNotFoundException

ArrayFile

public ArrayFile(java.lang.String name,
                 java.lang.String mode,
                 java.nio.ByteOrder bor,
                 java.nio.ByteOrder bow)
          throws java.io.FileNotFoundException
Constructs an array file with specified name, access mode, and byte orders.

Parameters:
name - the file name.
mode - the access mode; "r", "rw", "rws", or "rwd".
bor - the byte order for reading.
bow - the byte order for writing.
Throws:
java.io.FileNotFoundException

ArrayFile

public ArrayFile(java.io.File file,
                 java.lang.String mode,
                 java.nio.ByteOrder bor,
                 java.nio.ByteOrder bow)
          throws java.io.FileNotFoundException
Constructs an array file with specified file, access mode, and byte orders.

Parameters:
file - the file.
mode - the access mode; "r", "rw", "rws", or "rwd".
bor - the byte order for reading.
bow - the byte order for writing.
Throws:
java.io.FileNotFoundException

ArrayFile

public ArrayFile(java.io.RandomAccessFile raf,
                 java.nio.ByteOrder bor,
                 java.nio.ByteOrder bow)
Constructs an array file for a specified random-access file and byte orders.

Parameters:
raf - the random-access file.
bor - the byte order for reading.
bow - the byte order for writing.
Method Detail

getByteOrderRead

public java.nio.ByteOrder getByteOrderRead()
Gets the byte order for reading data.

Returns:
the byte order.

getByteOrderWrite

public java.nio.ByteOrder getByteOrderWrite()
Gets the byte order for writing data.

Returns:
the byte order.

read

public int read()
         throws java.io.IOException
Reads a byte value from this file. The returned value will be in the range 0 to 255.

Returns:
the byte value.
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Reads up to b.length bytes from this file.

Parameters:
b - array into which to read bytes.
Returns:
the number of bytes read; -1 if end of file.
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes from this file.

Parameters:
b - array into which to read bytes.
off - array index of first byte to read.
len - the number of bytes to read.
Returns:
the number of bytes read; -1 if end of file.
Throws:
java.io.IOException

readFully

public void readFully(byte[] b)
               throws java.io.IOException
Specified by:
readFully in interface ArrayInput
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException
Specified by:
readFully in interface ArrayInput
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

skipBytes

public int skipBytes(int n)
              throws java.io.IOException
Specified by:
skipBytes in interface ArrayInput
Specified by:
skipBytes in interface java.io.DataInput
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in interface ArrayOutput
Specified by:
write in interface java.io.DataOutput
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Specified by:
write in interface ArrayOutput
Specified by:
write in interface java.io.DataOutput
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in interface ArrayOutput
Specified by:
write in interface java.io.DataOutput
Throws:
java.io.IOException

getFilePointer

public long getFilePointer()
                    throws java.io.IOException
Gets the file pointer (byte offset) for this file. The next read or write begins at this offset.

Returns:
the file pointer.
Throws:
java.io.IOException

seek

public void seek(long off)
          throws java.io.IOException
Sets the file pointer (byte offset) for this file. The next read or or write begins at this offset.

The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not increase the file length. The file length increases only by writing beyond the end of the file.

Parameters:
off - the file pointer, the offset in bytes from the beginning of the file.
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Returns the length of this file.

Returns:
the file length, in bytes.
Throws:
java.io.IOException

setLength

public void setLength(long newLength)
               throws java.io.IOException
Sets the length of this file. If the current file length exceeds the specified new length, then the file will be truncated. In this case, if the file pointer exceeds the new length, then that pointer will equal to the new length when this methods returns.

If the current file length is less than the specified new length, then this file will extended. The content of the extended portion is undefined.

Parameters:
newLength - the new length.
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes this data file, releasing any associated system resources.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

readBoolean

public final boolean readBoolean()
                          throws java.io.IOException
Specified by:
readBoolean in interface ArrayInput
Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.IOException

readByte

public final byte readByte()
                    throws java.io.IOException
Specified by:
readByte in interface ArrayInput
Specified by:
readByte in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedByte

public final int readUnsignedByte()
                           throws java.io.IOException
Specified by:
readUnsignedByte in interface ArrayInput
Specified by:
readUnsignedByte in interface java.io.DataInput
Throws:
java.io.IOException

readShort

public final short readShort()
                      throws java.io.IOException
Specified by:
readShort in interface ArrayInput
Specified by:
readShort in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedShort

public final int readUnsignedShort()
                            throws java.io.IOException
Specified by:
readUnsignedShort in interface ArrayInput
Specified by:
readUnsignedShort in interface java.io.DataInput
Throws:
java.io.IOException

readChar

public final char readChar()
                    throws java.io.IOException
Specified by:
readChar in interface ArrayInput
Specified by:
readChar in interface java.io.DataInput
Throws:
java.io.IOException

readInt

public final int readInt()
                  throws java.io.IOException
Specified by:
readInt in interface ArrayInput
Specified by:
readInt in interface java.io.DataInput
Throws:
java.io.IOException

readLong

public final long readLong()
                    throws java.io.IOException
Specified by:
readLong in interface ArrayInput
Specified by:
readLong in interface java.io.DataInput
Throws:
java.io.IOException

readFloat

public final float readFloat()
                      throws java.io.IOException
Specified by:
readFloat in interface ArrayInput
Specified by:
readFloat in interface java.io.DataInput
Throws:
java.io.IOException

readDouble

public final double readDouble()
                        throws java.io.IOException
Specified by:
readDouble in interface ArrayInput
Specified by:
readDouble in interface java.io.DataInput
Throws:
java.io.IOException

readLine

public final java.lang.String readLine()
                                throws java.io.IOException
Specified by:
readLine in interface ArrayInput
Specified by:
readLine in interface java.io.DataInput
Throws:
java.io.IOException

readUTF

public final java.lang.String readUTF()
                               throws java.io.IOException
Specified by:
readUTF in interface ArrayInput
Specified by:
readUTF in interface java.io.DataInput
Throws:
java.io.IOException

writeBoolean

public void writeBoolean(boolean v)
                  throws java.io.IOException
Specified by:
writeBoolean in interface ArrayOutput
Specified by:
writeBoolean in interface java.io.DataOutput
Throws:
java.io.IOException

writeByte

public void writeByte(int v)
               throws java.io.IOException
Specified by:
writeByte in interface ArrayOutput
Specified by:
writeByte in interface java.io.DataOutput
Throws:
java.io.IOException

writeShort

public void writeShort(int v)
                throws java.io.IOException
Specified by:
writeShort in interface ArrayOutput
Specified by:
writeShort in interface java.io.DataOutput
Throws:
java.io.IOException

writeChar

public void writeChar(int v)
               throws java.io.IOException
Specified by:
writeChar in interface ArrayOutput
Specified by:
writeChar in interface java.io.DataOutput
Throws:
java.io.IOException

writeInt

public void writeInt(int v)
              throws java.io.IOException
Specified by:
writeInt in interface ArrayOutput
Specified by:
writeInt in interface java.io.DataOutput
Throws:
java.io.IOException

writeLong

public void writeLong(long v)
               throws java.io.IOException
Specified by:
writeLong in interface ArrayOutput
Specified by:
writeLong in interface java.io.DataOutput
Throws:
java.io.IOException

writeFloat

public void writeFloat(float v)
                throws java.io.IOException
Specified by:
writeFloat in interface ArrayOutput
Specified by:
writeFloat in interface java.io.DataOutput
Throws:
java.io.IOException

writeDouble

public void writeDouble(double v)
                 throws java.io.IOException
Specified by:
writeDouble in interface ArrayOutput
Specified by:
writeDouble in interface java.io.DataOutput
Throws:
java.io.IOException

writeBytes

public void writeBytes(java.lang.String s)
                throws java.io.IOException
Specified by:
writeBytes in interface ArrayOutput
Specified by:
writeBytes in interface java.io.DataOutput
Throws:
java.io.IOException

writeChars

public void writeChars(java.lang.String s)
                throws java.io.IOException
Specified by:
writeChars in interface ArrayOutput
Specified by:
writeChars in interface java.io.DataOutput
Throws:
java.io.IOException

writeUTF

public void writeUTF(java.lang.String s)
              throws java.io.IOException
Specified by:
writeUTF in interface ArrayOutput
Specified by:
writeUTF in interface java.io.DataOutput
Throws:
java.io.IOException

readBytes

public void readBytes(byte[] v,
                      int k,
                      int n)
               throws java.io.IOException
Reads byte elements into a specified array.

Specified by:
readBytes in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readBytes

public void readBytes(byte[] v)
               throws java.io.IOException
Reads byte elements into a specified array. The array length equals the number of elements to read.

Specified by:
readBytes in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readBytes

public void readBytes(byte[][] v)
               throws java.io.IOException
Reads byte elements into a specified array. The array length equals the number of elements to read.

Specified by:
readBytes in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readBytes

public void readBytes(byte[][][] v)
               throws java.io.IOException
Reads byte elements into a specified array. The array length equals the number of elements to read.

Specified by:
readBytes in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readChars

public void readChars(char[] v,
                      int k,
                      int n)
               throws java.io.IOException
Reads char elements into a specified array.

Specified by:
readChars in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readChars

public void readChars(char[] v)
               throws java.io.IOException
Reads char elements into a specified array. The array length equals the number of elements to read.

Specified by:
readChars in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readChars

public void readChars(char[][] v)
               throws java.io.IOException
Reads char elements into a specified array. The array length equals the number of elements to read.

Specified by:
readChars in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readChars

public void readChars(char[][][] v)
               throws java.io.IOException
Reads char elements into a specified array. The array length equals the number of elements to read.

Specified by:
readChars in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readShorts

public void readShorts(short[] v,
                       int k,
                       int n)
                throws java.io.IOException
Reads short elements into a specified array.

Specified by:
readShorts in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readShorts

public void readShorts(short[] v)
                throws java.io.IOException
Reads short elements into a specified array. The array length equals the number of elements to read.

Specified by:
readShorts in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readShorts

public void readShorts(short[][] v)
                throws java.io.IOException
Reads short elements into a specified array. The array length equals the number of elements to read.

Specified by:
readShorts in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readShorts

public void readShorts(short[][][] v)
                throws java.io.IOException
Reads short elements into a specified array. The array length equals the number of elements to read.

Specified by:
readShorts in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readInts

public void readInts(int[] v,
                     int k,
                     int n)
              throws java.io.IOException
Reads int elements into a specified array.

Specified by:
readInts in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readInts

public void readInts(int[] v)
              throws java.io.IOException
Reads int elements into a specified array. The array length equals the number of elements to read.

Specified by:
readInts in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readInts

public void readInts(int[][] v)
              throws java.io.IOException
Reads int elements into a specified array. The array length equals the number of elements to read.

Specified by:
readInts in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readInts

public void readInts(int[][][] v)
              throws java.io.IOException
Reads int elements into a specified array. The array length equals the number of elements to read.

Specified by:
readInts in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readLongs

public void readLongs(long[] v,
                      int k,
                      int n)
               throws java.io.IOException
Reads long elements into a specified array.

Specified by:
readLongs in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readLongs

public void readLongs(long[] v)
               throws java.io.IOException
Reads long elements into a specified array. The array length equals the number of elements to read.

Specified by:
readLongs in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readLongs

public void readLongs(long[][] v)
               throws java.io.IOException
Reads long elements into a specified array. The array length equals the number of elements to read.

Specified by:
readLongs in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readLongs

public void readLongs(long[][][] v)
               throws java.io.IOException
Reads long elements into a specified array. The array length equals the number of elements to read.

Specified by:
readLongs in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readFloats

public void readFloats(float[] v,
                       int k,
                       int n)
                throws java.io.IOException
Reads float elements into a specified array.

Specified by:
readFloats in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readFloats

public void readFloats(float[] v)
                throws java.io.IOException
Reads float elements into a specified array. The array length equals the number of elements to read.

Specified by:
readFloats in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readFloats

public void readFloats(float[][] v)
                throws java.io.IOException
Reads float elements into a specified array. The array length equals the number of elements to read.

Specified by:
readFloats in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readFloats

public void readFloats(float[][][] v)
                throws java.io.IOException
Reads float elements into a specified array. The array length equals the number of elements to read.

Specified by:
readFloats in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readDoubles

public void readDoubles(double[] v,
                        int k,
                        int n)
                 throws java.io.IOException
Reads double elements into a specified array.

Specified by:
readDoubles in interface ArrayInput
Parameters:
v - the array.
k - the index of the first element to read.
n - the number of elements to read.
Throws:
java.io.IOException

readDoubles

public void readDoubles(double[] v)
                 throws java.io.IOException
Reads double elements into a specified array. The array length equals the number of elements to read.

Specified by:
readDoubles in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readDoubles

public void readDoubles(double[][] v)
                 throws java.io.IOException
Reads double elements into a specified array. The array length equals the number of elements to read.

Specified by:
readDoubles in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

readDoubles

public void readDoubles(double[][][] v)
                 throws java.io.IOException
Reads double elements into a specified array. The array length equals the number of elements to read.

Specified by:
readDoubles in interface ArrayInput
Parameters:
v - the array.
Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[] v,
                       int k,
                       int n)
                throws java.io.IOException
Writes byte elements from a specified array.

Specified by:
writeBytes in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[] v)
                throws java.io.IOException
Writes byte elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeBytes in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[][] v)
                throws java.io.IOException
Writes byte elements from a specified array.

Specified by:
writeBytes in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeBytes

public void writeBytes(byte[][][] v)
                throws java.io.IOException
Writes byte elements from a specified array.

Specified by:
writeBytes in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeChars

public void writeChars(char[] v,
                       int k,
                       int n)
                throws java.io.IOException
Writes char elements from a specified array.

Specified by:
writeChars in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeChars

public void writeChars(char[] v)
                throws java.io.IOException
Writes char elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeChars in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeChars

public void writeChars(char[][] v)
                throws java.io.IOException
Writes char elements from a specified array.

Specified by:
writeChars in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeChars

public void writeChars(char[][][] v)
                throws java.io.IOException
Writes char elements from a specified array.

Specified by:
writeChars in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeShorts

public void writeShorts(short[] v,
                        int k,
                        int n)
                 throws java.io.IOException
Writes short elements from a specified array.

Specified by:
writeShorts in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeShorts

public void writeShorts(short[] v)
                 throws java.io.IOException
Writes shorts elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeShorts in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeShorts

public void writeShorts(short[][] v)
                 throws java.io.IOException
Writes short elements from a specified array.

Specified by:
writeShorts in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeShorts

public void writeShorts(short[][][] v)
                 throws java.io.IOException
Writes short elements from a specified array.

Specified by:
writeShorts in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeInts

public void writeInts(int[] v,
                      int k,
                      int n)
               throws java.io.IOException
Writes int elements from a specified array.

Specified by:
writeInts in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeInts

public void writeInts(int[] v)
               throws java.io.IOException
Writes int elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeInts in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeInts

public void writeInts(int[][] v)
               throws java.io.IOException
Writes int elements from a specified array.

Specified by:
writeInts in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeInts

public void writeInts(int[][][] v)
               throws java.io.IOException
Writes int elements from a specified array.

Specified by:
writeInts in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeLongs

public void writeLongs(long[] v,
                       int k,
                       int n)
                throws java.io.IOException
Writes long elements from a specified array.

Specified by:
writeLongs in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeLongs

public void writeLongs(long[] v)
                throws java.io.IOException
Writes long elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeLongs in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeLongs

public void writeLongs(long[][] v)
                throws java.io.IOException
Writes long elements from a specified array.

Specified by:
writeLongs in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeLongs

public void writeLongs(long[][][] v)
                throws java.io.IOException
Writes long elements from a specified array.

Specified by:
writeLongs in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeFloats

public void writeFloats(float[] v,
                        int k,
                        int n)
                 throws java.io.IOException
Writes float elements from a specified array.

Specified by:
writeFloats in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeFloats

public void writeFloats(float[] v)
                 throws java.io.IOException
Writes float elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeFloats in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeFloats

public void writeFloats(float[][] v)
                 throws java.io.IOException
Writes float elements from a specified array.

Specified by:
writeFloats in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeFloats

public void writeFloats(float[][][] v)
                 throws java.io.IOException
Writes float elements from a specified array.

Specified by:
writeFloats in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeDoubles

public void writeDoubles(double[] v,
                         int k,
                         int n)
                  throws java.io.IOException
Writes double elements from a specified array.

Specified by:
writeDoubles in interface ArrayOutput
Parameters:
v - the array.
k - the index of the first element to write.
n - the number of elements to write.
Throws:
java.io.IOException

writeDoubles

public void writeDoubles(double[] v)
                  throws java.io.IOException
Writes double elements from a specified array. The array length equals the number of elements to write.

Specified by:
writeDoubles in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeDoubles

public void writeDoubles(double[][] v)
                  throws java.io.IOException
Writes double elements from a specified array.

Specified by:
writeDoubles in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException

writeDoubles

public void writeDoubles(double[][][] v)
                  throws java.io.IOException
Writes double elements from a specified array.

Specified by:
writeDoubles in interface ArrayOutput
Parameters:
v - the array.
Throws:
java.io.IOException