org.polyglotted.crypto.utils.Charsets Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of crypto-recipes Show documentation
Show all versions of crypto-recipes Show documentation
A library of standard cryptographic recipes for application usage
The newest version!
package org.polyglotted.crypto.utils;
import java.nio.charset.Charset;
public enum Charsets {
UTF8("UTF-8"), ASCII("US-ASCII"), UTF16("UTF-16"), UTF32("UTF-32");
private final Charset charset;
private Charsets(String value) {
this.charset = Charset.forName(value);
}
public Charset charset() {
return charset;
}
public byte[] getBytes(String value) {
return value.getBytes(charset());
}
public String getString(byte[] bytes) {
return new String(bytes, charset());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy