public class RandomAccessOutputStream extends OutputStream implements DataOutput, Closeable
| Modifier and Type | Field and Description |
|---|---|
private int |
currentBit |
private int |
currentByte |
private boolean |
dirtyByte |
private IRandomAccess |
outputFile |
| Constructor and Description |
|---|
RandomAccessOutputStream(byte[] array)
Constructs a random access stream around the given byte array.
|
RandomAccessOutputStream(IRandomAccess handle)
Constructs a random access stream around the given handle.
|
RandomAccessOutputStream(String file)
Constructs a random access stream around the given file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
long |
getFilePointer()
Returns the current offset within the stream.
|
boolean |
isLittleEndian()
Gets the endianness of the stream.
|
long |
length()
Returns the length of the file.
|
void |
order(boolean little)
Sets the endianness of the stream.
|
void |
seek(long pos)
Seeks to the given offset within the stream.
|
void |
skipBytes(int skip)
Advances the current offset by the given number of bytes.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(ByteBuffer b)
Writes bytes to the stream from the given buffer.
|
void |
write(ByteBuffer b,
int off,
int len) |
void |
write(int b) |
void |
writeBits(int value,
int numBits)
Writes the given value using the given number of bits.
|
void |
writeBits(String bitString)
Writes the bits represented by a bit string to the buffer.
|
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLine(String s)
Writes the given string followed by a newline character.
|
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(String str) |
private IRandomAccess outputFile
private int currentBit
private int currentByte
private boolean dirtyByte
public RandomAccessOutputStream(String file) throws IOException
file - Filename to open the stream for.IOException - If there is a problem opening the file.public RandomAccessOutputStream(IRandomAccess handle)
handle - Handle to open the stream for.public RandomAccessOutputStream(byte[] array)
throws IOException
IOExceptionpublic void seek(long pos)
throws IOException
IOExceptionpublic long getFilePointer()
throws IOException
IOExceptionpublic long length()
throws IOException
IOExceptionpublic void skipBytes(int skip)
throws IOException
IOExceptionpublic void order(boolean little)
public boolean isLittleEndian()
public void writeLine(String s) throws IOException
IOExceptionpublic void writeBits(int value,
int numBits)
throws IOException
IOExceptionpublic void writeBits(String bitString) throws IOException
IllegalArgumentException - If any characters other than
'0' and '1' appear in the string.IOExceptionpublic void write(byte[] b)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic void write(ByteBuffer b) throws IOException
b - Source buffer to read data from.IOException - If there is an error writing to the stream.public void write(ByteBuffer b, int off, int len) throws IOException
b - Source buffer to read data from.off - Offset within the buffer to start reading from.len - Number of bytes to read.IOException - If there is an error writing to the stream.public void write(int b)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic void writeBoolean(boolean v)
throws IOException
writeBoolean in interface DataOutputIOExceptionpublic void writeByte(int v)
throws IOException
writeByte in interface DataOutputIOExceptionpublic void writeBytes(String s) throws IOException
writeBytes in interface DataOutputIOExceptionpublic void writeChar(int v)
throws IOException
writeChar in interface DataOutputIOExceptionpublic void writeChars(String s) throws IOException
writeChars in interface DataOutputIOExceptionpublic void writeDouble(double v)
throws IOException
writeDouble in interface DataOutputIOExceptionpublic void writeFloat(float v)
throws IOException
writeFloat in interface DataOutputIOExceptionpublic void writeInt(int v)
throws IOException
writeInt in interface DataOutputIOExceptionpublic void writeLong(long v)
throws IOException
writeLong in interface DataOutputIOExceptionpublic void writeShort(int v)
throws IOException
writeShort in interface DataOutputIOExceptionpublic void writeUTF(String str) throws IOException
writeUTF in interface DataOutputIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionCopyright © 2015 Open Microscopy Environment