List of usage examples for io.netty.buffer ByteBuf readBytes
public abstract int readBytes(FileChannel out, long position, int length) throws IOException;
From source file:io.liveoak.common.codec.FileUploadInputStream.java
License:Open Source License
public FileUploadInputStream(FileUpload fileUpload, int bufSize) { super(new InputStream() { @Override/*from w w w. j a va 2s . c om*/ public int read() throws IOException { throw new IllegalStateException("Implementation error!"); } public int read(byte[] buf, int pos, int len) throws IOException { ByteBuf buffer = fileUpload.getChunk(len); if (buffer.readableBytes() == 0) { return -1; } else { int cc = len > buffer.readableBytes() ? buffer.readableBytes() : len; buffer.readBytes(buf, pos, cc); return cc; } } }, bufSize); }