public class PathContentProvider extends AbstractTypedContentProvider
A ContentProvider for files using JDK 7's java.nio.file APIs.
It is possible to specify, at the constructor, a buffer size used to read
content from the stream, by default 4096 bytes.
If a ByteBufferPool is provided via setByteBufferPool(ByteBufferPool),
the buffer will be allocated from that pool, otherwise one buffer will be
allocated and used to read the file.
ContentProvider.Typed| Constructor and Description |
|---|
PathContentProvider(Path filePath) |
PathContentProvider(Path filePath,
int bufferSize) |
PathContentProvider(String contentType,
Path filePath) |
PathContentProvider(String contentType,
Path filePath,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
ByteBufferPool |
getByteBufferPool() |
long |
getLength() |
boolean |
isReproducible()
Whether this ContentProvider can produce exactly the same content more
than once.
|
Iterator<ByteBuffer> |
iterator() |
void |
setByteBufferPool(ByteBufferPool byteBufferPool) |
getContentTypeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic PathContentProvider(Path filePath) throws IOException
IOExceptionpublic PathContentProvider(Path filePath, int bufferSize) throws IOException
IOExceptionpublic PathContentProvider(String contentType, Path filePath) throws IOException
IOExceptionpublic PathContentProvider(String contentType, Path filePath, int bufferSize) throws IOException
IOExceptionpublic long getLength()
public boolean isReproducible()
ContentProviderWhether this ContentProvider can produce exactly the same content more than once.
Implementations should return true only if the content can be
produced more than once, which means that invocations to Iterable.iterator()
must return a new, independent, iterator instance over the content.
The HttpClient implementation may use this method in particular
cases where it detects that it is safe to retry a request that failed.
public ByteBufferPool getByteBufferPool()
public void setByteBufferPool(ByteBufferPool byteBufferPool)
public Iterator<ByteBuffer> iterator()
Copyright © 2010 - 2020 Adobe. All Rights Reserved