public class EncodingCheck extends Object
Library to check if and encoding is respected.
Modifier and Type | Field and Description |
---|---|
static int |
READ_BUFFER_SIZE
Buffer size for reading the input
|
Constructor and Description |
---|
EncodingCheck() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkEncoding(byte[] bytes,
String encoding)
Check if every byte in an array belong to a given encoding.
|
static boolean |
checkEncoding(InputStream is,
String encoding)
Check encoding from an input stream.
|
public static final int READ_BUFFER_SIZE
public static boolean checkEncoding(InputStream is, String encoding) throws IOException
Check encoding from an input stream. Reading is buffered.
is
- the source streamencoding
- encoding to checktrue
if all bytes belong to give encoding, false
otherwise.IOException
- in case issues arisepublic static boolean checkEncoding(byte[] bytes, String encoding)
Check if every byte in an array belong to a given encoding.
bytes
- the source byte arrayencoding
- encoding to checktrue
if all bytes belong to give encoding, false
otherwise.Copyright © 2022 Fugerit. All rights reserved.