fm.liveswitch.FileStream Class Reference

Public Member Functions

String getPath ()
 Gets the path. More...
 
 FileStream (String path)
 Initializes a new instance of the File class. More...
 
long getLength ()
 Gets the file length (must be opened first). More...
 
long getPosition ()
 Gets the position in the file. More...
 
void setPosition (long position)
 Sets the position in the file. More...
 
boolean exists ()
 Returns a boolean value indicating whether the file exists. More...
 
void open (FileStreamAccess access)
 Opens the file. More...
 
void close ()
 Closes the file. More...
 
boolean flush ()
 Flushes the file contents. More...
 
boolean write (byte[] data, int index, int length)
 Writes data to the file. More...
 
boolean writeTo (int location, byte[] data, int index, int length)
 Writes data to the file. More...
 
int read (byte[] data, int index, int length)
 Reads data from the file. More...
 
- Public Member Functions inherited from fm.liveswitch.IFileStream
abstract void open (fm.liveswitch.FileStreamAccess access)
 Opens the file stream. More...
 

Constructor & Destructor Documentation

◆ FileStream()

fm.liveswitch.FileStream.FileStream ( String  path)

Initializes a new instance of the File class.

Parameters
pathThe path.

Member Function Documentation

◆ close()

void fm.liveswitch.FileStream.close ( )

Closes the file.

Implements fm.liveswitch.IFileStream.

◆ exists()

boolean fm.liveswitch.FileStream.exists ( )

Returns a boolean value indicating whether the file exists.

Returns

Implements fm.liveswitch.IFileStream.

◆ flush()

boolean fm.liveswitch.FileStream.flush ( )

Flushes the file contents.

Implements fm.liveswitch.IFileStream.

◆ getLength()

long fm.liveswitch.FileStream.getLength ( )

Gets the file length (must be opened first).

Implements fm.liveswitch.IFileStream.

◆ getPath()

String fm.liveswitch.FileStream.getPath ( )

Gets the path.

Implements fm.liveswitch.IFileStream.

◆ getPosition()

long fm.liveswitch.FileStream.getPosition ( )

Gets the position in the file.

Implements fm.liveswitch.IFileStream.

◆ open()

void fm.liveswitch.FileStream.open ( FileStreamAccess  access)

Opens the file.

Parameters
accessThe access requirement.

◆ read()

int fm.liveswitch.FileStream.read ( byte[]  data,
int  index,
int  length 
)

Reads data from the file.

Parameters
dataThe buffer to fill with data from the file.
indexThe index at which to start writing.
lengthThe maximum number of bytes to read.
Returns
The number of bytes read from the file.

Implements fm.liveswitch.IFileStream.

◆ setPosition()

void fm.liveswitch.FileStream.setPosition ( long  position)

Sets the position in the file.

Implements fm.liveswitch.IFileStream.

◆ write()

boolean fm.liveswitch.FileStream.write ( byte[]  data,
int  index,
int  length 
)

Writes data to the file.

Parameters
dataThe data to write to the file.
indexThe index at which to start reading.
lengthThe number of bytes to write.
Returns
true if the data was written; otherwise, false.

Implements fm.liveswitch.IFileStream.

◆ writeTo()

boolean fm.liveswitch.FileStream.writeTo ( int  location,
byte[]  data,
int  index,
int  length 
)

Writes data to the file.

Parameters
locationThe location to write to.
dataThe data to write to the file.
indexThe index at which to start reading.
lengthThe number of bytes to write.
Returns
true if the data was written; otherwise, false.

Implements fm.liveswitch.IFileStream.