本文整理汇总了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;
}