/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
private static void storeAvailableData(NIOInputStream in, FileChannel fileChannel) throws IOException { // Get the Buffer directly from NIOInputStream final Buffer buffer = in.readBuffer(); // Retrieve ByteBuffer final ByteBuffer byteBuffer = buffer.toByteBuffer(); try { while(byteBuffer.hasRemaining()) { // Write the ByteBuffer content to the file fileChannel.write(byteBuffer); } } finally { // we can try to dispose the buffer buffer.tryDispose(); } }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * {@inheritDoc} */ @Override public Buffer readBuffer(final int size) { if (size > readyData()) { throw new IllegalStateException("Can not read more bytes than available"); } multipartEntry.addAvailableBytes(-size); return parentNIOInputStream.readBuffer(size); }
/** * Read available file content data out of HTTP request and save the * chunk into local file output stream * * @throws IOException */ private void readAndSaveAvail() throws IOException { while (inputStream.isReady()) { final Buffer buffer = inputStream.readBuffer(); if (buffer.isComposite()) { writeCompositeBuffer(buffer); } else { writeBufferToDiskAndUpdateStats(buffer.toByteBuffer()); } } }
/** * Read available file content data out of HTTP request and save the * chunk into local file output stream * * @throws IOException */ private void readAndSaveAvail() throws IOException { while (inputStream.isReady()) { final Buffer buffer = inputStream.readBuffer(); if (buffer.isComposite()) { writeCompositeBuffer(buffer); } else { writeBufferToDiskAndUpdateStats(buffer.toByteBuffer()); } } }