/** Generate the bytes using the specified encoding */ public void convert(char c[], int off, int len) throws IOException { CharBuffer cb = CharBuffer.wrap(c, off, len); byte[] barr = bb.getBuffer(); int boff = bb.getEnd(); ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); CoderResult cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); while (cr == CoderResult.OVERFLOW) { if (!bb.canGrow()) bb.flushBuffer(); boff = bb.getEnd(); barr = bb.getBuffer(); tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); } if (cr != CoderResult.UNDERFLOW) { throw new IOException("Encoding error"); } }
/** Generate the bytes using the specified encoding */ public void convert(char c[], int off, int len) throws IOException { CharBuffer cb = CharBuffer.wrap(c, off, len); byte[] barr = bb.getBuffer(); int boff = bb.getEnd(); ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); CoderResult cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); while (cr == CoderResult.OVERFLOW) { if (!bb.canGrow()) bb.flushBuffer(); boff = bb.getEnd(); barr = bb.getBuffer(); tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); } if (cr != CoderResult.UNDERFLOW) { throw new IOException("Encoding error"); } }
/** Generate the bytes using the specified encoding */ public void convert(char c[], int off, int len) throws IOException { CharBuffer cb = CharBuffer.wrap(c, off, len); byte[] barr = bb.getBuffer(); int boff = bb.getEnd(); ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); CoderResult cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); while (cr == CoderResult.OVERFLOW) { if (!bb.canGrow()) bb.flushBuffer(); boff = bb.getEnd(); barr = bb.getBuffer(); tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); } if (cr != CoderResult.UNDERFLOW) { throw new IOException("Encoding error"); } }
/** Generate the bytes using the specified encoding */ public void convert(char c[], int off, int len) throws IOException { CharBuffer cb = CharBuffer.wrap(c, off, len); byte[] barr = bb.getBuffer(); int boff = bb.getEnd(); ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); CoderResult cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); while (cr == CoderResult.OVERFLOW) { if (!bb.canGrow()) bb.flushBuffer(); boff = bb.getEnd(); barr = bb.getBuffer(); tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); } if (cr != CoderResult.UNDERFLOW) { throw new IOException("Encoding error"); } }
/** Generate the bytes using the specified encoding */ public void convert(char c[], int off, int len) throws IOException { CharBuffer cb = CharBuffer.wrap(c, off, len); byte[] barr = bb.getBuffer(); int boff = bb.getEnd(); ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); CoderResult cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); while (cr == CoderResult.OVERFLOW) { if (!bb.canGrow()) bb.flushBuffer(); boff = bb.getEnd(); barr = bb.getBuffer(); tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); } if (cr != CoderResult.UNDERFLOW) { throw new IOException("Encoding error"); } }
/** Generate the bytes using the specified encoding */ public void convert(char c[], int off, int len) throws IOException { CharBuffer cb = CharBuffer.wrap(c, off, len); byte[] barr = bb.getBuffer(); int boff = bb.getEnd(); ByteBuffer tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); CoderResult cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); while (cr == CoderResult.OVERFLOW) { if (!bb.canGrow()) bb.flushBuffer(); boff = bb.getEnd(); barr = bb.getBuffer(); tmp = ByteBuffer.wrap(barr, boff, barr.length - boff); cr = encoder.encode(cb, tmp, true); bb.setEnd(tmp.position()); } if (cr != CoderResult.UNDERFLOW) { throw new IOException("Encoding error"); } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Sets the <tt>DataChunk</tt> end position. * * @param end the <tt>DataChunk</tt> end position. */ @Override public void setEnd(int end) { switch (type) { case Bytes: byteChunk.setEnd(end); break; case Buffer: bufferChunk.setEnd(end); break; case Chars: charChunk.setEnd(end); break; default: break; } }
/** * Unescapes any double quotes in the given cookie value. * * @param bc The cookie value to modify */ public static void unescapeDoubleQuotes(final ByteChunk bc) { if (bc == null || bc.getLength() == 0) { return; } int src = bc.getStart(); int end = bc.getEnd(); int dest = src; final byte[] buffer = bc.getBuffer(); while (src < end) { if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') { src++; } buffer[dest] = buffer[src]; dest++; src++; } bc.setEnd(dest); }
/** * Unescapes any double quotes in the given cookie value. * * @param bc The cookie value to modify */ public static void unescapeDoubleQuotes(final ByteChunk bc) { if (bc == null || bc.getLength() == 0) { return; } int src = bc.getStart(); int end = bc.getEnd(); int dest = src; final byte[] buffer = bc.getBuffer(); while (src < end) { if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') { src++; } buffer[dest] = buffer[src]; dest++; src++; } bc.setEnd(dest); }
/** * Unescapes any double quotes in the given cookie value. * * @param bc The cookie value to modify */ public static void unescapeDoubleQuotes(final ByteChunk bc) { if (bc == null || bc.getLength() == 0) { return; } int src = bc.getStart(); int end = bc.getEnd(); int dest = src; final byte[] buffer = bc.getBuffer(); while (src < end) { if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') { src++; } buffer[dest] = buffer[src]; dest++; src++; } bc.setEnd(dest); }
/** * Unescapes any double quotes in the given cookie value. * * @param bc The cookie value to modify */ public static void unescapeDoubleQuotes(final ByteChunk bc) { if (bc == null || bc.getLength() == 0) { return; } int src = bc.getStart(); int end = bc.getEnd(); int dest = src; final byte[] buffer = bc.getBuffer(); while (src < end) { if (buffer[src] == '\\' && src < end && buffer[src + 1] == '"') { src++; } buffer[dest] = buffer[src]; dest++; src++; } bc.setEnd(dest); }