liquibase.resource
Class UtfBomStripperInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.PushbackInputStream
              extended by liquibase.resource.UtfBomStripperInputStream
All Implemented Interfaces:
Closeable

public class UtfBomStripperInputStream
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.

Author:
Dominique Broeglin, Vity

Field Summary
 
Fields inherited from class java.io.PushbackInputStream
buf, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
UtfBomStripperInputStream(InputStream in)
           
 
Method Summary
 String getDetectedCharsetName()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtfBomStripperInputStream

public UtfBomStripperInputStream(InputStream in)
                          throws IOException
Throws:
IOException
Method Detail

getDetectedCharsetName

public String getDetectedCharsetName()
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


Copyright © 2016 Liquibase.org. All rights reserved.