Constructor and Description |
---|
FileStream(java.io.File file,
java.lang.String mode)
Create a new file stream from a file
This constructor works exactly like the same constructor of the underlying java.io.RandomAccessFile
ATTENTION: Opening the file 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).
|
FileStream(java.io.RandomAccessFile raFile)
Create a new file stream from a 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).
|
FileStream(java.lang.String filename,
java.lang.String mode)
Create a new file stream from a filename
This constructor works exactly like the same constructor of the underlying java.io.RandomAccessFile
ATTENTION: Opening the file 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).
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file stream
This closes also the underlying RandomAccessFile
|
void |
copy(Stream stream)
Copy the content of 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, java.lang.String mode) throws java.io.FileNotFoundException
file
- The file to be openedmode
- The open mode of the filejava.io.FileNotFoundException
RandomAccessFile.RandomAccessFile(java.io.File, String)
public FileStream(java.lang.String filename, java.lang.String mode) throws java.io.FileNotFoundException
filename
- The filename of the file to be openedmode
- The open mode of the filejava.io.FileNotFoundException
RandomAccessFile.RandomAccessFile(String, String)
public FileStream(java.io.RandomAccessFile raFile)
raFile
- The underlying RandomAccessFileRandomAccessFile
public java.io.RandomAccessFile GetRandomAccessFile()
public long getLength() throws java.io.IOException
public void setLength(long length) throws java.io.IOException
length
- the length of the stream in bytesjava.io.IOException
public 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 of which the content is copiedjava.io.IOException