public static class UnsynchronizedByteArrayInputStream.Builder extends 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)
Sets a new origin.
|
UnsynchronizedByteArrayInputStream.Builder |
setLength(int length) |
UnsynchronizedByteArrayInputStream.Builder |
setOffset(int offset) |
getBufferSize, getBufferSizeDefault, getCharset, getCharsetDefault, setBufferSize, setBufferSize, setBufferSizeDefault, setCharset, setCharset, setCharsetDefault
checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriter
asThis
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public Builder()
public UnsynchronizedByteArrayInputStream get() throws IOException
UnsupportedOperationException
- if the origin cannot be converted to a byte array.IOException
- if an I/O error occurs.public UnsynchronizedByteArrayInputStream.Builder setByteArray(byte[] origin)
AbstractOriginSupplier
setByteArray
in class AbstractOriginSupplier<UnsynchronizedByteArrayInputStream,UnsynchronizedByteArrayInputStream.Builder>
origin
- the new origin.public UnsynchronizedByteArrayInputStream.Builder setLength(int length)
public UnsynchronizedByteArrayInputStream.Builder setOffset(int offset)
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.