public static class BOMInputStream.Builder extends AbstractStreamBuilder<BOMInputStream,BOMInputStream.Builder>
BOMInputStream.
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();
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()
Builds a new
BOMInputStream. |
(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, getReader, 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
BOMInputStream.
You must set input that supports AbstractStreamBuilder.getInputStream(), otherwise, this method throws an exception.
This builder use the following aspects: InputStream, OpenOption[], include, and ByteOrderMark[].
This builder use the following aspects:
AbstractStreamBuilder.getInputStream()java.lang.IllegalStateException - if the origin is null.java.lang.UnsupportedOperationException - if the origin cannot be converted to 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;