Package | at.fhjoanneum.dmt.umj.core.util.core |
Class | public class FileStreamWithLineReader |
Inheritance | FileStreamWithLineReader flash.filesystem.FileStream |
Since : | 17 Dec 2010 |
flash.filesystem.FileStream
object that supports
reading lines from the inherent file stream. The objects uses an internal buffer so
as not to hit the performance. The default buffer size is 512 bytes.
The object supports only standard methods of the underlying FileStream
object.
Usage of the class is only recommended when one tends to read the data line by line
from a file stream. If the readUTFLine()
or readMultiByteLine()
methods are not intended to be called, it will be preferable to use the FileStream
object, for performance reasons only.
Property | Defined By | ||
---|---|---|---|
bytesAvailable : uint [override] [read-only]
Returns the number of bytes of data available for reading in the input buffer. | FileStreamWithLineReader | ||
position : Number [override]
The current position in the buffer/file where the next read will happen. | FileStreamWithLineReader |
Property | Defined By | ||
---|---|---|---|
bytesToRead : uint [read-only]
Method that returns the number of bytes that can be read in the next read
over the actual file stream. | FileStreamWithLineReader | ||
hasBuffer : Boolean [read-only]
Utility method to see if check if we have data in our internal buffer. | FileStreamWithLineReader |
Method | Defined By | ||
---|---|---|---|
Constructor
| FileStreamWithLineReader | ||
readBoolean():Boolean [override]
Overriden parent class functions to support buffering
| FileStreamWithLineReader | ||
readByte():int [override] | FileStreamWithLineReader | ||
readBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void [override] | FileStreamWithLineReader | ||
readDouble():Number [override] | FileStreamWithLineReader | ||
readFloat():Number [override] | FileStreamWithLineReader | ||
readInt():int [override] | FileStreamWithLineReader | ||
readLine(charSet:String):String
Method that actually attempts to read a line from the inherent file stream using internal buffers
in the given encoding. | FileStreamWithLineReader | ||
readMultiByteLine(charSet:String):String
Reads a line in the specified encoding from the inherent file stream. | FileStreamWithLineReader | ||
readObject():* [override] | FileStreamWithLineReader | ||
readShort():int [override] | FileStreamWithLineReader | ||
readUnsignedByte():uint [override] | FileStreamWithLineReader | ||
readUnsignedInt():uint [override] | FileStreamWithLineReader | ||
readUnsignedShort():uint [override] | FileStreamWithLineReader | ||
readUTF():String [override] | FileStreamWithLineReader | ||
readUTFBytes(length:uint):String [override] | FileStreamWithLineReader | ||
readUTFLine():String
Reads a UTF-8 encoded line from the inherent file stream. | FileStreamWithLineReader | ||
setBufferSize(value:uint):void
Set the buffer size to the given value. | FileStreamWithLineReader |
Method | Defined By | ||
---|---|---|---|
refillBuffer():void
Method to refill the buffer again with data from the file stream. | FileStreamWithLineReader | ||
undoBuffer():void
Method to clean up the current buffer and move back in the original stream by the
extra bytes that were buffered in. | FileStreamWithLineReader |
bytesAvailable | property |
bytesAvailable:uint
[read-only] [override] Returns the number of bytes of data available for reading in the input buffer.
public function get bytesAvailable():uint
bytesToRead | property |
bytesToRead:uint
[read-only] Method that returns the number of bytes that can be read in the next read over the actual file stream. The value is the lesser amongst the buffer size and the actual number of bytes available in the file stream.
protected function get bytesToRead():uint
hasBuffer | property |
hasBuffer:Boolean
[read-only] Utility method to see if check if we have data in our internal buffer.
protected function get hasBuffer():Boolean
position | property |
position:Number
[override] The current position in the buffer/file where the next read will happen.
public function get position():Number
public function set position(value:Number):void
FileStreamWithLineReader | () | Constructor |
public function FileStreamWithLineReader()
Constructor
readBoolean | () | method |
override public function readBoolean():Boolean
Overriden parent class functions to support buffering
ReturnsBoolean |
readByte | () | method |
override public function readByte():int
Returnsint |
readBytes | () | method |
override public function readBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void
Parameters
bytes:ByteArray | |
offset:uint (default = 0 )
| |
length:uint (default = 0 )
|
readDouble | () | method |
override public function readDouble():Number
ReturnsNumber |
readFloat | () | method |
override public function readFloat():Number
ReturnsNumber |
readInt | () | method |
override public function readInt():int
Returnsint |
readLine | () | method |
public function readLine(charSet:String):String
Method that actually attempts to read a line from the inherent file stream using internal buffers in the given encoding. If no line termination character is found, the entire stream from the current position to the end-of-file is returned back.
Parameters
charSet:String |
String |
readMultiByteLine | () | method |
public function readMultiByteLine(charSet:String):String
Reads a line in the specified encoding from the inherent file stream. The presence of
a line termination character '\n
' indicates the end-of-line.
Parameters
charSet:String |
String |
readObject | () | method |
override public function readObject():*
Returns* |
readShort | () | method |
override public function readShort():int
Returnsint |
readUnsignedByte | () | method |
override public function readUnsignedByte():uint
Returnsuint |
readUnsignedInt | () | method |
override public function readUnsignedInt():uint
Returnsuint |
readUnsignedShort | () | method |
override public function readUnsignedShort():uint
Returnsuint |
readUTF | () | method |
override public function readUTF():String
ReturnsString |
readUTFBytes | () | method |
override public function readUTFBytes(length:uint):String
Parameters
length:uint |
String |
readUTFLine | () | method |
public function readUTFLine():String
Reads a UTF-8
encoded line from the inherent file stream. The presence of
a line termination character '\n
' indicates the end-of-line.
String |
refillBuffer | () | method |
protected function refillBuffer():void
Method to refill the buffer again with data from the file stream. The buffer is
either filled with the number of bytes as returned by the bytesToRead()
method.
setBufferSize | () | method |
public function setBufferSize(value:uint):void
Set the buffer size to the given value. A value of ZERO
will reset the buffer size
to a default value of 512 bytes.
Parameters
value:uint |
undoBuffer | () | method |
protected function undoBuffer():void
Method to clean up the current buffer and move back in the original stream by the extra bytes that were buffered in.