Code example for Charset

Methods: name

0
    private final Charset _charset = Charset.forName("UTF-8");
 
    public V2SpeedMedia.MediaContent deserialize (byte[] array) throws Exception
    { 
      V2SpeedMedia.MediaContent.Builder builder = V2SpeedMedia.MediaContent.newBuilder();
      JsonFormat.merge(new String(array, _charset.name()), builder);
      return builder.build();
    } 
 
    public byte[] serialize(V2SpeedMedia.MediaContent content) throws IOException
    { 
      return JsonFormat.printToString(content).getBytes(_charset.name());
    } 
 
    public String getName ()
    { 
      return "protobuf-json(JsonFormat.java)"; 
    } 
}