类org.apache.commons.io.IOExceptionWithCause源码实例Demo

下面列出了怎么用org.apache.commons.io.IOExceptionWithCause的API类实例代码及写法,或者点击链接到github查看源代码。

private int getNextChunkSize() throws IOException {
    metaBuf.clear();
    while (true) {
        byte b = getOneByte();
        if (b == 10 || b == 13) {
            // if we have \r\n then skip \n
            byte b2 = getOneByte();
            if (b2 != 10) {
                file.position(file.position() - 1);
            }

            // ignore newlines before length marker
            if (metaBuf.position() > 0) {
                break;
            }
        } else {
            //if (log.isDebugEnabled()) log.debug("Read byte: "+b);
            metaBuf.put(b);
        }
    }
    //if (log.isDebugEnabled()) log.debug("Meta line: "+JMeterPluginsUtils.byteBufferToString(metaBuf));

    byte[] bLine = new byte[metaBuf.position()];
    metaBuf.rewind();
    metaBuf.get(bLine);
    String sLine = new String(bLine).trim();
    String[] ar = sLine.split(regexp);
    if (log.isDebugEnabled()) {
        log.debug("Chunk size: " + ar[0]);
    }

    int res = 0;
    try {
        res = Integer.parseInt(ar[0]);
    } catch (NumberFormatException ex) {
        log.error("Error reading chunk size near: " + sLine, ex);
        throw new IOExceptionWithCause(ex);
    }
    return res;
}
 
 类所在包
 类方法
 同包方法