public static class UnsynchronizedByteArrayInputStream.Builder extends AbstractStreamBuilder<UnsynchronizedByteArrayInputStream,UnsynchronizedByteArrayInputStream.Builder>
UnsynchronizedByteArrayInputStream.
Using a Byte Array:
UnsynchronizedByteArrayInputStream s = UnsynchronizedByteArrayInputStream.builder()
.setByteArray(byteArray)
.setOffset(0)
.setLength(byteArray.length)
.get();
Using File IO:
UnsynchronizedByteArrayInputStream s = UnsynchronizedByteArrayInputStream.builder()
.setFile(file)
.setOffset(0)
.setLength(byteArray.length)
.get();
Using NIO Path:
UnsynchronizedByteArrayInputStream s = UnsynchronizedByteArrayInputStream.builder()
.setPath(path)
.setOffset(0)
.setLength(byteArray.length)
.get();
get()| Constructor and Description |
|---|
Builder()
Constructs a builder of
UnsynchronizedByteArrayInputStream. |
| Modifier and Type | Method and Description |
|---|---|
UnsynchronizedByteArrayInputStream |
get()
Builds a new
UnsynchronizedByteArrayInputStream. |
UnsynchronizedByteArrayInputStream.Builder |
setByteArray(byte[] origin)
Sets a new origin.
|
UnsynchronizedByteArrayInputStream.Builder |
setLength(int length)
Sets the length.
|
UnsynchronizedByteArrayInputStream.Builder |
setOffset(int offset)
Sets the offset.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplier, getUncheckedpublic Builder()
UnsynchronizedByteArrayInputStream.public UnsynchronizedByteArrayInputStream get() throws IOException
UnsynchronizedByteArrayInputStream.
You must set an aspect that supports byte[] on this builder, otherwise, this method throws an exception.
This builder uses the following aspects:
byte[]UnsupportedOperationException - if the origin cannot provide a byte[].IllegalStateException - if the origin is null.IOException - if an I/O error occurs converting to an byte[] using AbstractOrigin.getByteArray().AbstractOrigin.getByteArray(),
IOSupplier.getUnchecked()public UnsynchronizedByteArrayInputStream.Builder setByteArray(byte[] origin)
AbstractOriginSuppliersetByteArray in class AbstractOriginSupplier<UnsynchronizedByteArrayInputStream,UnsynchronizedByteArrayInputStream.Builder>origin - the new origin.this instance.public UnsynchronizedByteArrayInputStream.Builder setLength(int length)
length - Must be greater or equal to 0.this instance.public UnsynchronizedByteArrayInputStream.Builder setOffset(int offset)
offset - Must be greater or equal to 0.this instance.