public static class BOMInputStream.Builder extends AbstractStreamBuilder<BOMInputStream,BOMInputStream.Builder>
BOMInputStream instance.
BOMInputStream s = BOMInputStream.builder()
.setPath(Paths.get("MyFile.xml"))
.setByteOrderMarks(ByteOrderMark.UTF_8)
.setInclude(false)
.get();
BOMInputStream s = BOMInputStream.builder()
.setFile(new File("MyFile.xml"))
.setByteOrderMarks(ByteOrderMark.UTF_8)
.setInclude(false)
.get();
| Modifier and Type | Field and Description |
|---|---|
private ByteOrderMark[] |
byteOrderMarks |
private static ByteOrderMark[] |
DEFAULT |
private boolean |
include |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
BOMInputStream |
get()
Constructs a new instance.
|
(package private) static ByteOrderMark |
getDefaultByteOrderMark()
For test access.
|
BOMInputStream.Builder |
setByteOrderMarks(ByteOrderMark... byteOrderMarks)
Sets the ByteOrderMarks to detect and optionally exclude.
|
BOMInputStream.Builder |
setInclude(boolean include)
Sets whether to include the UTF-8 BOM (true) or to exclude it (false).
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplierprivate static final ByteOrderMark[] DEFAULT
private ByteOrderMark[] byteOrderMarks
private boolean include
static ByteOrderMark getDefaultByteOrderMark()
public BOMInputStream get() throws java.io.IOException
This builder use the aspects InputStream, OpenOption[], include, and ByteOrderMark[].
You must provide an origin that can be converted to an InputStream by this builder, otherwise, this call will throw an
UnsupportedOperationException.
java.lang.UnsupportedOperationException - if the origin cannot provide an InputStream.java.io.IOException - if an I/O error occurs.AbstractStreamBuilder.getInputStream()public BOMInputStream.Builder setByteOrderMarks(ByteOrderMark... byteOrderMarks)
The default is ByteOrderMark.UTF_8.
byteOrderMarks - the ByteOrderMarks to detect and optionally exclude.public BOMInputStream.Builder setInclude(boolean include)
The default is false.
include - true to include the UTF-8 BOM or false to exclude it. return this;