code: @Override
    public ByteBuffer readBytes(ByteBuffer old) throws IOException {
      ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
      while (true) {
        int byteRead = in.read();
        if (byteRead < 0) {
          throw new EOFException();
        }
        if (byteRead == 0) {
          int secondByteRead = in.read();
          if (byteRead < 0) {
            throw new EOFException();
          }
          if (secondByteRead == 0) {
            break;
          } else if (secondByteRead == 1) {
            bytesOut.write(0);
          } else {
            String msg = "Illegal encoding. 0 byte cannot be followed by "
                + "anything other than 0 or 1. It was followed by "
                + Integer.toString(byteRead);
            throw new IOException(msg);
          }
        } else {
          bytesOut.write(byteRead);
        }
      }
      return ByteBuffer.wrap(bytesOut.toByteArray());
    }
docs: Bytes are decoded by reading each byte until we find two consecutive 0
  bytes. A 0 byte followed by a 1 byte is translated into a 0 byte.
  
  @return the decoded byte buffer.