| Modifier and Type | Field and Description |
|---|---|
| private final ByteBuffer | |
| private final Instant | |
| private URL |
| Access | Constructor and Description |
|---|---|
| public | MemoryResource(final String
the resource path name (must not be pathName, final ByteBuffer null)the byte buffer containing the resource data (must not be data)null)Construct a new instance. |
| public | MemoryResource(final String
the resource path name (must not be pathName, final byte[] null)the byte array (must not be data)null)Construct a new instance for a byte array. |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | asBuffer()
Overrides io. Returns the bytes of this resource, as a read-only byte buffer. |
| public long | copyTo(final Path
the destination path (must not be destination)null)Overrides io. Copy the bytes of this resource to the given destination. |
| public long | copyTo(final WritableByteChannel
the destination channel (must not be channel)null and must not be non-blocking)Overrides io. Copy the bytes of this resource to the given destination. |
| public long | copyTo(final OutputStream
the destination stream (must not be destination)null)Overrides io. Copy the bytes of this resource to the given destination. |
| public Instant | modifiedTime()
Overrides io. Returns the modification time of the resource, or |
| public MemoryInputStream | openStream()
Implements abstract io. Open an input stream to read this resource. |
| public long | size()
Implements abstract io. Returns the size of the resource, or |
| public URL | url()
Implements abstract io. Returns the resource URL (not |
| data | back to summary |
|---|---|
| private final ByteBuffer data | |
| modifiedTime | back to summary |
|---|---|
| private final Instant modifiedTime | |
| url | back to summary |
|---|---|
| private URL url | |
| MemoryResource | back to summary |
|---|---|
| public MemoryResource(final String pathName, final ByteBuffer data) Construct a new instance. The given buffer contents are not copied. Accessing the resource will not affect the buffer's position or limit. Modifying the buffer's position or limit will not affect the contents of the resource.
| |
| MemoryResource | back to summary |
|---|---|
| public MemoryResource(final String pathName, final byte[] data) Construct a new instance for a byte array. The byte array is not copied.
| |
| asBuffer | back to summary |
|---|---|
| public ByteBuffer asBuffer() Overrides io. Doc from io. Returns the bytes of this resource, as a read-only byte buffer.
The buffer is suitable for passing to
| |
| copyTo | back to summary |
|---|---|
| public long copyTo(final Path destination) throws IOException Overrides io. Doc from io. 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(final WritableByteChannel channel) throws IOException Overrides io. Doc from io. 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.
| |
| copyTo | back to summary |
|---|---|
| public long copyTo(final OutputStream destination) throws IOException Overrides io. Doc from io. 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.
| |
| modifiedTime | back to summary |
|---|---|
| public Instant modifiedTime() Overrides io. Doc from io. Returns the modification time of the resource, or
| |
| openStream | back to summary |
|---|---|
| public MemoryInputStream openStream() Implements abstract io. Doc from io. Open an input stream to read this resource.
| |
| size | back to summary |
|---|---|
| public long size() Implements abstract io. Doc from io. Returns the size of the resource, or
| |
| url | back to summary |
|---|---|
| public URL url() Implements abstract io. Doc from io. Returns the resource URL (not
| |