public int doWrite(ByteChunk chunk) { final int start = chunk.getStart(); final int end = chunk.getEnd(); final int length = end - start; if (length == 0) { return 0; } // NB: We make a copy because Tomcat reuses the underlying byte array of 'chunk'. final byte[] content = Arrays.copyOfRange(chunk.getBuffer(), start, end); data.add(HttpData.of(content)); bytesWritten += length; return length; }
@Override public int doWrite(ByteChunk chunk, Response response) throws IOException { final int start = chunk.getStart(); final int end = chunk.getEnd(); final int length = end - start; if (length == 0) { return 0; } // NB: We make a copy because Tomcat reuses the underlying byte array of 'chunk'. final byte[] content = Arrays.copyOfRange(chunk.getBuffer(), start, end); data.add(HttpData.of(content)); bytesWritten += length; return length; }
/** * Read bytes from the previous buffer. */ protected int readBytes() throws IOException { int nRead = buffer.doRead(readChunk, null); pos = readChunk.getStart(); lastValid = pos + nRead; buf = readChunk.getBytes(); return nRead; }
/** * Read bytes from the previous buffer. */ protected int readBytes() throws IOException { int nRead = buffer.doRead(readChunk, null); pos = readChunk.getStart(); lastValid = pos + nRead; buf = readChunk.getBytes(); return nRead; }
/** * Read bytes from the previous buffer. */ protected int readBytes() throws IOException { int nRead = buffer.doRead(readChunk, null); pos = readChunk.getStart(); lastValid = pos + nRead; buf = readChunk.getBytes(); return nRead; }
/** * Read bytes from the previous buffer. */ protected int readBytes() throws IOException { int nRead = buffer.doRead(readChunk, null); pos = readChunk.getStart(); lastValid = pos + nRead; buf = readChunk.getBytes(); return nRead; }
/** * Read bytes from the previous buffer. */ protected int readBytes() throws IOException { int nRead = buffer.doRead(readChunk, null); pos = readChunk.getStart(); lastValid = pos + nRead; buf = readChunk.getBytes(); return nRead; }
/** * Read bytes from the previous buffer. */ protected int readBytes() throws IOException { int nRead = buffer.doRead(readChunk, null); pos = readChunk.getStart(); lastValid = pos + nRead; buf = readChunk.getBytes(); return nRead; }
public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); }
protected void urlEncode(CharChunk out, ByteChunk bb) throws IOException { byte[] bytes = bb.getBuffer(); for (int j = bb.getStart(); j < bb.getEnd(); j++) { out.append('%'); char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16); out.append(ch); ch = Character.forDigit(bytes[j] & 0xF, 16); out.append(ch); } }
public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); }
public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); }
protected void urlEncode(CharChunk out, ByteChunk bb) throws IOException { byte[] bytes = bb.getBuffer(); for (int j = bb.getStart(); j < bb.getEnd(); j++) { out.append('%'); char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16); out.append(ch); ch = Character.forDigit(bytes[j] & 0xF, 16); out.append(ch); } }
public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); }
public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); }
public void append( ByteChunk src ) throws IOException { append( src.getBytes(), src.getStart(), src.getLength()); }
protected void urlEncode(CharChunk out, ByteChunk bb) throws IOException { byte[] bytes = bb.getBuffer(); for (int j = bb.getStart(); j < bb.getEnd(); j++) { out.append('%'); char ch = Character.forDigit((bytes[j] >> 4) & 0xF, 16); out.append(ch); ch = Character.forDigit(bytes[j] & 0xF, 16); out.append(ch); } }
/** * Write chunk. */ @Override public int doWrite(ByteChunk chunk, Response res) throws IOException { int len = chunk.getLength(); int start = chunk.getStart(); byte[] b = chunk.getBuffer(); addToBB(b, start, len); byteCount += chunk.getLength(); return chunk.getLength(); }
@Override protected final void setRequestBody(ByteChunk body) { int length = body.getLength(); bodyBytes.setBytes(body.getBytes(), body.getStart(), length); request.setContentLength(length); first = false; empty = false; replay = true; endOfStream = false; }
/** * Write chunk. */ @Override public int doWrite(ByteChunk chunk, Response res) throws IOException { int len = chunk.getLength(); int start = chunk.getStart(); byte[] b = chunk.getBuffer(); addToBB(b, start, len); byteCount += chunk.getLength(); return chunk.getLength(); }