Package com.itextpdf.commons.utils
Class EncodingUtil
java.lang.Object
com.itextpdf.commons.utils.EncodingUtil
This file is a helper class for internal usage only.
Be aware that its API and functionality may be changed in future.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
convertToBytes
(char[] chars, String encoding) Converts to byte array an array of chars, taking the provided encoding into account.static String
convertToString
(byte[] bytes, String encoding) Converts to String an array of bytes, taking the provided encoding into account.
-
Field Details
-
UTF8
- See Also:
-
-
Constructor Details
-
EncodingUtil
private EncodingUtil()
-
-
Method Details
-
convertToBytes
Converts to byte array an array of chars, taking the provided encoding into account.- Parameters:
chars
- an array of chars to be converted to bytesencoding
- the encoding to be taken into account while converting the provided array of chars- Returns:
- the resultant array of bytes
- Throws:
CharacterCodingException
- if anything goes wrong while encoding
-
convertToString
public static String convertToString(byte[] bytes, String encoding) throws UnsupportedEncodingException Converts to String an array of bytes, taking the provided encoding into account.- Parameters:
bytes
- an array of bytes to be converted to Stringencoding
- the encoding to be taken into account while converting the provided bytes- Returns:
- the resultant string
- Throws:
UnsupportedEncodingException
- if anything goes wrong while encoding
-