com.coremedia.iso.Utf8 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isoparser Show documentation
Show all versions of isoparser Show documentation
A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)
package com.coremedia.iso;
import java.io.UnsupportedEncodingException;
/**
* Converts byte[]
-> String
and vice versa.
*/
public final class Utf8 {
public static byte[] convert(String s) {
try {
if (s != null) {
return s.getBytes("UTF-8");
} else {
return null;
}
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
}
public static String convert(byte[] b) {
try {
if (b != null) {
return new String(b, "UTF-8");
} else {
return null;
}
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
}
}