Constructor
new JsLocalStorageFileStream(file, mode)
Construct a file stream from an JsLocalStorageFile.
This will create a wrapper stream that will route read() and write() to the FileChannel
Parameters:
Name | Type | Description |
---|---|---|
file |
The JsLocalStorageFile that will be used to get the read/write stream | |
mode |
The mode "r" for read "rw" for write |
Classes
Methods
(async) canRead()
True if stream can read from file.
Returns:
(async) canSeek()
True if stream can seek.
Returns:
(async) canWrite()
True if stream can write to file.
Returns:
(async) close()
Close this stream and associated resources.
Throws:
IOException Thrown if there is an IO error.
(async) flush()
Flush the buffers to the associated file.
(async) getPosition()
Get the current position of the stream.
Throws:
IOException Thrown if there is an IO error.
Returns:
(async) length()
Get the length of the stream. This is the same as the backed file.
Returns:
(async) read(buffer, offset, count)
Read data from the file stream into the buffer provided.
Parameters:
Name | Type | Description |
---|---|---|
buffer |
The buffer to write the data. | |
offset |
The offset of the buffer to start writing the data. | |
count |
The maximum number of bytes to read from. |
Throws:
IOException Thrown if there is an IO error.
Returns:
(async) seek(offset, origin)
Seek to the offset provided.
Parameters:
Name | Type | Description |
---|---|---|
offset |
The position to seek to. | |
origin |
The type of origin RandomAccessStream.SeekOrigin |
Throws:
IOException Thrown if there is an IO error.
Returns:
The new position after seeking.
(async) setLength(value)
Set the length of the stream. This is applicable for write streams only.
Parameters:
Name | Type | Description |
---|---|---|
value |
The new length. |
Throws:
IOException Thrown if there is an IO error.
(async) setPosition(value)
Set the current position of the stream.
Parameters:
Name | Type | Description |
---|---|---|
value |
The new position. |
Throws:
IOException Thrown if there is an IO error.
(async) write(buffer, offset, count)
Write the data from the buffer provided into the stream.
Parameters:
Name | Type | Description |
---|---|---|
buffer |
The buffer to read the data from. | |
offset |
The offset of the buffer to start reading the data. | |
count |
The maximum number of bytes to read from the buffer. |
Throws:
IOException Thrown if there is an IO error.