- Java 99.9%
- CSS 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo | ||
| com.io7m.wendover.core | ||
| com.io7m.wendover.tests | ||
| src/site/resources | ||
| .gitignore | ||
| .gitmodules | ||
| checkstyle-filter.xml | ||
| checkstyle-suppressions-1.0.dtd | ||
| doc7m-books.json | ||
| pom.xml | ||
| README-CHANGES.xml | ||
| README-LICENSE.txt | ||
| README.in | ||
| README.md | ||
wendover
wendover
The wendover package provides extra classes for working with Java NIO
channels.
Features
- Numerous
Channelclasses and adapters with various properties. - High coverage test suite.
- OSGi-ready.
- JPMS-ready.
- ISC license.
Usage
CloseShieldSeekableByteChannel
Use CloseShieldSeekableByteChannel in order to prevent external code from
closing an arbitrary SeekableByteChannel instance:
SeekableByteChannel c;
someUntrustedObject.run(new CloseShieldSeekableByteChannel(c));
The CloseShieldSeekableByteChannel instance can be closed, but will not
result in the underlying channel really being closed.
ReadOnlySeekableByteChannel
Use ReadOnlySeekableByteChannel to protect an arbitrary SeekableByteChannel
instance against writes:
SeekableByteChannel c;
someUntrustedObject.run(new ReadOnlySeekableByteChannel(c));
Attempts to write to the ReadOnlySeekableByteChannel will result in
NonWritableChannelException being thrown.
SubrangeSeekableByteChannel
Use SubrangeSeekableByteChannel to restrict reads and writes to an arbitrary
SeekableByteChannel instance to a particular range:
SeekableByteChannel c;
someObject.run(new SubrangeSeekableByteChannel(c, 100L, 1000L));
Reads of the SubrangeSeekableByteChannel instance will be limited to only
reading data that falls within offsets [100, 100 + 1000 - 1]. Reading at
position 0 of the SubrangeSeekableByteChannel instance will actually
read from position 100 of c. Writes are similarly translated and limited.
UpperRangeTrackingSeekableByteChannel
Use UpperRangeTrackingSeekableByteChannel to track the uppermost point
written by an arbitrary SeekableByteChannel instance:
SeekableByteChannel c;
var d = new UpperRangeTrackingSeekableByteChannel(c);
someObject.run(d);
System.out.println(d.uppermostWritten());
ByteBufferChannels
Use the ByteBufferChannels class to adapt a ByteBuffer into a
SeekableByteChannel:
ByteBuffer data;
SeekableByteChannel c = ByteBufferChannels.ofByteBuffer(data);
DelegatingSeekableByteChannel
Use the DelegatingSeekableByteChannel class to delegate operations to an
existing channel. This class is used to implement most of the wendover
package.
