artefaktur
software engineer &        architecture

 
 
 
 

class RandomAccessFile

Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::io::RandomAccessFile Class Reference

#include <RandomAccessFile.h>

Inheritance diagram for acdk::io::RandomAccessFile:

acdk::lang::Object acdk::io::DataReader acdk::io::DataWriter acdk::io::Storage acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

Access a standard system file.

API: ACDK<br/>

Author:
Roger Rene Kommer (mailto:kommer@artefaktur.com)
Version:
Revision
1.13
Date:
Date
2005/04/09 19:26:45


Public Member Functions

 RandomAccessFile (IN(RFile) file, IN(RString) mode, IN(RDataReader) dataReader=Nil, IN(RDataWriter) dataWriter=Nil)
 Additional features not implemented by jdk:.

 RandomAccessFile (IN(RString) name, IN(RString) mode, IN(RDataReader) dataReader=Nil, IN(RDataWriter) dataWriter=Nil)
 Additional features not implemented by jdk:.

virtual ~RandomAccessFile ()
virtual void setIn (IN(RReader) reader)
virtual void setOut (IN(RWriter) writer)
virtual void write (const byte *cstr, int offset, int len)
virtual void write (byte b)
 default implementation: byte cbuf[2]; cbuf[1] = 0; cbuf[0] = c; return write((const byte*)cbuf, 0, 1);

virtual void write (IN(RbyteArray) ch, int offset=0, int len=-1)
 writes to the unterlying data stream

virtual void flush ()
virtual void close ()
 closes this Reader.

virtual jlong seek (SeekPos seekrel, jlong seekpos)
 Set stream position in this Reader to given position.

virtual jlong skip (jlong n)
 Move forwart into the stream.

virtual RFileDescriptor getFD ()
virtual jlong getFilePointer ()
virtual jlong length ()
virtual int read ()
 read a single byte from stream

virtual int read (IN(RbyteArray) buffer, int offset=0, int len=-1)
 read the len bytes into buffer at offset of the buffer

virtual int read (byte *buffer, int offset, int len)
virtual void reset ()
 if mark is set, set stream to mark point otherwise to begin of this stream.

virtual bool ready ()
virtual void seek (jlong pos)
virtual void setLength (jlong newLength)
 Note: on Non-Unix it may not work correctly, if newLength < currentLenght.

virtual int skipBytes (int n)
virtual bool readBoolean ()
 implemented DataReader

virtual char readChar ()
 implemented DataReader

virtual uc2char readUcChar ()
 implemented DataReader

virtual double readDouble ()
 implemented DataReader

virtual float readFloat ()
 implemented DataReader

virtual int readInt ()
 implemented DataReader

virtual jlong readLong ()
 implemented DataReader

virtual short readShort ()
 implemented DataReader

virtual RString readString ()
 JDK implements readUTF instead of readString.

virtual RString readUTF ()
 Not yet implemented (use readString instead).

virtual void writeBoolean (bool b)
 implemented DataWriter

virtual void writeChar (char b)
 implemented DataWriter

virtual void writeUcChar (uc2char b)
 implemented DataWriter

virtual void writeShort (short b)
 implemented DataWriter

virtual void writeInt (int b)
 implemented DataWriter

virtual void writeLong (jlong b)
 implemented DataWriter

virtual void writeFloat (float b)
 implemented DataWriter

virtual void writeDouble (double b)
 implemented DataWriter

virtual void writeString (IN(RString) str)
 Writes the given string.

virtual void writeUTF (IN(RString) str)
 Not yet implemented (Use writeString instead).

virtual RStorage getStorage ()
 implemented FileterWriter

virtual RString getDeviceName ()
 implemented Storage

virtual bool isWriteable ()
 implemented Storage

virtual bool isReadable ()
 implemented Storage

virtual RReader getStorageReader ()
 implemented FilterReader

virtual RWriter getStorageWriter ()
 implemented FilterWriter


Private Attributes

