@Override public void write(byte[] b, int off, int len) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(b, off, len); }
@Override public void write(byte[] b, int off, int len) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(b, off, len); }
@Override public void write(int i) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(i); }
@Override public void write(byte[] b, int off, int len) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(b, off, len); }
@Override public void write(byte[] b, int off, int len) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(b, off, len); }
@Override public void write(byte[] b, int off, int len) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(b, off, len); }
@Override public void write(int i) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(i); }
@Override public void write(int i) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(i); }
@Override public void write(int i) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(i); }
@Override public void write(int i) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(i); }
@Override public void write(byte[] b, int off, int len) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(b, off, len); }
@Override public void write(int i) throws IOException { if (!prevIsReady) { throw new IllegalStateException( LogMessages.WARNING_GRIZZLY_HTTP_SERVLET_NON_BLOCKING_ERROR()); } outputStream.write(i); }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
/** * Send next CHUNK_SIZE of file */ private boolean sendChunk() throws IOException { // allocate Buffer final Buffer buffer = mm.allocate(chunkSize); // mark it available for disposal after content is written buffer.allowBufferDispose(true); // read file to the Buffer final int justReadBytes = (int) Buffers.readFromFileChannel( fileChannel, buffer); if (justReadBytes <= 0) { complete(false); return false; } // prepare buffer to be written buffer.trim(); // write the Buffer outputStream.write(buffer); size -= justReadBytes; // check the remaining size here to avoid extra onWritePossible() invocation if (size <= 0) { complete(false); return false; } return true; }
private void doEvent(CometEvent event, CometHandler handler) throws IOException { if (event.getType() == CometEvent.Type.NOTIFY) { final NIOOutputStream outputStream = handler.getResponse().getNIOOutputStream(); outputStream.write((Byte) event.attachment()); outputStream.flush(); if (!useStreaming) { cometContext.resumeCometHandler(handler); } } }