當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。