Example #1
0
 private final void encode(final ByteArrayBuffer fb, final char c) {
   if (c < 0x100) {
     fb.append((byte) c);
   } else {
     fb.append((byte) '?');
   }
 }
Example #2
0
 @Override
 public final void write(final OutputStream outputStream, final String string) throws IOException {
   final int n = string.length();
   final ByteArrayBuffer fb = this.getFixedByteArray().clear();
   for (int i = 0; i < n; i++) {
     encode(fb, string.charAt(i));
   }
   outputStream.write(fb.elements(), 0, fb.size());
 }