public String decode(final byte[] data) throws IOException {
   if (this.charset == null) {
     de.update(data);
     return new String(data, de.getEncode());
   } else {
     return new String(data, this.charset);
   }
 }
 public ByteBuffer encode(final String name) throws IOException {
   if (this.charset == null) { // i.e. use default charset, see no-args constructor
     return ByteBuffer.wrap(name.getBytes(de.getEncode()));
   } else {
     return ByteBuffer.wrap(name.getBytes(this.charset));
   }
 }
 @Override
 public String getEncoding() {
   if (this.charset == null) return de.getEncode().name();
   else return this.charset;
 }