Package liquibase.util
Class BomAwareInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.PushbackInputStream
-
- liquibase.util.BomAwareInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class BomAwareInputStream extends PushbackInputStream
Read up to 4 bytes to determine the BOM. Extra bytes, of if no BOM is found are pushed back to the input stream. If no BOM is found, the detectedCharsetName is null.
-
-
Field Summary
-
Fields inherited from class java.io.PushbackInputStream
buf, pos
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description BomAwareInputStream(InputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Charset
getDetectedCharset()
Returns detected charset name.protected void
init()
-
Methods inherited from class java.io.PushbackInputStream
available, close, mark, markSupported, read, read, reset, skip, unread, unread, unread
-
Methods inherited from class java.io.FilterInputStream
read
-
-
-
-
Constructor Detail
-
BomAwareInputStream
public BomAwareInputStream(InputStream in) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getDetectedCharset
public Charset getDetectedCharset()
Returns detected charset name. Null if no BOM header was found.- Returns:
- charset name - one of UTF-8, UTF-16BE, UTF-32LE, UTF-16LE, UTF-32BE or null if no BOM detected
-
init
protected void init() throws IOException
- Throws:
IOException
-
-