FileReaderWriterImpl _inOut
RFile _file
RDataReader _dataReader
RDataWriter _dataWriter

Constructor & Destructor Documentation

acdk::io::RandomAccessFile::RandomAccessFile IN(RFile file,
IN(RString mode,
IN(RDataReader dataReader = Nil,
IN(RDataWriter dataWriter = Nil
 

Additional features not implemented by jdk:.

Parameters:
dataReader FileReader using for inputs. Default is BinaryReader. You can set also other DataReader like ASCIIDataReader, XMLDataReader, ....
dataWriter FileWriter using for outputs. Default is BinaryWriter. You can set also other DataWriters like ASCIIDataWriter, XMLDataWriter, ....

acdk::io::RandomAccessFile::RandomAccessFile IN(RString name,
IN(RString mode,
IN(RDataReader dataReader = Nil,
IN(RDataWriter dataWriter = Nil
 

Additional features not implemented by jdk:.

Parameters:
dataReader FileReader using for inputs. Default is BinaryReader. You can set also other DataReader like ASCIIReader, XMLReader, ....
dataWriter FileWriter using for outputs. Default is BinaryWriter. You can set also other DataWriters like ASCIIWriter, XMLWriter, ....

virtual acdk::io::RandomAccessFile::~RandomAccessFile  )  [virtual]
 


Member Function Documentation

virtual void acdk::io::RandomAccessFile::close  )  [virtual]
 

closes this Reader.

Note: Some Reader must be closed explicitaly Note: Reader implementation must be avare from closing a reader more than one

Reimplemented from acdk::io::Reader.

virtual void acdk::io::RandomAccessFile::flush  )  [virtual]
 

Implements acdk::io::DataWriter.

virtual RString acdk::io::RandomAccessFile::getDeviceName  )  [virtual]
 

implemented Storage

Implements acdk::io::Storage.

virtual RFileDescriptor acdk::io::RandomAccessFile::getFD  )  [virtual]
 

virtual jlong acdk::io::RandomAccessFile::getFilePointer  )  [virtual]
 

virtual RStorage acdk::io::RandomAccessFile::getStorage  )  [virtual]
 

implemented FileterWriter

Implements acdk::io::DataReader.

virtual RReader acdk::io::RandomAccessFile::getStorageReader  )  [inline, virtual]
 

implemented FilterReader

Implements acdk::io::DataReader.

virtual RWriter acdk::io::RandomAccessFile::getStorageWriter  )  [inline, virtual]
 

implemented FilterWriter

Implements acdk::io::DataWriter.

virtual bool acdk::io::RandomAccessFile::isReadable  )  [inline, virtual]
 

implemented Storage

Implements acdk::io::Storage.

virtual bool acdk::io::RandomAccessFile::isWriteable  )  [inline, virtual]
 

implemented Storage

Implements acdk::io::Storage.

virtual jlong acdk::io::RandomAccessFile::length  )  [virtual]
 

virtual int acdk::io::RandomAccessFile::read byte buffer,
int  offset,
int  len
[virtual]
 

See also:
other read(RbyteArray, int, int)

Reimplemented from acdk::io::Reader.

virtual int acdk::io::RandomAccessFile::read IN(RbyteArray buffer,
int  offset = 0,
int  len = -1
[virtual]
 

read the len bytes into buffer at offset of the buffer

Parameters:
buffer where to write the bytes
offset offset to write into buffer
len how many bytes to read. if == -1 read into many bytes, that fits into buffer (buffer->length() - offset) ``
Returns:
number of bytes readed. may less than input if EOS is reached
Exceptions:
EOF exception, if trying to read behind EOS

Reimplemented from acdk::io::Reader.

virtual int acdk::io::RandomAccessFile::read  )  [virtual]
 

read a single byte from stream

Returns:
the byte readed or -1 if EOS.
Exceptions:
EOF exception, if trying to read behind EOS

Reimplemented from acdk::io::Reader.

