本文整理匯總了Java中org.apache.http.protocol.HTTP.LF屬性的典型用法代碼示例。如果您正苦於以下問題:Java HTTP.LF屬性的具體用法?Java HTTP.LF怎麽用?Java HTTP.LF使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.http.protocol.HTTP
的用法示例。
在下文中一共展示了HTTP.LF屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: lineFromLineBuffer
/**
* Reads a complete line of characters up to a line delimiter from this
* session buffer. The line delimiter itself is discarded. If no char is
* available because the end of the stream has been reached,
* <code>null</code> is returned. This method blocks until input data is
* available, end of file is detected, or an exception is thrown.
* <p>
* This method treats a lone LF as a valid line delimiters in addition
* to CR-LF required by the HTTP specification.
*
* @return HTTP line as a string
* @exception IOException if an I/O error occurs.
*/
private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
throws IOException {
// discard LF if found
int len = this.linebuffer.length();
if (len > 0) {
if (this.linebuffer.byteAt(len - 1) == HTTP.LF) {
len--;
}
// discard CR if found
if (len > 0) {
if (this.linebuffer.byteAt(len - 1) == HTTP.CR) {
len--;
}
}
}
if (this.ascii) {
charbuffer.append(this.linebuffer, 0, len);
} else {
ByteBuffer bbuf = ByteBuffer.wrap(this.linebuffer.buffer(), 0, len);
len = appendDecoded(charbuffer, bbuf);
}
this.linebuffer.clear();
return len;
}
示例2: locateLF
private int locateLF() {
for (int i = this.bufferpos; i < this.bufferlen; i++) {
if (this.buffer[i] == HTTP.LF) {
return i;
}
}
return -1;
}