Utilities for IO
Java module with utilities for handling binary IO and controlling IO mode on a *NIX terminal. See morimekta.net/utils for procedures on releases.
To add to
maven: Add this line to
pom.xml under dependencies:
To add to
gradle: Add this line to the
dependencies group in
The input and output streams comes in pairs, and have various specified jobs.
LittleEndianBinaryIO: Handling reading binary content from a wrapped stream handling numbers as big endian or little endian. Also handles zigzag encoding of numbers, BASE-128 etc.
ByteBufferIO: Wrapping byte buffers for reading and writing using IO streams.
BitPackingIO: Will write individual bits to stream, and continue after the last bit.
SeptetPackingIO: Limited to write "septets" (7-bit chunks), packing each byte in 7 bits each (ignoring overflow).
ForkingOutpusStream: Forks written bytes to multiple output streams. Any write will be attempted to each stream, then decided if exceptions are thrown (if any failed).
Sub I/O Streams
Framed: The frames streams are streams of a pre-given size, usually by bytes of the start of the stream. They will act as a stream of that size when reading, and will buffer up bytes and write to wrapped stream including the size when closed when writing.
Terminated: Instead of having a fixed size. Will terminate the stream when encountering a specific byte. When writing will write the terminating byte to stream when closed.
tty classes are controlling terminal (tty) IO modes, and getting the current terminal
proc package contains a utility for easy running of a subprocess with control
over input to the subprocess, and getting output from it. It turns the streams
attached to the native
Process object, and let the user connect streams to the
process to be updated live, which will be properly closed when the process stops
or reaches deadline.