throws Exception {
ByteChunk bc = uri.getByteChunk();
+ int length = bc.getLength();
CharChunk cc = uri.getCharChunk();
- cc.allocate(bc.getLength(), -1);
+ cc.allocate(length, -1);
String enc = connector.getURIEncoding();
if (enc != null) {
byte[] bbuf = bc.getBuffer();
char[] cbuf = cc.getBuffer();
int start = bc.getStart();
- for (int i = 0; i < bc.getLength(); i++) {
+ for (int i = 0; i < length; i++) {
cbuf[i] = (char) (bbuf[i + start] & 0xff);
}
- uri.setChars(cbuf, 0, bc.getLength());
+ uri.setChars(cbuf, 0, length);
}
ByteChunk bc = mb.getByteChunk();
CharChunk cc = mb.getCharChunk();
- cc.allocate(bc.getLength(), -1);
+ int length = bc.getLength();
+ cc.allocate(length, -1);
// Default encoding: fast conversion
byte[] bbuf = bc.getBuffer();
char[] cbuf = cc.getBuffer();
int start = bc.getStart();
- for (int i = 0; i < bc.getLength(); i++) {
+ for (int i = 0; i < length; i++) {
cbuf[i] = (char) (bbuf[i + start] & 0xff);
}
- mb.setChars(cbuf, 0, bc.getLength());
+ mb.setChars(cbuf, 0, length);
}
// Set the given bytes as the content
ByteChunk bc = (ByteChunk) param;
- bodyBytes.setBytes(bc.getBytes(), bc.getStart(), bc.getLength());
- request.setContentLength(bc.getLength());
+ int length = bc.getLength();
+ bodyBytes.setBytes(bc.getBytes(), bc.getStart(), length);
+ request.setContentLength(length);
first = false;
empty = false;
replay = true;
// Set the given bytes as the content
ByteChunk bc = (ByteChunk) param;
- bodyBytes.setBytes(bc.getBytes(), bc.getStart(), bc.getLength());
- request.setContentLength(bc.getLength());
+ int length = bc.getLength();
+ bodyBytes.setBytes(bc.getBytes(), bc.getStart(), length);
+ request.setContentLength(length);
first = false;
empty = false;
replay = true;
protected void write(ByteChunk bc) {
// Writing the byte chunk to the output buffer
- System.arraycopy(bc.getBytes(), bc.getStart(), buf, pos,
- bc.getLength());
- pos = pos + bc.getLength();
+ int length = bc.getLength();
+ System.arraycopy(bc.getBytes(), bc.getStart(), buf, pos, length);
+ pos = pos + length;
}
protected void write(ByteChunk bc) {
// Writing the byte chunk to the output buffer
- System.arraycopy(bc.getBytes(), bc.getStart(), buf, pos,
- bc.getLength());
- pos = pos + bc.getLength();
+ int length = bc.getLength();
+ System.arraycopy(bc.getBytes(), bc.getStart(), buf, pos, length);
+ pos = pos + length;
}
protected void write(ByteChunk bc) {
// Writing the byte chunk to the output buffer
- System.arraycopy(bc.getBytes(), bc.getStart(), buf, pos,
- bc.getLength());
- pos = pos + bc.getLength();
+ int length = bc.getLength();
+ System.arraycopy(bc.getBytes(), bc.getStart(), buf, pos, length);
+ pos = pos + length;
}
public int doWrite(ByteChunk chunk, Response res)
throws IOException {
+ int length = chunk.getLength();
if (useSocketBuffer) {
socketBuffer.append(chunk.getBuffer(), chunk.getStart(),
- chunk.getLength());
+ length);
} else {
outputStream.write(chunk.getBuffer(), chunk.getStart(),
- chunk.getLength());
+ length);
}
- return chunk.getLength();
+ return length;
}
byte[] bytes = bc.getBytes();
int start=bc.getStart();
- appendInt( bc.getLength() );
- cpBytes(bytes, start, bc.getLength());
+ int length = bc.getLength();
+ appendInt( length );
+ cpBytes(bytes, start, length);
appendByte(0);
}
result = bc.toString();
} else {
CharChunk cc = tmpNameC;
- cc.allocate(bc.getLength(), -1);
+ int length = bc.getLength();
+ cc.allocate(length, -1);
// Default encoding: fast conversion
byte[] bbuf = bc.getBuffer();
char[] cbuf = cc.getBuffer();
int start = bc.getStart();
- for (int i = 0; i < bc.getLength(); i++) {
+ for (int i = 0; i < length; i++) {
cbuf[i] = (char) (bbuf[i + start] & 0xff);
}
- cc.setChars(cbuf, 0, bc.getLength());
+ cc.setChars(cbuf, 0, length);
result = cc.toString();
cc.recycle();
}