public final class CharsetUtil extends Object
Modifier and Type | Method and Description |
---|---|
static void |
convertCharset(InputStream input,
String inputCharset,
OutputStream output,
String outputCharset)
Converts the character encoding of the supplied input.
|
static String |
convertCharset(String input,
String inputCharset,
String outputCharset)
Converts the character encoding of the supplied input value.
|
static String |
detectCharset(InputStream input)
Detects the character encoding of an input stream.
|
static String |
detectCharset(InputStream input,
String declaredEncoding)
Detects the character encoding of an input stream.
|
static String |
detectCharset(String input)
Detects the character encoding of a string.
|
static String |
detectCharset(String input,
String declaredEncoding)
Detects the character encoding of a string.
|
public static String convertCharset(String input, String inputCharset, String outputCharset) throws IOException
input
- input value to apply conversioninputCharset
- character set of the input valueoutputCharset
- desired character set of the output valueIOException
- problem converting character setpublic static void convertCharset(InputStream input, String inputCharset, OutputStream output, String outputCharset) throws IOException
input
- input stream to apply conversioninputCharset
- character set of the input streamoutput
- where converted stream will be storedoutputCharset
- desired character set of the output streamIOException
- problem converting character setpublic static String detectCharset(String input) throws IOException
input
- the input to detect encoding onnull
if the input is null or blankIOException
- if there is a problem find the character encodingpublic static String detectCharset(String input, String declaredEncoding) throws IOException
input
- the input to detect encoding ondeclaredEncoding
- declared input encoding, if knownnull
if the input is null or blankIOException
- if there is a problem find the character encodingpublic static String detectCharset(InputStream input) throws IOException
InputStream.markSupported()
must return true
otherwise no decoding will be attempted.input
- the input to detect encoding onnull
if input is nullIOException
- if there is a problem find the character encodingpublic static String detectCharset(InputStream input, String declaredEncoding) throws IOException
InputStream.markSupported()
must return true
otherwise no decoding will be attempted.input
- the input to detect encoding ondeclaredEncoding
- declared input encoding, if knownnull
if input is nullIOException
- if there is a problem find the character encodingCopyright © 2009–2021 Norconex Inc.. All rights reserved.