|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.FileTransfer
public class FileTransfer
A simple class that abstracts FileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel)
for use with Grizzly 2.0 AsyncQueueWriter.
| Constructor Summary | |
|---|---|
FileTransfer(java.io.File f)
Constructs a new FileTransfer instance backed by the specified
File. |
|
FileTransfer(java.io.File f,
long pos,
long len)
Constructs a new FileTransfer instance backed by the specified
File. |
|
| Method Summary | |
|---|---|
boolean |
hasRemaining()
Return true if this message has data remaining to be
written. |
boolean |
isExternal()
Returns true if the message represents an external resource (for example FileTransfer),
which is not loaded in memory. |
boolean |
release()
Perform message specific actions to release resources held by the entity backing this WritableMessage. |
int |
remaining()
Return the number of bytes remaining to be written. |
long |
writeTo(java.nio.channels.WritableByteChannel c)
Transfers the File backing this FileTransfer to the specified
WritableByteChannel. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileTransfer(java.io.File f)
FileTransfer instance backed by the specified
File. This simply calls this(f, 0, f.length).
f - the File to transfer.
java.lang.NullPointerException - if f is null.FileTransfer(java.io.File, long, long)
public FileTransfer(java.io.File f,
long pos,
long len)
FileTransfer instance backed by the specified
File. The content to transfer will begin at the specified offset,
pos with the total transfer length being specified by
len.
f - the File to transfer.pos - the offset within the File to start the transfer.len - the total number of bytes to transfer.
java.lang.IllegalArgumentException - if f is null, does not exist, is
not readable, or is a directory.
java.lang.IllegalArgumentException - if pos or len
are negative.
java.lang.IllegalArgumentException - if len exceeds the number of bytes that
may be transferred based on the provided offset and file length.| Method Detail |
|---|
public long writeTo(java.nio.channels.WritableByteChannel c)
throws java.io.IOException
FileTransfer to the specified
WritableByteChannel.
c - the WritableByteChannel
java.io.IOExceptionpublic boolean hasRemaining()
true if this message has data remaining to be
written.
hasRemaining in interface WritableMessagetrue if this message has data remaining to
be written.public int remaining()
remaining in interface WritableMessagepublic boolean release()
WritableMessage.
release in interface WritableMessagepublic boolean isExternal()
FileTransfer),
which is not loaded in memory.
False, if the message is
located in memory (like Buffer).
isExternal in interface WritableMessage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||