All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.coremedia.iso.Utf8 Maven / Gradle / Ivy

Go to download

A generic parser and writer for all ISO 14496 based files (MP4, Quicktime, DCF, PDCF, ...)

There is a newer version: 1.1.22
Show newest version
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);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy