public class FileRandomIO extends java.lang.Object implements DataSink, DataSource
Session.STREAM
transfer mode, only with GridFTPSession.EBLOCK
mode.Modifier and Type | Field and Description |
---|---|
protected int |
bufferSize |
static int |
DEFAULT_BUFFER_SIZE |
protected java.io.RandomAccessFile |
file |
protected long |
offset |
Constructor and Description |
---|
FileRandomIO(java.io.RandomAccessFile file)
Behave like FileRandomIO(file, DEFAULT_BUFFER_SIZE)
|
FileRandomIO(java.io.RandomAccessFile file,
int bufferSize) |
public static final int DEFAULT_BUFFER_SIZE
protected int bufferSize
protected java.io.RandomAccessFile file
protected long offset
public FileRandomIO(java.io.RandomAccessFile file)
file
- local file that will be be used as data source or
destinationpublic FileRandomIO(java.io.RandomAccessFile file, int bufferSize)
file
- local file that will be be used as data source or
destinationbufferSize
- size of the buffer returned during single
read operationpublic void write(Buffer buffer) throws java.io.IOException
DataSink
buffer.getOffset()
might
return -1 if the transfer mode used does not support
data offsets, for example stream transfer mode.public Buffer read() throws java.io.IOException
read
in interface DataSource
java.io.IOException
- if an I/O error occurs.public void close() throws java.io.IOException
close
in interface DataSink
close
in interface DataSource
java.io.IOException
- if an I/O error occurs.public long totalSize() throws java.io.IOException
DataSource
totalSize
in interface DataSource
java.io.IOException
- if an I/O exception occursCopyright © 2013. All Rights Reserved.