当前位置: 首页>>代码示例>>Java>>正文


Java HTTP.LF属性代码示例

本文整理汇总了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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:AbstractSessionInputBuffer.java

示例2: locateLF

private int locateLF() {
    for (int i = this.bufferpos; i < this.bufferlen; i++) {
        if (this.buffer[i] == HTTP.LF) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractSessionInputBuffer.java


注:本文中的org.apache.http.protocol.HTTP.LF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。