I'm looking for an equivalent to .NET's System.Text.Encoding in Java. For example in C# I can do this:
Encoding defaultEncoding = Encoding.Default;
byte[] encoded = defaultEncoding.GetBytes("Text to encode");
I would like to be able to do the same in Java.