public static class UnsynchronizedByteArrayInputStream.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<UnsynchronizedByteArrayInputStream,UnsynchronizedByteArrayInputStream.Builder>
UnsynchronizedByteArrayInputStream
instance.
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();
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
UnsynchronizedByteArrayInputStream |
get()
Constructs a new instance.
|
UnsynchronizedByteArrayInputStream.Builder |
setByteArray(byte[] origin) |
UnsynchronizedByteArrayInputStream.Builder |
setLength(int length) |
UnsynchronizedByteArrayInputStream.Builder |
setOffset(int offset) |
getCharset, setBufferSize, setBufferSize, setCharset, setCharset, setOpenOptions
setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public UnsynchronizedByteArrayInputStream get() throws java.io.IOException
This builder use the aspects byte[], offset and length.
You must provide an origin that can be converted to a byte[] by this builder, otherwise, this call will throw an
UnsupportedOperationException
.
java.lang.UnsupportedOperationException
- if the origin cannot provide a byte[].java.lang.IllegalStateException
- if the origin
is null
.java.io.IOException
- if an I/O error occurs.AbstractOrigin.getByteArray()
public UnsynchronizedByteArrayInputStream.Builder setByteArray(byte[] origin)
setByteArray
in class org.apache.commons.io.build.AbstractOriginSupplier<UnsynchronizedByteArrayInputStream,UnsynchronizedByteArrayInputStream.Builder>
public UnsynchronizedByteArrayInputStream.Builder setLength(int length)
public UnsynchronizedByteArrayInputStream.Builder setOffset(int offset)
Copyright © 2010 - 2023 Adobe. All Rights Reserved