liquibase.resource
Class UtfBomAwareReader
java.lang.Object
java.io.Reader
liquibase.resource.UtfBomAwareReader
- All Implemented Interfaces:
- Closeable, Readable
public class UtfBomAwareReader
- extends Reader
Reader that tries to identify the encoding by looking at the BOM. If no BOM
is found it defaults to the encoding givent at initialization. Original ideas
from Thomas Weidenfeller, Aki Nieminen.
- Author:
- Dominique Broeglin
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UtfBomAwareReader
public UtfBomAwareReader(InputStream in)
UtfBomAwareReader
public UtfBomAwareReader(InputStream in,
String defaultCharsetName)
getDefaultEncoding
public String getDefaultEncoding()
getEncoding
public String getEncoding()
init
protected void init()
throws IOException
- 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
defaultCharsetName is used to initialize the reader.
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Specified by:
close
in class Reader
- Throws:
IOException
read
public int read(char[] cbuf,
int off,
int len)
throws IOException
- Specified by:
read
in class Reader
- Throws:
IOException
Copyright © 2016 Liquibase.org. All rights reserved.