Legal Notice, Privacy Policy

Impressum, Datenschutzerklärung

Cerberus X Documentation

Class FileInputStream

A FileInputStream allows you to read data from a file in a sequential manner. More...

Declarations

Extends
Stream Streams are used to read or write data in a sequential manner.
Functions
Open : FileInputStream ( path:String ) Opens a new FileInputStream.
Inherited Properties
Eof : Int () Returns 1 if end-of-file has been reached, -1 if an IO error has occurred or 0 if the stream can be read.
Length : Int () Returns the stream length if the stream is seekable, else 0.
Position : Int () Returns the read/write position within the stream if the stream is seekable, else 0.
Inherited Methods
Close : Void () Closes the stream and released any OS resources in use.
Read : Int ( buffer:DataBuffer, offset:Int, count:Int ) Reads count bytes from the stream into databuffer, starting at address offset within the databuffer.
ReadAll : DataBuffer () Reads all remaining bytes from the stream into a databuffer.
ReadAll : Void ( buffer:DataBuffer, offset:Int, count:Int ) Reads count bytes from the stream into databuffer, starting at address offset within the databuffer.
ReadByte : Int () Reads an 8 bit byte from the stream.
ReadFloat : Float () Reads a 32 bit float value from the stream.
ReadInt : Int () Reads a 32 bit int value from the stream.
ReadShort : Int () Reads a 16 bit int value from the stream.
ReadString : String ( count:Int, encoding:String="utf8" ) Reads count bytes from the stream and converts them to a string using the given encoding.
ReadString : String ( encoding:String="utf8" ) Reads all bytes from the stream until end-of-file and converts them to a string using the given encoding.
Seek : Int ( position:Int ) If the stream is seekable, adjusts the read/write position within the stream and returns the new read/write position.
Write : Int ( buffer:DataBuffer, offset:Int, count:Int ) Writes count bytes from databuffer to the stream, starting at address offset within the databuffer.
WriteAll : Void ( buffer:DataBuffer, offset:Int, count:Int ) Writes count bytes from databuffer to the stream, starting at address offset within the databuffer.
WriteByte : Void ( value:Int ) Writes an 8 bit byte to the stream.
WriteFloat : Void ( value:Float ) Writes a 32 bit float value to the stream.
WriteInt : Void ( value:Int ) Writes a 32 bit int value to the stream.
WriteShort : Void ( value:Int ) Write a 16 bit int value to the stream.
WriteString : Void ( value:String, encoding:String="utf8" ) Writes a string to the stream using the given encoding.

Detailed Discussion

A FileInputStream allows you to read data from a file in a sequential manner. Seek() is not supported.

This Class is only implemented for Desktop and Android for now. Its purpose is to be able to open files from the data folder as a stream, which is only possible with FileInputStream as those files are compressed in the App package on Android.


Functions Documentation