virtual bool acdk::io::RandomAccessFile::readBoolean  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual char acdk::io::RandomAccessFile::readChar  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual double acdk::io::RandomAccessFile::readDouble  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual float acdk::io::RandomAccessFile::readFloat  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual int acdk::io::RandomAccessFile::readInt  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual jlong acdk::io::RandomAccessFile::readLong  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual short acdk::io::RandomAccessFile::readShort  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual RString acdk::io::RandomAccessFile::readString  )  [virtual]
 

JDK implements readUTF instead of readString.

The string will be terminated by '' and isn't UTF conform.

Implements acdk::io::DataReader.

virtual uc2char acdk::io::RandomAccessFile::readUcChar  )  [virtual]
 

implemented DataReader

Implements acdk::io::DataReader.

virtual RString acdk::io::RandomAccessFile::readUTF  )  [virtual]
 

Not yet implemented (use readString instead).

virtual bool acdk::io::RandomAccessFile::ready  )  [virtual]
 

Returns:
true, if at least 1 byte can be readed from stream

Reimplemented from acdk::io::Reader.

virtual void acdk::io::RandomAccessFile::reset  )  [virtual]
 

if mark is set, set stream to mark point otherwise to begin of this stream.

Implements acdk::io::DataReader.

virtual void acdk::io::RandomAccessFile::seek jlong  pos  )  [virtual]
 

virtual jlong acdk::io::RandomAccessFile::seek SeekPos  seekrel,
jlong  seekpos
[virtual]
 

Set stream position in this Reader to given position.

Returns:
the absolute position in this stream

Implements acdk::io::DataReader.

virtual void acdk::io::RandomAccessFile::setIn IN(RReader reader  )  [virtual]
 

Implements acdk::io::DataReader.

virtual void acdk::io::RandomAccessFile::setLength jlong  newLength  )  [virtual]
 

Note: on Non-Unix it may not work correctly, if newLength < currentLenght.

virtual void acdk::io::RandomAccessFile::setOut IN(RWriter writer  )  [virtual]
 

Implements acdk::io::DataWriter.

virtual jlong acdk::io::RandomAccessFile::skip jlong  n  )  [inline, virtual]
 

Move forwart into the stream.

Returns:
how many bytes skipped. May less then input, in case EOS is reached

Implements acdk::io::DataReader.

virtual int acdk::io::RandomAccessFile::skipBytes int  n  )  [virtual]
 

virtual void acdk::io::RandomAccessFile::write IN(RbyteArray ch,
int  offset = 0,
int  len = -1
[virtual]
 

writes to the unterlying data stream

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::write byte  b  )  [virtual]
 

default implementation: byte cbuf[2]; cbuf[1] = 0; cbuf[0] = c; return write((const byte*)cbuf, 0, 1);

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::write const byte cstr,
int  offset,
int  len
[virtual]
 

Reimplemented from acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeBoolean bool  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeChar char  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeDouble double  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeFloat float  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeInt int  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeLong jlong  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeShort short  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeString IN(RString str  )  [virtual]
 

Writes the given string.

JDK implements readUTF instead of readString. The string will be terminated by '' and isn't UTF conform.

Parameters:
str String to write.

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeUcChar uc2char  b  )  [virtual]
 

implemented DataWriter

Implements acdk::io::DataWriter.

virtual void acdk::io::RandomAccessFile::writeUTF IN(RString str  )  [virtual]
 

Not yet implemented (Use writeString instead).


Member Data Documentation

RDataReader acdk::io::RandomAccessFile::_dataReader [private]
 

RDataWriter acdk::io::RandomAccessFile::_dataWriter [private]
 

RFile acdk::io::RandomAccessFile::_file [private]
 

FileReaderWriterImpl acdk::io::RandomAccessFile::_inOut [private]
 

 
Last modified 2005-05-08 18:32 by SYSTEM By Artefaktur, Ing. Bureau Kommer