Home » Core Java » nio » CharBuffer


Convert Between Character Set Encodings with CharBuffer

In this example we shall show you how to convert between character set encodings with a CharBuffer in Java. To achieve character set conversions in Java one should perform the following steps: Use the Charset class to get the Charset object for utilizing the specific character set Use the newDecoder() API method of the Charset object to construct a new ...

Read More »

Convert String to byte array UTF encoding

With this example we are going to demonstrate how to convert a String to byte array and vice-versa using the default character encoding in Java. In short, to perform the aforementioned conversion, we are going to use classes from the NIO package in Java so as to convert every character from the target String to its byte equivalent. Namely we ...

Read More »