本文整理匯總了Java中org.apache.tomcat.util.buf.ByteChunk.setBytes方法的典型用法代碼示例。如果您正苦於以下問題:Java ByteChunk.setBytes方法的具體用法?Java ByteChunk.setBytes怎麽用?Java ByteChunk.setBytes使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tomcat.util.buf.ByteChunk的用法示例。
在下文中一共展示了ByteChunk.setBytes方法的16個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: doRead
點讚 3
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (pos >= lastValid) {
if (!fill())
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:19,
示例2: doRead
點讚 3
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (pos >= lastValid) {
if (!fill(true,true)) //read body, must be blocking, as the thread is inside the app
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:19,
示例3: doRead
點讚 3
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes into the specified chunk.
*/
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (endOfStream) {
return -1;
}
if (first && req.getContentLength() > 0) {
// Handle special first-body-chunk
if (!receive()) {
return 0;
}
} else if (empty) {
if (!refillReadBuffer()) {
return -1;
}
}
ByteChunk bc = bodyBytes.getByteChunk();
chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
empty = true;
return chunk.getLength();
}
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:26,
示例4: doRead
點讚 3
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes into the specified chunk.
*/
public int doRead(ByteChunk chunk, Request req )
throws IOException {
if (pos >= lastValid) {
if (!fill())
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:19,
示例5: doRead
點讚 3
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req) throws IOException {
if (endOfStream) {
return -1;
}
if (first && req.getContentLengthLong() > 0) {
// Handle special first-body-chunk
if (!receive()) {
return 0;
}
} else if (empty) {
if (!refillReadBuffer()) {
return -1;
}
}
ByteChunk bc = bodyBytes.getByteChunk();
chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
empty = true;
return chunk.getLength();
}
開發者ID:how2j,項目名稱:lazycat,代碼行數:26,
示例6: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Fills the given ByteChunk with the buffered request body.
*/
@Override
public int doRead(ByteChunk chunk, Request request) throws IOException {
if (hasRead || buffered.getLength() <= 0) {
return -1;
}
chunk.setBytes(buffered.getBytes(), buffered.getStart(),
buffered.getLength());
hasRead = true;
return chunk.getLength();
}
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:15,
示例7: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes.
*
* @return If the filter does request length control, this value is
* significant; it should be the number of bytes consumed from the buffer,
* up until the end of the current request body, or the buffer length,
* whichever is greater. If the filter does not do request body length
* control, the returned value should be -1.
*/
@Override
public int doRead(ByteChunk chunk, Request req)
throws IOException {
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
int nRead = buffer.doRead(chunk, req);
if (nRead > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(),
(int) remaining);
result = (int) remaining;
} else {
result = nRead;
}
if (nRead > 0) {
remaining = remaining - nRead;
}
} else {
// No more bytes left to be read : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
}
return result;
}
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:43,
示例8: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes into the specified chunk.
*/
@Override
public int doRead(ByteChunk chunk, Request req) throws IOException {
if (pos >= lastValid) {
if (!fill())
return -1;
}
int length = lastValid - pos;
chunk.setBytes(buf, pos, length);
pos = lastValid;
return (length);
}
開發者ID:how2j,項目名稱:lazycat,代碼行數:18,
示例9: doWrite
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Write some bytes.
*
* @return number of bytes written by the filter
*/
@Override
public int doWrite(ByteChunk chunk, Response res)
throws IOException {
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
result = chunk.getLength();
if (result > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(),
(int) remaining);
result = (int) remaining;
remaining = 0;
} else {
remaining = remaining - result;
}
buffer.doWrite(chunk, res);
} else {
// No more bytes left to be written : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
} else {
// If no content length was set, just write the bytes
buffer.doWrite(chunk, res);
result = chunk.getLength();
}
return result;
}
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:42,
示例10: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Fills the given ByteChunk with the buffered request body.
*/
@Override
public int doRead(ByteChunk chunk, Request request) throws IOException {
if (hasRead || buffered.getLength() <= 0) {
return -1;
}
chunk.setBytes(buffered.getBytes(), buffered.getStart(), buffered.getLength());
hasRead = true;
return chunk.getLength();
}
開發者ID:how2j,項目名稱:lazycat,代碼行數:14,
示例11: doWrite
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Write some bytes.
*
* @return number of bytes written by the filter
*/
public int doWrite(ByteChunk chunk, Response res)
throws IOException {
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
result = chunk.getLength();
if (result > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(),
(int) remaining);
result = (int) remaining;
remaining = 0;
} else {
remaining = remaining - result;
}
buffer.doWrite(chunk, res);
} else {
// No more bytes left to be written : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
} else {
// If no content length was set, just write the bytes
buffer.doWrite(chunk, res);
result = chunk.getLength();
}
return result;
}
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:41,
示例12: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Fills the given ByteChunk with the buffered request body.
*/
public int doRead(ByteChunk chunk, Request request) throws IOException {
if (hasRead || buffered.getLength() <= 0) {
return -1;
} else {
chunk.setBytes(buffered.getBytes(), buffered.getStart(),
buffered.getLength());
hasRead = true;
}
return chunk.getLength();
}
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,
示例13: doWrite
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Write some bytes.
*
* @return number of bytes written by the filter
*/
@Override
public int doWrite(ByteChunk chunk, Response res) throws IOException {
int result = -1;
if (contentLength >= 0) {
if (remaining > 0) {
result = chunk.getLength();
if (result > remaining) {
// The chunk is longer than the number of bytes remaining
// in the body; changing the chunk length to the number
// of bytes remaining
chunk.setBytes(chunk.getBytes(), chunk.getStart(), (int) remaining);
result = (int) remaining;
remaining = 0;
} else {
remaining = remaining - result;
}
buffer.doWrite(chunk, res);
} else {
// No more bytes left to be written : return -1 and clear the
// buffer
chunk.recycle();
result = -1;
}
} else {
// If no content length was set, just write the bytes
buffer.doWrite(chunk, res);
result = chunk.getLength();
}
return result;
}
開發者ID:how2j,項目名稱:lazycat,代碼行數:40,
示例14: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes.
*
* @return If the filter does request length control, this value is
* significant; it should be the number of bytes consumed from the buffer,
* up until the end of the current request body, or the buffer length,
* whichever is greater. If the filter does not do request body length
* control, the returned value should be -1.
*/
@Override
public int doRead(ByteChunk chunk, Request req) throws IOException {
if (endChunk) {
return -1;
}
checkError();
if(needCRLFParse) {
needCRLFParse = false;
parseCRLF(false);
}
if (remaining <= 0) {
if (!parseChunkHeader()) {
throwIOException(sm.getString("chunkedInputFilter.invalidHeader"));
}
if (endChunk) {
parseEndChunk();
return -1;
}
}
int result = 0;
if (pos >= lastValid) {
if (readBytes() < 0) {
throwIOException(sm.getString("chunkedInputFilter.eos"));
}
}
if (remaining > (lastValid - pos)) {
result = lastValid - pos;
remaining = remaining - result;
chunk.setBytes(buf, pos, result);
pos = lastValid;
} else {
result = remaining;
chunk.setBytes(buf, pos, remaining);
pos = pos + remaining;
remaining = 0;
//we need a CRLF
if ((pos+1) >= lastValid) {
//if we call parseCRLF we overrun the buffer here
//so we defer it to the next call BZ 11117
needCRLFParse = true;
} else {
parseCRLF(false); //parse the CRLF immediately
}
}
return result;
}
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:63,
示例15: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes.
*
* @return If the filter does request length control, this value is
* significant; it should be the number of bytes consumed from the
* buffer, up until the end of the current request body, or the
* buffer length, whichever is greater. If the filter does not do
* request body length control, the returned value should be -1.
*/
@Override
public int doRead(ByteChunk chunk, Request req) throws IOException {
if (endChunk) {
return -1;
}
checkError();
if (needCRLFParse) {
needCRLFParse = false;
parseCRLF(false);
}
if (remaining <= 0) {
if (!parseChunkHeader()) {
throwIOException(sm.getString("chunkedInputFilter.invalidHeader"));
}
if (endChunk) {
parseEndChunk();
return -1;
}
}
int result = 0;
if (pos >= lastValid) {
if (readBytes() < 0) {
throwIOException(sm.getString("chunkedInputFilter.eos"));
}
}
if (remaining > (lastValid - pos)) {
result = lastValid - pos;
remaining = remaining - result;
chunk.setBytes(buf, pos, result);
pos = lastValid;
} else {
result = remaining;
chunk.setBytes(buf, pos, remaining);
pos = pos + remaining;
remaining = 0;
// we need a CRLF
if ((pos + 1) >= lastValid) {
// if we call parseCRLF we overrun the buffer here
// so we defer it to the next call BZ 11117
needCRLFParse = true;
} else {
parseCRLF(false); // parse the CRLF immediately
}
}
return result;
}
開發者ID:how2j,項目名稱:lazycat,代碼行數:63,
示例16: doRead
點讚 2
import org.apache.tomcat.util.buf.ByteChunk; //導入方法依賴的package包/類
/**
* Read bytes.
*
* @return If the filter does request length control, this value is
* significant; it should be the number of bytes consumed from the buffer,
* up until the end of the current request body, or the buffer length,
* whichever is greater. If the filter does not do request body length
* control, the returned value should be -1.
*/
public int doRead(ByteChunk chunk, Request req)
throws IOException {
if (endChunk)
return -1;
if (needCRLFParse) {
needCRLFParse = false;
// FIXME: parse CRLF could return 0 in NB
parseCRLF();
}
if (remaining <= 0) {
if (!parseChunkHeader()) {
return 0;
}
if (endChunk) {
parseEndChunk();
return -1;
}
}
int result = 0;
if (pos >= lastValid) {
// FIXME: parse CRLF could return 0 in NB
readBytes();
}
if (remaining > (lastValid - pos)) {
result = lastValid - pos;
remaining = remaining - result;
chunk.setBytes(buf, pos, result);
pos = lastValid;
} else {
result = remaining;
chunk.setBytes(buf, pos, remaining);
pos = pos + remaining;
remaining = 0;
//we need a CRLF
if ((pos+1) >= lastValid) {
//if we call parseCRLF we overrun the buffer here
//so we defer it to the next call BZ 11117
needCRLFParse = true;
} else {
parseCRLF(); //parse the CRLF immediately
}
}
return result;
}
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:62,
注:本文中的org.apache.tomcat.util.buf.ByteChunk.setBytes方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。