public class BOM extends Object
This class does not actually read BOM. It guesses encoding based on the input pattern.
Modifier and Type | Field and Description |
---|---|
static Charset |
utf16be |
static Charset |
utf16le |
static Charset |
utf32be |
static Charset |
utf32le |
static Charset |
utf8 |
Constructor and Description |
---|
BOM() |
Modifier and Type | Method and Description |
---|---|
static Charset |
guessCharset(PushbackInputStream is)
This function guess the encoding for a JSON file using a pattern.
|
public static final Charset utf8
public static final Charset utf16le
public static final Charset utf16be
public static final Charset utf32le
public static final Charset utf32be
public static Charset guessCharset(PushbackInputStream is) throws IOException
It should be noted that JSON (rfc4627) does not requires BOM. Instead, its encoding can be inferred from a pattern to determine if it is in utf-8, utf-16le, utf-16be, utf-32le or utf-32be.
is
- a PushbackInputStream to allow bytes to be unread.IOException
- in case of I/O error.Copyright © 2016. All rights reserved.