Package org.fugerit.java.core.charset
Class EncodingCheck
- java.lang.Object
-
- org.fugerit.java.core.charset.EncodingCheck
-
public class EncodingCheck extends Object
Library to check if and encoding is respected.
- Author:
- Fugerit
-
-
Field Summary
Fields Modifier and Type Field Description static int
READ_BUFFER_SIZE
Buffer size for reading the input
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
READ_BUFFER_SIZE
public static final int READ_BUFFER_SIZE
Buffer size for reading the input- See Also:
- Constant Field Values
-
-
Method Detail
-
checkEncoding
public static boolean checkEncoding(InputStream is, String encoding) throws IOException
Check encoding from an input stream. Reading is buffered.
- Parameters:
is
- the source streamencoding
- encoding to check- Returns:
true
if all bytes belong to give encoding,false
otherwise.- Throws:
IOException
- in case issues arise
-
checkEncoding
public static boolean checkEncoding(byte[] bytes, String encoding)
Check if every byte in an array belong to a given encoding.
- Parameters:
bytes
- the source byte arrayencoding
- encoding to check- Returns:
true
if all bytes belong to give encoding,false
otherwise.
-
-