|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.httpio.FileResourceSource
public class FileResourceSource
A resource that comes from a file.
Field Summary | |
---|---|
protected BufferHandle |
bufHandle
|
protected FileChannel |
fc
|
Constructor Summary | |
---|---|
FileResourceSource(File f,
NioHandler nioHandler,
BufferHandler bufHandler)
Create a new FileResourceSource using the given filename |
|
FileResourceSource(String filename,
NioHandler nioHandler,
BufferHandler bufHandler)
Create a new FileResourceSource using the given filename |
Method Summary | |
---|---|
void |
addBlockListener(BlockListener listener)
Generally we do not come into this method, but it can happen.. |
long |
length()
Get the length of the resource in bytes. |
void |
release()
Release any held resources. |
boolean |
supportsTransfer()
FileChannels can be used, will always return true. |
long |
transferTo(long position,
long count,
WritableByteChannel target)
Transfers bytes from this channel's file to the given writable byte channel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FileChannel fc
protected BufferHandle bufHandle
Constructor Detail |
---|
public FileResourceSource(String filename, NioHandler nioHandler, BufferHandler bufHandler) throws IOException
filename
- the file for this resourcenioHandler
- the NioHandler to use for background tasksbufHandler
- the BufferHandler to use when reading and writing
IOException
- if the file is a valid filepublic FileResourceSource(File f, NioHandler nioHandler, BufferHandler bufHandler) throws IOException
f
- the resourcenioHandler
- the NioHandler to use for background tasksbufHandler
- the BufferHandler to use when reading and writing
IOException
- if the file is a valid fileMethod Detail |
---|
public boolean supportsTransfer()
supportsTransfer
in interface ResourceSource
public long length()
Transferable
length
in interface Transferable
public long transferTo(long position, long count, WritableByteChannel target) throws IOException
Transferable
transferTo
in interface Transferable
position
- The position within the file at which the transfer
is to begin; must be non-negativecount
- The maximum number of bytes to be transferred;
must be non-negativetarget
- The target channel
IOException
- if data transfer failstransferTo
public void addBlockListener(BlockListener listener)
addBlockListener
in interface ResourceSource
listener
- the listener that will get notified when data is availablepublic void release()
ResourceSource
release
in interface ResourceSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |