|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.globus.ftp.FileRandomIO
Thread safe reference implementation of DataSink and DataSource.
Implements reading and writing data to a local file.
Note: Does not work with Session.STREAM
transfer mode, only with GridFTPSession.EBLOCK
mode.
Field Summary | |
protected int |
bufferSize
|
static int |
DEFAULT_BUFFER_SIZE
|
protected RandomAccessFile |
file
|
protected long |
offset
|
Constructor Summary | |
FileRandomIO(RandomAccessFile file)
Behave like FileRandomIO(file, DEFAULT_BUFFER_SIZE) |
|
FileRandomIO(RandomAccessFile file,
int bufferSize)
|
Method Summary | |
void |
close()
Closes the underlying file |
Buffer |
read()
In this implementation, each read() returns data sequentially. |
long |
totalSize()
Optional operation. |
void |
write(Buffer buffer)
Writes the specified buffer to this data sink. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_BUFFER_SIZE
protected int bufferSize
protected RandomAccessFile file
protected long offset
Constructor Detail |
public FileRandomIO(RandomAccessFile file)
file
- local file that will be be used as data source or
destinationpublic FileRandomIO(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 operationMethod Detail |
public void write(Buffer buffer) throws IOException
DataSink
buffer.getOffset()
might
return -1 if the transfer mode used does not support
data offsets, for example stream transfer mode.
write
in interface DataSink
buffer
- the data buffer to write.
IOException
- if an I/O error occurs.public Buffer read() throws IOException
read
in interface DataSource
IOException
- if an I/O error occurs.public void close() throws IOException
close
in interface DataSink
IOException
- if an I/O error occurs.public long totalSize() throws IOException
DataSource
totalSize
in interface DataSource
IOException
- if an I/O exception occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |