public class HDF5DataSetRandomAccessFile
extends java.lang.Object
implements ch.systemsx.cisd.base.io.IRandomAccessFile, java.io.Flushable
IRandomAccessFile
backed by an HDF5 dataset. The HDF5 dataset needs to be a byte array
(or opaque byte array) of rank 1.Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
void |
flush() |
java.nio.ByteOrder |
getByteOrder()
Gets the byte-order (endiness) of the random access file.
|
java.lang.String |
getDataSetPath() |
long |
getFilePointer()
Returns the current offset in this file.
|
java.io.File |
getHdf5File() |
boolean |
isReadOnly()
Returns
true if the HDF5 file has been opened in read-only mode. |
long |
length()
Returns the length of this file.
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
java.lang.String |
readLine() |
long |
readLong() |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
java.lang.String |
readUTF() |
void |
reset() |
void |
seek(long pos)
Sets the file-pointer offset, measured from the beginning of this file, at which the next
read or write occurs.
|
void |
setByteOrder(java.nio.ByteOrder byteOrder)
Sets the byte-order (endiness) of the random access file.
|
void |
setLength(long newLength)
Sets the length of this file.
|
long |
skip(long n) |
int |
skipBytes(int n) |
void |
synchronize()
Performs a synchronization of the resource.
|
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(java.lang.String s) |
void |
writeChar(int v) |
void |
writeChars(java.lang.String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(java.lang.String str) |
public java.io.File getHdf5File()
public java.lang.String getDataSetPath()
public boolean isReadOnly()
true
if the HDF5 file has been opened in read-only mode.public long getFilePointer() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
ch.systemsx.cisd.base.io.IRandomAccessFile
getFilePointer
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- if an I/O error occurs.public int read() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
read
in interface ch.systemsx.cisd.base.io.IInputStream
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
InputStream.read()
public int read(byte[] b) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
read
in interface ch.systemsx.cisd.base.io.IInputStream
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
InputStream.read(byte[])
public int read(byte[] b, int off, int len) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
read
in interface ch.systemsx.cisd.base.io.IInputStream
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
InputStream.read(byte[], int, int)
public long skip(long n) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
skip
in interface ch.systemsx.cisd.base.io.IInputStream
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
InputStream.skip(long)
public int available()
available
in interface ch.systemsx.cisd.base.io.IInputStream
InputStream.available()
public void close() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
close
in interface ch.systemsx.cisd.base.io.IInputStream
close
in interface ch.systemsx.cisd.base.io.IOutputStream
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
InputStream.close()
public void mark(int readlimit)
mark
in interface ch.systemsx.cisd.base.io.IInputStream
InputStream.mark(int)
public void reset() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
reset
in interface ch.systemsx.cisd.base.io.IInputStream
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
InputStream.reset()
public boolean markSupported()
markSupported
in interface ch.systemsx.cisd.base.io.IInputStream
InputStream.markSupported()
public void flush() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
flush
in interface ch.systemsx.cisd.base.io.IOutputStream
flush
in interface java.io.Flushable
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
OutputStream.flush()
public void synchronize() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
ch.systemsx.cisd.base.io.ISynchronizable
synchronize
in interface ch.systemsx.cisd.base.io.IOutputStream
synchronize
in interface ch.systemsx.cisd.base.io.ISynchronizable
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
OutputStream.flush()
public java.nio.ByteOrder getByteOrder()
ch.systemsx.cisd.base.io.IRandomAccessFile
getByteOrder
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
public void setByteOrder(java.nio.ByteOrder byteOrder)
ch.systemsx.cisd.base.io.IRandomAccessFile
setByteOrder
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
public void seek(long pos) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
ch.systemsx.cisd.base.io.IRandomAccessFile
seek
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
pos
- the offset position, measured in bytes from the beginning of the file, at which to
set the file pointer.ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- if pos
is less than 0
or if an I/O
error occurs.public long length() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
ch.systemsx.cisd.base.io.IRandomAccessFile
length
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- if an I/O error occurs.public void setLength(long newLength) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
ch.systemsx.cisd.base.io.IRandomAccessFile
If the present length of the file as returned by the length
method is greater
than the newLength
argument then the file will be truncated. In this case, if
the file offset as returned by the getFilePointer
method is greater than
newLength
then after this method returns the offset will be equal to
newLength
.
If the present length of the file as returned by the length
method is smaller
than the newLength
argument then the file will be extended. In this case, the
contents of the extended portion of the file are not defined.
setLength
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
newLength
- The desired length of the filech.systemsx.cisd.base.exceptions.IOExceptionUnchecked
- If an I/O error occurspublic void readFully(byte[] b) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readFully
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readFully
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readFully(byte[])
public void readFully(byte[] b, int off, int len) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readFully
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readFully
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readFully(byte[], int, int)
public int skipBytes(int n) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
skipBytes
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
skipBytes
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.skipBytes(int)
public boolean readBoolean() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readBoolean
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readBoolean
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readBoolean()
public byte readByte() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readByte
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readByte
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readByte()
public int readUnsignedByte() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readUnsignedByte
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readUnsignedByte
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readUnsignedByte()
public short readShort() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readShort
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readShort
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readShort()
public int readUnsignedShort() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readUnsignedShort
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readUnsignedShort
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readUnsignedShort()
public char readChar() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readChar
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readChar
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readChar()
public int readInt() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readInt
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readInt
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readInt()
public long readLong() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readLong
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readLong
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readLong()
public float readFloat() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readFloat
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readFloat
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readFloat()
public double readDouble() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readDouble
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readDouble
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readDouble()
public java.lang.String readLine() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readLine
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readLine
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readLine()
public java.lang.String readUTF() throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
readUTF
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
readUTF
in interface java.io.DataInput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataInput.readUTF()
public void write(int b) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
write
in interface ch.systemsx.cisd.base.io.IOutputStream
write
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
write
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.write(int)
public void write(byte[] b) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
write
in interface ch.systemsx.cisd.base.io.IOutputStream
write
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
write
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.write(byte[])
public void write(byte[] b, int off, int len) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
write
in interface ch.systemsx.cisd.base.io.IOutputStream
write
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
write
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.write(byte[], int, int)
public void writeBoolean(boolean v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeBoolean
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeBoolean
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeBoolean(boolean)
public void writeByte(int v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeByte
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeByte
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeByte(int)
public void writeShort(int v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeShort
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeShort
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeShort(int)
public void writeChar(int v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeChar
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeChar
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeChar(int)
public void writeInt(int v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeInt
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeInt
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeInt(int)
public void writeLong(long v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeLong
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeLong
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeLong(long)
public void writeFloat(float v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeFloat
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeFloat
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeFloat(float)
public void writeDouble(double v) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeDouble
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeDouble
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeDouble(double)
public void writeBytes(java.lang.String s) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeBytes
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeBytes
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeBytes(String)
public void writeChars(java.lang.String s) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeChars
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeChars
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeChars(String)
public void writeUTF(java.lang.String str) throws ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
writeUTF
in interface ch.systemsx.cisd.base.io.IRandomAccessFile
writeUTF
in interface java.io.DataOutput
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
DataOutput.writeUTF(String)