| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | Returns: the bytes of this resource, as a read-only byte bufferReturns the bytes of this resource, as a read-only byte buffer. |
| public String | |
| public List | Returns: the list of code signers for this resourceReturns the list of code signers for this resource. |
| public long | |
| public long | Returns: the number of bytes copiedthe destination stream (must not be destination)null)Copy the bytes of this resource to the given destination. |
| public long | Returns: the number of bytes copiedthe destination channel (must not be channel)null and must not be non-blocking)Copy the bytes of this resource to the given destination. |
| public boolean | Returns: true if this resource represents a directory, or false otherwiseReturns true if this resource represents a directory, or false otherwise. |
| public Instant | Returns: the modification time of the resource, ornull if the time is unknownReturns the modification time of the resource, or |
| public DirectoryStream | Returns: the directory stream (notnull)Open a directory stream to read the contents of this directory. |
| public abstract InputStream | |
| public final String | |
| public < the type of the function result R> R | Returns: the result of the action functionan action to perform (must not be function)null)Perform the given action on the input stream of this resource. |
| public abstract long | Returns: the size of the resource, or-1 if the size is not knownReturns the size of the resource, or |
| public abstract URL |
| path | back to summary |
|---|---|
| private final String path | |
| Resource | back to summary |
|---|---|
| protected Resource(final String path) Construct a new instance.
| |
| asBuffer | back to summary |
|---|---|
| public ByteBuffer asBuffer() throws IOException Returns the bytes of this resource, as a read-only byte buffer.
The buffer is suitable for passing to Implementation Specification Implementers must ensure that the returned buffer is read-only.
| |
| asString | back to summary |
|---|---|
| public String asString(Charset charset) throws IOException Returns the resource content as a string.
| |
| codeSigners | back to summary |
|---|---|
| public List Returns the list of code signers for this resource. The resource must have been fully read, or else consumed as a buffer. By default, the base implementation returns an empty list.
| |
| copyTo | back to summary |
|---|---|
| public long copyTo(Path destination) throws IOException Copy the bytes of this resource to the given destination. The copy may fail before all of the bytes have been transferred; in this case the content and state of the destination are undefined. The path is opened as if with the following options:
| |
| copyTo | back to summary |
|---|---|
| public long copyTo(OutputStream destination) throws IOException Copy the bytes of this resource to the given destination. The copy may fail before all of the bytes have been transferred; in this case the content and state of the destination are undefined. The destination stream is not closed.
| |
| copyTo | back to summary |
|---|---|
| public long copyTo(WritableByteChannel channel) throws IOException Copy the bytes of this resource to the given destination. The copy may fail before all of the bytes have been transferred; in this case the content and state of the destination are undefined. The destination channel is not closed.
| |
| isDirectory | back to summary |
|---|---|
| public boolean isDirectory() Returns true if this resource represents a directory, or false otherwise. Not every resource implementation supports directory access.
| |
| modifiedTime | back to summary |
|---|---|
| public Instant modifiedTime() Returns the modification time of the resource, or
| |
| openDirectoryStream | back to summary |
|---|---|
| public DirectoryStream Open a directory stream to read the contents of this directory. Not every resource implementation supports directory access.
| |
| openStream | back to summary |
|---|---|
| public abstract InputStream openStream() throws IOException Open an input stream to read this resource.
| |
| pathName | back to summary |
|---|---|
| public final String pathName() Returns the resource's relative path.
The returned path is relative (that is, it does not start with
| |
| readStream | back to summary |
|---|---|
| public <R> R readStream(Function<InputStream, R> function) throws IOException Perform the given action on the input stream of this resource.
| |
| size | back to summary |
|---|---|
| public abstract long size() Returns the size of the resource, or
| |
| url | back to summary |
|---|---|
| public abstract URL url() Returns the resource URL (not
| |