/** * This method is used to convert the size in hexidecimal to a * decimal <code>int</code>. This will use the specified number * of bytes from the internal buffer and parse each character * read as a hexidecimal character. This stops interpreting the * size line when a non-hexidecimal character is encountered. */ private void parse() throws IOException { int off = 0; while(off < count) { int octet = toDecimal(line[off]); if(octet < 0){ if(off < 1) { throw new IOException("Invalid chunk size line"); } break; } chunk <<= 4; chunk ^= octet; off++; } count = 0; }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @param length this is the length of the body to be consumed * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance(long length) { byte[] boundary = getBoundary(segment); if(isUpload(segment)) { return new FileUploadConsumer(allocator, boundary, length); } if(isChunked(segment)) { return new ChunkedConsumer(allocator); } if(isFixed(segment)) { return new FixedLengthConsumer(allocator, length); } return new EmptyConsumer(); }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @param length this is the length of the body to be consumed * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance(long length) { byte[] boundary = getBoundary(segment); if(isUpload(segment)) { return new FileUploadConsumer(allocator, boundary, length); } if(isChunked(segment)) { return new ChunkedConsumer(allocator); } if(isFixed(segment)) { return new FixedConsumer(allocator, length); } return new EmptyConsumer(); }
/** * This method is used to convert the size in hexidecimal to a * decimal <code>int</code>. This will use the specified number * of bytes from the internal buffer and parse each character * read as a hexidecimal character. This stops interpreting the * size line when a non-hexidecimal character is encountered. */ private void parse() throws IOException { int off = 0; while(off < count) { int octet = toDecimal(line[off]); if(octet < 0){ if(off < 1) { throw new IOException("Invalid chunk size line"); } break; } chunk <<= 4; chunk ^= octet; off++; } count = 0; }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @param length this is the length of the body to be consumed * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance(long length) { byte[] boundary = getBoundary(segment); if(isUpload(segment)) { return new FileUploadConsumer(allocator, boundary, length); } if(isChunked(segment)) { return new ChunkedConsumer(allocator); } if(isFixed(segment)) { return new FixedLengthConsumer(allocator, length); } return new EmptyConsumer(); }
/** * This method is used to convert the size in hexidecimal to a * decimal <code>int</code>. This will use the specified number * of bytes from the internal buffer and parse each character * read as a hexidecimal character. This stops interpreting the * size line when a non-hexidecimal character is encountered. */ private void parse() throws IOException { int off = 0; while(off < count) { int octet = toDecimal(line[off]); if(octet < 0){ if(off < 1) { throw new IOException("Invalid chunk size line"); } break; } chunk <<= 4; chunk ^= octet; off++; } count = 0; }