/** * This is used to read the content body. The specifics of the data * that is read from this <code>ReadableByteChannel</code> can be * determined by the <code>getContentLength</code> method. If the * data sent by the client is chunked then it is decoded, see RFC * 2616 section 3.6. This stream will never provide empty reads as * the content is internally buffered, so this can do a full read. * * @return this returns the byte channel used to read the content */ public ReadableByteChannel getByteChannel() throws IOException { return request.getByteChannel(); }
/** * This is used to read the content body. The specifics of the data * that is read from this <code>ReadableByteChannel</code> can be * determined by the <code>getContentLength</code> method. If the * data sent by the client is chunked then it is decoded, see RFC * 2616 section 3.6. This stream will never provide empty reads as * the content is internally buffered, so this can do a full read. * * @return this returns the byte channel used to read the content */ public ReadableByteChannel getByteChannel() throws IOException { return request.getByteChannel(); }
/** * This is used to read the content body. The specifics of the data * that is read from this <code>ReadableByteChannel</code> can be * determined by the <code>getContentLength</code> method. If the * data sent by the client is chunked then it is decoded, see RFC * 2616 section 3.6. This stream will never provide empty reads as * the content is internally buffered, so this can do a full read. * * @return this returns the byte channel used to read the content */ public ReadableByteChannel getByteChannel() throws IOException { return request.getByteChannel(); }
void handlePut(Request req, Response rsp, String[] path) { long fh = Long.parseLong(path[1]); long start = Long.parseLong(path[2]); int len = Integer.parseInt(path[3]); try { ByteBuffer buf = ByteBuffer.allocate(len); req.getByteChannel().read(buf); if (buf.position() != len) { SDFSLogger.getLog().warn("length is " + len + " buffer size " + buf.position()); throw new FuseException().initErrno(Errno.EIO); } buf.position(0); this.write(fh, buf, start); rsp.setCode(200); rsp.close(); } catch (FuseException e) { SDFSLogger.getLog().error("error during write", e); this.printError(req, rsp, e.getErrno(), e); } catch (Exception e) { SDFSLogger.getLog().error("error during write", e); this.printError(req, rsp, -1, e); } }
int len = request.getByteChannel().read(buf); int count = numRequests.incrementAndGet();