public class BEBufferedRandomAccessFile extends BufferedRandomAccessFile implements RandomAccessIO, EndianType
byteBuffer, byteBufferChanged, byteOrdering, isEOFInBuffer, maxByte, offset, pos
BIG_ENDIAN, LITTLE_ENDIAN
Constructor and Description |
---|
BEBufferedRandomAccessFile(File file,
String mode)
Constructor.
|
BEBufferedRandomAccessFile(File file,
String mode,
int bufferSize)
Constructor.
|
BEBufferedRandomAccessFile(String name,
String mode)
Constructor.
|
BEBufferedRandomAccessFile(String name,
String mode,
int bufferSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
readDouble()
Reads an IEEE double precision (i.e., 64 bit) floating-point number
from the input.
|
float |
readFloat()
Reads an IEEE single precision (i.e., 32 bit) floating-point number
from the input.
|
int |
readInt()
Reads a signed int (i.e., 32 bit) from the input.
|
long |
readLong()
Reads a signed long (i.e., 64 bit) from the input.
|
short |
readShort()
Reads a signed short (i.e., 16 bit) from the input.
|
long |
readUnsignedInt()
Reads an unsigned int (i.e., 32 bit) from the input.
|
int |
readUnsignedShort()
Reads an unsigned short (i.e., 16 bit) from the input.
|
String |
toString()
Returns a string of information about the file and the endianess
|
void |
writeDouble(double v)
Writes the IEEE double value v (i.e., 64 bits) to the
output.
|
void |
writeFloat(float v)
Writes the IEEE float value v (i.e., 32 bits) to the
output.
|
void |
writeInt(int v)
Writes the int value of v (i.e., the 32 bits) to the
output.
|
void |
writeLong(long v)
Writes the long value of v (i.e., the 64 bits) to the
output.
|
void |
writeShort(int v)
Writes the short value of v (i.e., 16 least significant bits)
to the output.
|
close, flush, getByteOrdering, getPos, length, read, readByte, readFully, readNewBuffer, readUnsignedByte, seek, skipBytes, write, write, write, writeByte
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, getPos, length, read, readFully, seek, write
getByteOrdering, readByte, readUnsignedByte, skipBytes
flush, getByteOrdering, writeByte
public BEBufferedRandomAccessFile(File file, String mode, int bufferSize) throws IOException
file
- The file associated with the buffermode
- "r" for read, "rw" or "rw+" for read and write mode ("rw+"
opens the file for update whereas "rw" removes it
before. So the 2 modes are different only if the file
already exists).bufferSize
- The number of bytes to bufferIOException
- If an I/O error ocurred.public BEBufferedRandomAccessFile(File file, String mode) throws IOException
file
- The file associated with the buffermode
- "r" for read, "rw" or "rw+" for read and write mode ("rw+"
opens the file for update whereas "rw" removes it
before. So the 2 modes are different only if the file
already exists).IOException
- If an I/O error ocurred.public BEBufferedRandomAccessFile(String name, String mode, int bufferSize) throws IOException
name
- The name of the file associated with the buffermode
- "r" for read, "rw" or "rw+" for read and write mode ("rw+"
opens the file for update whereas "rw" removes it
before. So the 2 modes are different only if the file
already exists).bufferSize
- The number of bytes to bufferIOException
- If an I/O error ocurred.public BEBufferedRandomAccessFile(String name, String mode) throws IOException
name
- The name of the file associated with the buffermode
- "r" for read, "rw" or "rw+" for read and write mode ("rw+"
opens the file for update whereas "rw" removes it
before. So the 2 modes are different only if the file
already exists).IOException
- If an I/O error ocurred.public final void writeShort(int v) throws IOException
Signed or unsigned data can be written. To write a signed value just pass the short value as an argument. To write unsigned data pass the int value as an argument (it will be automatically casted, and only the 16 least significant bits will be written).
writeShort
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public final void writeInt(int v) throws IOException
writeInt
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public final void writeLong(long v) throws IOException
writeLong
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public final void writeFloat(float v) throws IOException
writeFloat
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public final void writeDouble(double v) throws IOException
writeDouble
in interface BinaryDataOutput
v
- The value to write to the outputIOException
- If an I/O error ocurred.public final short readShort() throws IOException, EOFException
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 final int readUnsignedShort() throws IOException, EOFException
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 final int readInt() throws IOException, EOFException
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 final long readUnsignedInt() throws IOException, EOFException
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 final long readLong() throws IOException, EOFException
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 final float readFloat() throws EOFException, IOException
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 final double readDouble() throws IOException, EOFException
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 String toString()
toString
in class BufferedRandomAccessFile
Copyright © 2014. All rights reserved.