/** Convert a buffer of bytes into a chars * @deprecated */ public void convert( ByteChunk bb, CharChunk cb ) throws IOException { // Set the ByteChunk as input to the Intermediate reader convert(bb, cb, cb.getBuffer().length - cb.getEnd()); }
public int realReadChars() throws IOException { checkConverter(); boolean eof = false; if (bb.remaining() <= 0) { int nRead = realReadBytes(); if (nRead < 0) { eof = true; } } if (markPos == -1) { clear(cb); } else { // Make sure there's enough space in the worst case makeSpace(bb.remaining()); if ((cb.capacity() - cb.limit()) == 0 && bb.remaining() != 0) { // We went over the limit clear(cb); markPos = -1; } } state = CHAR_STATE; conv.convert(bb, cb, this, eof); if (cb.remaining() == 0 && eof) { return -1; } else { return cb.remaining(); } }
public int realReadChars() throws IOException { checkConverter(); boolean eof = false; if (bb.remaining() <= 0) { int nRead = realReadBytes(); if (nRead < 0) { eof = true; } } if (markPos == -1) { clear(cb); } else { // Make sure there's enough space in the worst case makeSpace(bb.remaining()); if ((cb.capacity() - cb.limit()) == 0 && bb.remaining() != 0) { // We went over the limit clear(cb); markPos = -1; } } state = CHAR_STATE; conv.convert(bb, cb, this, eof); if (cb.remaining() == 0 && eof) { return -1; } else { return cb.remaining(); } }
public int realReadChars(char cbuf[], int off, int len) throws IOException { if(!gotEnc) { setConverter(); } if(bb.getLength() <= 0) { int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); if(nRead < 0) { return -1; } } if(markPos == -1) { cb.setOffset(0); cb.setEnd(0); } conv.convert(bb, cb); bb.setOffset(bb.getEnd()); state = CHAR_STATE; return cb.getLength(); }
/* 588 */ conv.convert(bc, cc);
conv.convert(bc, cc); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) setConverter(); if (bb.getLength() <= 0) { int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); if (nRead < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } int limit = bb.getLength()+cb.getStart(); if( cb.getLimit() < limit ) cb.setLimit(limit); conv.convert(bb, cb); bb.setOffset(bb.getEnd()); state = CHAR_STATE; return cb.getLength(); }
public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) setConverter(); if (bb.getLength() <= 0) { int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); if (nRead < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } int limit = bb.getLength()+cb.getStart(); if ( cb.getLimit() < limit ) cb.setLimit(limit); state = CHAR_STATE; conv.convert(bb, cb, bb.getLength()); bb.setOffset(bb.getEnd()); return cb.getLength(); }
public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) setConverter(); if (bb.getLength() <= 0) { if (realReadBytes(bb.getBytes(), 0, bb.getBytes().length) < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } else { // Make sure there's enough space in the worst case cb.makeSpace(bb.getLength()); if ((cb.getBuffer().length - cb.getEnd()) == 0) { // We went over the limit cb.setOffset(0); cb.setEnd(0); markPos = -1; } } state = CHAR_STATE; conv.convert(bb, cb); return cb.getLength(); }
public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) setConverter(); if (bb.getLength() <= 0) { if (realReadBytes(bb.getBytes(), 0, bb.getBytes().length) < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } else { // Make sure there's enough space in the worst case cb.makeSpace(bb.getLength()); if ((cb.getBuffer().length - cb.getEnd()) == 0) { // We went over the limit cb.setOffset(0); cb.setEnd(0); markPos = -1; } } state = CHAR_STATE; conv.convert(bb, cb); return cb.getLength(); }
public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) setConverter(); if (bb.getLength() <= 0) { int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); if (nRead < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } int limit = bb.getLength()+cb.getStart(); if ( cb.getLimit() < limit ) cb.setLimit(limit); state = CHAR_STATE; conv.convert(bb, cb, bb.getLength()); bb.setOffset(bb.getEnd()); return cb.getLength(); }
public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) setConverter(); if (bb.getLength() <= 0) { int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); if (nRead < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } int limit = bb.getLength()+cb.getStart(); if ( cb.getLimit() < limit ) cb.setLimit(limit); state = CHAR_STATE; conv.convert(bb, cb, bb.getLength()); bb.setOffset(bb.getEnd()); return cb.getLength(); }
@Override public int realReadChars(char cbuf[], int off, int len) throws IOException { if (!gotEnc) { setConverter(); } if (bb.getLength() <= 0) { int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); if (nRead < 0) { return -1; } } if (markPos == -1) { cb.setOffset(0); cb.setEnd(0); } int limit = bb.getLength()+cb.getStart(); if ( cb.getLimit() < limit ) { cb.setLimit(limit); } state = CHAR_STATE; conv.convert(bb, cb, bb.getLength()); bb.setOffset(bb.getEnd()); return cb.getLength(); }
/** * Character conversion of the URI. * * @param uri MessageBytes object containing the URI * @param request The Servlet request object * @throws IOException if a IO exception occurs sending an error to the client */ protected void convertURI(MessageBytes uri, Request request) throws IOException { ByteChunk bc = uri.getByteChunk(); int length = bc.getLength(); CharChunk cc = uri.getCharChunk(); cc.allocate(length, -1); Charset charset = connector.getURICharset(); B2CConverter conv = request.getURIConverter(); if (conv == null) { conv = new B2CConverter(charset, true); request.setURIConverter(conv); } else { conv.recycle(); } try { conv.convert(bc, cc, true); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength()); } catch (IOException ioe) { // Should never happen as B2CConverter should replace // problematic characters request.getResponse().sendError(HttpServletResponse.SC_BAD_REQUEST); } }
/** * Character conversion of the URI. * * @param uri MessageBytes object containing the URI * @param request The Servlet request object * @throws IOException if a IO exception occurs sending an error to the client */ protected void convertURI(MessageBytes uri, Request request) throws IOException { ByteChunk bc = uri.getByteChunk(); int length = bc.getLength(); CharChunk cc = uri.getCharChunk(); cc.allocate(length, -1); Charset charset = connector.getURICharset(); B2CConverter conv = request.getURIConverter(); if (conv == null) { conv = new B2CConverter(charset, true); request.setURIConverter(conv); } else { conv.recycle(); } try { conv.convert(bc, cc, true); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength()); } catch (IOException ioe) { // Should never happen as B2CConverter should replace // problematic characters request.getResponse().sendError(HttpServletResponse.SC_BAD_REQUEST); } }
conv.convert(bb, cb, eof);
conv.convert(bb, cb, eof);
conv.convert(bc, cc, cc.getBuffer().length - cc.getEnd()); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
conv.convert(bc, cc, cc.getBuffer().length - cc.getEnd()); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());
conv.convert(bc, cc, cc.getBuffer().length - cc.getEnd()); uri.setChars(cc.getBuffer(), cc.getStart(), cc.getLength());