C# Class CSJ2K.j2k.io.BEBufferedRandomAccessFile

This class defines a Buffered Random Access File, where all I/O is considered to be big-endian. It extends the BufferedRandomAccessFile class.
Inheritance: BufferedRandomAccessFile, RandomAccessIO, EndianType
Show file Open project: cureos/csj2k Class Usage Examples

Public Methods

Method Description
BEBufferedRandomAccessFile ( Stream stream, bool isReadOnly ) : System

Constructor. Uses the default value for the byte-buffer size (512 bytes).

BEBufferedRandomAccessFile ( Stream stream, bool isReadOnly, int bufferSize ) : System

Constructor. Always needs a size for the buffer.

BEBufferedRandomAccessFile ( System name, System mode ) : System

Constructor. Uses the default value for the byte-buffer size (512 bytes).

BEBufferedRandomAccessFile ( System name, System mode, int bufferSize ) : System

Constructor. Always needs a size for the buffer.

ToString ( ) : System.String

Returns a string of information about the file and the endianess

readDouble ( ) : double

Reads an IEEE double precision (i.e., 64 bit) floating-point number from the input. Prior to reading, the input should be realigned at the byte level.

readFloat ( ) : float

Reads an IEEE single precision (i.e., 32 bit) floating-point number from the input. Prior to reading, the input should be realigned at the byte level.

readInt ( ) : int

Reads a signed int (i.e., 32 bit) from the input. Prior to reading, the input should be realigned at the byte level.

readLong ( ) : long

Reads a signed long (i.e., 64 bit) from the input. Prior to reading, the input should be realigned at the byte level.

readShort ( ) : short

Reads a signed short (i.e. 16 bit) from the input. Prior to reading, the input should be realigned at the byte level.

readUnsignedInt ( ) : long

Reads an unsigned int (i.e., 32 bit) from the input. It is returned as a long since Java does not have an unsigned short type. Prior to reading, the input should be realigned at the byte level.

readUnsignedShort ( ) : int

Reads an unsigned short (i.e., 16 bit) from the input. It is returned as an int since Java does not have an unsigned short type. Prior to reading, the input should be realigned at the byte level.

writeDouble ( double v ) : void

Writes the IEEE double value v (i.e., 64 bits) to the output. Prior to writing, the output should be realigned at the byte level.

writeFloat ( float v ) : void

Writes the IEEE float value v (i.e., 32 bits) to the output. Prior to writing, the output should be realigned at the byte level.

writeInt ( int v ) : void

Writes the int value of v (i.e., the 32 bits) to the output. Prior to writing, the output should be realigned at the byte level.

writeLong ( long v ) : void

Writes the long value of v (i.e., the 64 bits) to the output. Prior to writing, the output should be realigned at the byte level.

writeShort ( int v ) : void

Writes the short value of v (i.e., 16 least significant bits) to the output. Prior to writing, the output should be realigned at the byte level.

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).

Method Details

BEBufferedRandomAccessFile() public method

Constructor. Uses the default value for the byte-buffer size (512 bytes).
If an I/O error ocurred.
public BEBufferedRandomAccessFile ( Stream stream, bool isReadOnly ) : System
stream Stream The stream associated with the buffer
isReadOnly bool Indicates whether file is read-only or not.
return System

BEBufferedRandomAccessFile() public method

Constructor. Always needs a size for the buffer.
If an I/O error ocurred. /// ///
public BEBufferedRandomAccessFile ( Stream stream, bool isReadOnly, int bufferSize ) : System
stream Stream The stream associated with the buffer
isReadOnly bool Indicates whether file is read-only or not.
bufferSize int The number of bytes to buffer
return System

BEBufferedRandomAccessFile() public method

Constructor. Uses the default value for the byte-buffer size (512 bytes).
If an I/O error ocurred. /// ///
public BEBufferedRandomAccessFile ( System name, System mode ) : System
name System The name of the file associated with the buffer /// ///
mode System "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). /// ///
return System

BEBufferedRandomAccessFile() public method

Constructor. Always needs a size for the buffer.
If an I/O error ocurred. /// ///
public BEBufferedRandomAccessFile ( System name, System mode, int bufferSize ) : System
name System The name of the file associated with the buffer /// ///
mode System "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 int The number of bytes to buffer /// ///
return System

ToString() public method

Returns a string of information about the file and the endianess
public ToString ( ) : System.String
return System.String

readDouble() public method

Reads an IEEE double precision (i.e., 64 bit) floating-point number from the input. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readDouble ( ) : double
return double

readFloat() public method

Reads an IEEE single precision (i.e., 32 bit) floating-point number from the input. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readFloat ( ) : float
return float

readInt() public method

Reads a signed int (i.e., 32 bit) from the input. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readInt ( ) : int
return int

readLong() public method

Reads a signed long (i.e., 64 bit) from the input. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readLong ( ) : long
return long

readShort() public method

Reads a signed short (i.e. 16 bit) from the input. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readShort ( ) : short
return short

readUnsignedInt() public method

Reads an unsigned int (i.e., 32 bit) from the input. It is returned as a long since Java does not have an unsigned short type. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readUnsignedInt ( ) : long
return long

readUnsignedShort() public method

Reads an unsigned short (i.e., 16 bit) from the input. It is returned as an int since Java does not have an unsigned short type. Prior to reading, the input should be realigned at the byte level.
If the end-of file was reached before /// getting all the necessary data. /// /// If an I/O error ocurred. /// ///
public readUnsignedShort ( ) : int
return int

writeDouble() public method

Writes the IEEE double value v (i.e., 64 bits) to the output. Prior to writing, the output should be realigned at the byte level.
If an I/O error ocurred. /// ///
public writeDouble ( double v ) : void
v double The value to write to the output /// ///
return void

writeFloat() public method

Writes the IEEE float value v (i.e., 32 bits) to the output. Prior to writing, the output should be realigned at the byte level.
If an I/O error ocurred. /// ///
public writeFloat ( float v ) : void
v float The value to write to the output /// ///
return void

writeInt() public method

Writes the int value of v (i.e., the 32 bits) to the output. Prior to writing, the output should be realigned at the byte level.
If an I/O error ocurred. /// ///
public writeInt ( int v ) : void
v int The value to write to the output /// ///
return void

writeLong() public method

Writes the long value of v (i.e., the 64 bits) to the output. Prior to writing, the output should be realigned at the byte level.
If an I/O error ocurred. /// ///
public writeLong ( long v ) : void
v long The value to write to the output /// ///
return void

writeShort() public method

Writes the short value of v (i.e., 16 least significant bits) to the output. Prior to writing, the output should be realigned at the byte level.

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).

If an I/O error ocurred. /// ///
public writeShort ( int v ) : void
v int The value to write to the output /// ///
return void