public class IISRandomAccessIO extends Object implements RandomAccessIO
ImageInputStream
into a
RandomAccessIO
. The resulting class is read-only.Modifier and Type | Field and Description |
---|---|
private ImageInputStream |
iis
The
ImageInputStream that is wrapped |
Constructor and Description |
---|
IISRandomAccessIO(ImageInputStream iis)
Creates a
RandomAccessIO instance from the supplied
ImageInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the I/O stream.
|
void |
flush()
A null operation as writing is not supported.
|
int |
getByteOrdering()
Returns the endianess (i.e., byte ordering) of the implementing
class.
|
int |
getPos()
Returns the stream position clamped to a maximum of
Integer.MAX_VALUE . |
int |
length()
Returns the length of the data stream.
|
int |
read()
Reads a byte of data from the stream.
|
byte |
readByte()
Should read a signed byte (i.e., 8 bit) from the input.
|
double |
readDouble()
Should read an IEEE double precision (i.e., 64 bit)
floating-point number from the input.
|
float |
readFloat()
Should read an IEEE single precision (i.e., 32 bit)
floating-point number from the input.
|
void |
readFully(byte[] b,
int off,
int n)
Reads up to len bytes of data from this file into an array of
bytes.
|
int |
readInt()
Should read a signed int (i.e., 32 bit) from the input.
|
long |
readLong()
Should read a signed long (i.e., 64 bit) from the input.
|
short |
readShort()
Should read a signed short (i.e., 16 bit) from the input.
|
int |
readUnsignedByte()
Should read an unsigned byte (i.e., 8 bit) from the input.
|
long |
readUnsignedInt()
Should read an unsigned int (i.e., 32 bit) from the input.
|
int |
readUnsignedShort()
Should read an unsigned short (i.e., 16 bit) from the input.
|
void |
seek(int off)
Moves the current position for the next read or write operation to
offset.
|
int |
skipBytes(int n)
Skips n bytes from the input.
|
void |
write(int b)
Throws an
IOException as writing is not supported. |
void |
writeByte(int v)
Throws an
IOException as writing is not supported. |
void |
writeDouble(double v)
Throws an
IOException as writing is not supported. |
void |
writeFloat(float v)
Throws an
IOException as writing is not supported. |
void |
writeInt(int v)
Throws an
IOException as writing is not supported. |
void |
writeLong(long v)
Throws an
IOException as writing is not supported. |
void |
writeShort(int v)
Throws an
IOException as writing is not supported. |
private ImageInputStream iis
ImageInputStream
that is wrappedpublic IISRandomAccessIO(ImageInputStream iis)
RandomAccessIO
instance from the supplied
ImageInputStream
.iis
- The source ImageInputStream
.public void close() throws IOException
RandomAccessIO
close
in interface RandomAccessIO
IOException
- If an I/O error ocurred.public int getPos() throws IOException
Integer.MAX_VALUE
.getPos
in interface RandomAccessIO
IOException
- If an I/O error ocurred.public void seek(int off) throws IOException
RandomAccessIO
seek
in interface RandomAccessIO
off
- The offset where to move to.EOFException
- If in read-only and seeking beyond EOF.IOException
- If an I/O error ocurred.public int length() throws IOException
If the length of the ImageInputStream
is not
-1
, then it is returned after being clamped to
a maximum value of Integer.MAX_VALUE
. If the
ImageInputStream
is -1
, the stream
is read to a maximum position of Integer.MAX_VALUE
and its final position is returned. The position of the stream
is unchanged from the value it had prior to the call.
length
in interface RandomAccessIO
IOException
- If an I/O error ocurred.public int read() throws IOException
RandomAccessIO
read
in interface RandomAccessIO
EOFException
- If the end-of file was reached.IOException
- If an I/O error ocurred.public void readFully(byte[] b, int off, int n) throws IOException
RandomAccessIO
readFully
in interface RandomAccessIO
b
- The buffer into which the data is to be read. It must be long
enough.off
- The index in 'b' where to place the first byte read.n
- The number of bytes to read.EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public int getByteOrdering()
BinaryDataInput
getByteOrdering
in interface BinaryDataInput
getByteOrdering
in interface BinaryDataOutput
EndianType
public byte readByte() throws IOException
BinaryDataInput
readByte
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public int readUnsignedByte() throws IOException
BinaryDataInput
readUnsignedByte
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public short readShort() throws IOException
BinaryDataInput
readShort
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public int readUnsignedShort() throws IOException
BinaryDataInput
readUnsignedShort
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public int readInt() throws IOException
BinaryDataInput
readInt
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public long readUnsignedInt() throws IOException
BinaryDataInput
readUnsignedInt
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public long readLong() throws IOException
BinaryDataInput
readLong
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public float readFloat() throws IOException
BinaryDataInput
readFloat
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public double readDouble() throws IOException
BinaryDataInput
readDouble
in interface BinaryDataInput
EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.public int skipBytes(int n) throws IOException
BinaryDataInput
skipBytes
in interface BinaryDataInput
n
- The number of bytes to skipEOFException
- If the end-of file was reached before
all the bytes could be skipped.IOException
- If an I/O error ocurred.public void flush()
flush
in interface BinaryDataOutput
public void write(int b) throws IOException
IOException
as writing is not supported.write
in interface RandomAccessIO
b
- The byte to write. The lower 8 bits of b are
written.IOException
- If an I/O error ocurred.public void writeByte(int v) throws IOException
IOException
as writing is not supported.writeByte
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public void writeShort(int v) throws IOException
IOException
as writing is not supported.writeShort
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public void writeInt(int v) throws IOException
IOException
as writing is not supported.writeInt
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public void writeLong(long v) throws IOException
IOException
as writing is not supported.writeLong
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public void writeFloat(float v) throws IOException
IOException
as writing is not supported.writeFloat
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public void writeDouble(double v) throws IOException
IOException
as writing is not supported.writeDouble
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.Copyright © 2017 Open Microscopy Environment