protected static class FileBodyGenerator.FileBody extends Object implements RandomAccessBody
| Constructor and Description |
|---|
FileBodyGenerator.FileBody(File file) |
FileBodyGenerator.FileBody(File file,
long regionSeek,
long regionLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases any resources associated with this body.
|
long |
getContentLength()
Gets the length of the body.
|
long |
read(ByteBuffer buffer)
Reads the next chunk of bytes from the body.
|
long |
transferTo(long position,
long count,
WritableByteChannel target)
Transfers the specified chunk of bytes from this body to the specified channel.
|
public FileBodyGenerator.FileBody(File file) throws IOException
IOExceptionpublic FileBodyGenerator.FileBody(File file, long regionSeek, long regionLength) throws IOException
IOExceptionpublic long getContentLength()
BodygetContentLength in interface Bodypublic long read(ByteBuffer buffer) throws IOException
Bodyread in interface Bodybuffer - The buffer to store the chunk in, must not be null.-1 if the body has been read completely.IOException - If the chunk could not be read.public long transferTo(long position,
long count,
WritableByteChannel target)
throws IOException
RandomAccessBodytransferTo in interface RandomAccessBodyposition - The zero-based byte index from which to start the transfer, must not be negative.count - The maximum number of bytes to transfer, must not be negative.target - The destination channel to transfer the body chunk to, must not be null.IOException - If the body chunk could not be transferred.public void close()
throws IOException
Bodyclose in interface BodyIOExceptionCopyright © 2015. All rights reserved.