public static class BOMInputStream.Builder extends org.apache.commons.io.build.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();
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
BOMInputStream |
get()
Constructs a new instance.
|
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).
|
getCharset, setBufferSize, setBufferSize, setCharset, setCharset, setOpenOptions
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
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;Copyright © 2010 - 2023 Adobe. All Rights Reserved