• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MalformedChunkCodingException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.http.MalformedChunkCodingException的典型用法代码示例。如果您正苦于以下问题:Java MalformedChunkCodingException类的具体用法?Java MalformedChunkCodingException怎么用?Java MalformedChunkCodingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MalformedChunkCodingException类属于org.apache.http包,在下文中一共展示了MalformedChunkCodingException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: nextChunk

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Read the next chunk.
 * @throws IOException in case of an I/O error
 */
private void nextChunk() throws IOException {
    if (state == CHUNK_INVALID) {
        throw new MalformedChunkCodingException("Corrupt data stream");
    }
    try {
        chunkSize = getChunkSize();
        if (chunkSize < 0L) {
            throw new MalformedChunkCodingException("Negative chunk size");
        }
        state = CHUNK_DATA;
        pos = 0L;
        if (chunkSize == 0L) {
            eof = true;
            parseTrailerHeaders();
        }
    } catch (MalformedChunkCodingException ex) {
        state = CHUNK_INVALID;
        throw ex;
    }
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:25,代码来源:ChunkedInputStream.java


示例2: nextChunk

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Read the next chunk.
 * @throws IOException in case of an I/O error
 */
private void nextChunk() throws IOException {
    chunkSize = getChunkSize();
    if (chunkSize < 0) {
        throw new MalformedChunkCodingException("Negative chunk size");
    }
    state = CHUNK_DATA;
    pos = 0;
    if (chunkSize == 0) {
        eof = true;
        parseTrailerHeaders();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:ChunkedInputStream.java


示例3: getChunkSize

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Expects the stream to start with a chunksize in hex with optional
 * comments after a semicolon. The line must end with a CRLF: "a3; some
 * comment\r\n" Positions the stream at the start of the next line.
 *
 * @param in The new input stream.
 * @param required <tt>true<tt/> if a valid chunk must be present,
 *                 <tt>false<tt/> otherwise.
 *
 * @return the chunk size as integer
 *
 * @throws IOException when the chunk size could not be parsed
 */
private int getChunkSize() throws IOException {
    int st = this.state;
    switch (st) {
    case CHUNK_CRLF:
        this.buffer.clear();
        int i = this.in.readLine(this.buffer);
        if (i == -1) {
            return 0;
        }
        if (!this.buffer.isEmpty()) {
            throw new MalformedChunkCodingException(
                "Unexpected content at the end of chunk");
        }
        state = CHUNK_LEN;
        //$FALL-THROUGH$
    case CHUNK_LEN:
        this.buffer.clear();
        i = this.in.readLine(this.buffer);
        if (i == -1) {
            return 0;
        }
        int separator = this.buffer.indexOf(';');
        if (separator < 0) {
            separator = this.buffer.length();
        }
        try {
            return Integer.parseInt(this.buffer.substringTrimmed(0, separator), 16);
        } catch (NumberFormatException e) {
            throw new MalformedChunkCodingException("Bad chunk header");
        }
    default:
        throw new IllegalStateException("Inconsistent codec state");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:48,代码来源:ChunkedInputStream.java


示例4: parseTrailerHeaders

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Reads and stores the Trailer headers.
 * @throws IOException in case of an I/O error
 */
private void parseTrailerHeaders() throws IOException {
    try {
        this.footers = AbstractMessageParser.parseHeaders
            (in, -1, -1, null);
    } catch (HttpException ex) {
        IOException ioe = new MalformedChunkCodingException("Invalid footer: "
                + ex.getMessage());
        ioe.initCause(ex);
        throw ioe;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:ChunkedInputStream.java


示例5: getChunkSize

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Expects the stream to start with a chunksize in hex with optional
 * comments after a semicolon. The line must end with a CRLF: "a3; some
 * comment\r\n" Positions the stream at the start of the next line.
 */
private int getChunkSize() throws IOException {
    final int st = this.state;
    switch (st) {
    case CHUNK_CRLF:
        this.buffer.clear();
        final int bytesRead1 = this.in.readLine(this.buffer);
        if (bytesRead1 == -1) {
            return 0;
        }
        if (!this.buffer.isEmpty()) {
            throw new MalformedChunkCodingException(
                "Unexpected content at the end of chunk");
        }
        state = CHUNK_LEN;
        //$FALL-THROUGH$
    case CHUNK_LEN:
        this.buffer.clear();
        final int bytesRead2 = this.in.readLine(this.buffer);
        if (bytesRead2 == -1) {
            return 0;
        }
        int separator = this.buffer.indexOf(';');
        if (separator < 0) {
            separator = this.buffer.length();
        }
        try {
            return Integer.parseInt(this.buffer.substringTrimmed(0, separator), 16);
        } catch (final NumberFormatException e) {
            throw new MalformedChunkCodingException("Bad chunk header");
        }
    default:
        throw new IllegalStateException("Inconsistent codec state");
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:40,代码来源:ChunkedInputStreamHC4.java


示例6: parseTrailerHeaders

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Reads and stores the Trailer headers.
 * @throws IOException in case of an I/O error
 */
private void parseTrailerHeaders() throws IOException {
    try {
        this.footers = AbstractMessageParserHC4.parseHeaders
            (in, -1, -1, null);
    } catch (final HttpException ex) {
        final IOException ioe = new MalformedChunkCodingException("Invalid footer: "
                + ex.getMessage());
        ioe.initCause(ex);
        throw ioe;
    }
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:16,代码来源:ChunkedInputStreamHC4.java


示例7: testMalformedChunkException

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testMalformedChunkException() throws Exception {
    InputSupplier<InputStream> input = ByteStreams.join(
            ByteStreams.newInputStreamSupplier("[5,6".getBytes(Charsets.UTF_8)),
            exceptionStreamSupplier(new MalformedChunkCodingException("Bad chunk header")));
    assertThrowsEOFException(input.getInput(), Integer.class);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:9,代码来源:JsonStreamingArrayParserTest.java


示例8: close

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Closes the stream and frees the underlying HTTP connection.
 *
 * @throws IOException if an error is encountered while trying to close the stream.
 */
@Override
public void close() throws IOException {
    try {
        // We need to first close the response directly rather than the parser or the response entity's
        // InputStream in order to avoid a long delay.
        response.close();
    } catch (MalformedChunkCodingException e) {
        // that's because we forced the stream closed
    }
}
 
开发者ID:hashicorp,项目名称:nomad-java-sdk,代码行数:16,代码来源:FramedStream.java


示例9: getLocalizedMessage

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
public static String getLocalizedMessage(Throwable ex, String defaultValue) {
    if (isHostUnavailableException(ex))
        return App.getContext().getString(R.string.server_not_available_or_not_respond);
    if (isTimeOutException(ex))
        return App.getContext().getString(R.string.exceeded_timeout);
    if (isException(ex, MalformedChunkCodingException.class))
        return App.getContext().getString(R.string.server_failed_to_respond);
    if (isException(ex, SocketException.class))
        return App.getContext().getString(R.string.connection_lost);
    return defaultValue;
}
 
开发者ID:slartus,项目名称:4pdaClient-plus,代码行数:12,代码来源:AppLog.java


示例10: testColumnValueTooLargeForBuffer

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
@Test(expected = MalformedChunkCodingException.class)
public void testColumnValueTooLargeForBuffer() throws Exception {
    StringBuilder allChars = new StringBuilder();
    for (char c = Character.MIN_VALUE; c < 0xD800; c++) { //
        allChars.append(c);
    }

    String allCharString = allChars.toString();
    QueryHandlerTest.generateJournal("xyz", allCharString, 4.900232E-10, 2.598E20, Long.MAX_VALUE, Integer.MIN_VALUE, new Timestamp(-102023));
    String query = "select x, id from xyz \n limit 1";
    QueryHandlerTest.download(query, temp);
}
 
开发者ID:bluestreak01,项目名称:questdb,代码行数:13,代码来源:QueryHandlerSmallBufferTest.java


示例11: getChunkSize

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Expects the stream to start with a chunksize in hex with optional
 * comments after a semicolon. The line must end with a CRLF: "a3; some
 * comment\r\n" Positions the stream at the start of the next line.
 */
private long getChunkSize() throws IOException {
    final int st = this.state;
    switch (st) {
    case CHUNK_CRLF:
        this.buffer.clear();
        final int bytesRead1 = this.in.readLine(this.buffer);
        if (bytesRead1 == -1) {
            throw new MalformedChunkCodingException(
                "CRLF expected at end of chunk");
        }
        if (!this.buffer.isEmpty()) {
            throw new MalformedChunkCodingException(
                "Unexpected content at the end of chunk");
        }
        state = CHUNK_LEN;
        //$FALL-THROUGH$
    case CHUNK_LEN:
        this.buffer.clear();
        final int bytesRead2 = this.in.readLine(this.buffer);
        if (bytesRead2 == -1) {
            throw new ConnectionClosedException("Premature end of chunk coded message body: " +
                    "closing chunk expected");
        }
        int separator = this.buffer.indexOf(';');
        if (separator < 0) {
            separator = this.buffer.length();
        }
        final String s = this.buffer.substringTrimmed(0, separator);
        try {
            return Long.parseLong(s, 16);
        } catch (final NumberFormatException e) {
            throw new MalformedChunkCodingException("Bad chunk header: " + s);
        }
    default:
        throw new IllegalStateException("Inconsistent codec state");
    }
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:43,代码来源:ChunkedInputStream.java


示例12: parseTrailerHeaders

import org.apache.http.MalformedChunkCodingException; //导入依赖的package包/类
/**
 * Reads and stores the Trailer headers.
 * @throws IOException in case of an I/O error
 */
private void parseTrailerHeaders() throws IOException {
    try {
        this.footers = AbstractMessageParser.parseHeaders(in,
                constraints.getMaxHeaderCount(),
                constraints.getMaxLineLength(),
                null);
    } catch (final HttpException ex) {
        final IOException ioe = new MalformedChunkCodingException("Invalid footer: "
                + ex.getMessage());
        ioe.initCause(ex);
        throw ioe;
    }
}
 
开发者ID:docker-java,项目名称:docker-java,代码行数:18,代码来源:ChunkedInputStream.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ImageInputStreamSpi类代码示例发布时间:2022-05-21
下一篇:
Java RemoteExceptionData类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap