| Modifier and Type | Class | Description |
|---|---|---|
static class |
FileStream.Mode |
The file access mode.
|
| Constructor | Description |
|---|---|
FileStream(java.io.File file,
FileStream.Mode mode) |
Create a new file stream from a file.
|
FileStream(java.io.RandomAccessFile raFile) |
Create a new file stream from a
RandomAccessFile. |
FileStream(java.lang.String filename,
FileStream.Mode mode) |
Create a new file stream from a file name.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Close the file stream.
|
void |
copy(Stream stream) |
Copy the content from another stream.
|
long |
getLength() |
Get the length of the stream in bytes.
|
java.io.RandomAccessFile |
GetRandomAccessFile() |
Get the underlying
RandomAccessFile. |
int |
read(byte[] buffer,
int offset,
int length) |
Read from the stream.
|
boolean |
seek(long position) |
Set byte position.
|
void |
setLength(long length) |
Set the length of the stream in bytes.
|
long |
tell() |
Get current byte position.
|
void |
write(byte[] buffer,
int offset,
int length) |
Write to the stream.
|
public FileStream(java.io.File file,
FileStream.Mode mode)
throws java.io.IOException
java.io.RandomAccessFile.file - The file to be openedmode - The open mode of the filejava.io.IOExceptionRandomAccessFile(java.io.File, String)public FileStream(java.lang.String filename,
FileStream.Mode mode)
throws java.io.IOException
java.io.RandomAccessFile.filename - The name of the file to be openedmode - The open mode of the filejava.io.IOExceptionRandomAccessFile(java.io.File, String)public FileStream(java.io.RandomAccessFile raFile)
RandomAccessFile.
ATTENTION: Opening a RandomAccessFile in "rw" mode does not delete the current content of the file,
so be sure that you delete it yourself if needed (which is mostly the case).raFile - The underlying RandomAccessFileRandomAccessFilepublic java.io.RandomAccessFile GetRandomAccessFile()
RandomAccessFile.RandomAccessFilepublic long getLength()
throws java.io.IOException
public void setLength(long length)
throws java.io.IOException
length - the length of the stream in bytesjava.io.IOExceptionpublic boolean seek(long position)
throws java.io.IOException
public long tell()
throws java.io.IOException
public int read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
public void write(byte[] buffer,
int offset,
int length)
throws java.io.IOException
public void copy(Stream stream) throws java.io.IOException
stream - The stream from which the content is copiedjava.io.IOException