Code example for SessionInputBuffer

Methods: read

0
            nextChunk(); 
            if (eof) {
                return -1; 
            } 
        } 
        final int bytesRead = in.read(b, off, Math.min(len, chunkSize - pos));
        if (bytesRead != -1) {
            pos += bytesRead;
            if (pos >= chunkSize) {
                state = CHUNK_CRLF;
            } 
            return bytesRead;
        } else { 
            eof = true;
            throw new TruncatedChunkException("Truncated chunk " 
                    + "( expected size: " + chunkSize
                    + "; actual size: " + pos + ")");
        } 
    } 
 
    /**