Package org.jboss.netty.handler.stream

Examples of org.jboss.netty.handler.stream.ChunkedStream


    }


    @Override
    protected void writeToClient(InputStream in, ProtocolSession session) {
        channel.write(new ChunkedStream(in));
    }
View Full Code Here


     * @see org.apache.james.protocols.api.ProtocolSession#writeStream(java.io.InputStream)
     */
    public void writeStream(InputStream stream) {
        Channel channel = getChannelHandlerContext().getChannel();
        if (stream != null && channel.isConnected()) {
            channel.write(new ChunkedStream(stream));
        }
    }
View Full Code Here

     * @see org.apache.james.protocols.api.ProtocolSession#writeStream(java.io.InputStream)
     */
    public void writeStream(InputStream stream) {
        Channel channel = getChannelHandlerContext().getChannel();
        if (stream != null && channel.isConnected()) {
            channel.write(new ChunkedStream(stream));
        }
    }
View Full Code Here

     * (non-Javadoc)
     * @see org.apache.james.protocols.api.ProtocolSession#writeStream(java.io.InputStream)
     */
    public void writeStream(InputStream stream) {
        if (channel.isConnected()) {
            channel.write(new ChunkedStream(stream));   
        }
    }
View Full Code Here

     * @see org.apache.james.protocols.api.ProtocolSession#writeStream(java.io.InputStream)
     */
    public void writeStream(InputStream stream) {
        Channel channel = getChannelHandlerContext().getChannel();
        if (stream != null && channel.isConnected()) {
            channel.write(new ChunkedStream(stream));
        }
    }
View Full Code Here

    @Override
    protected void writeToClient(InputStream in, ProtocolSession session, boolean startTLS) {
        if (startTLS) {
            prepareStartTLS();
        }
        channel.write(new ChunkedStream(in));
    }
View Full Code Here

      header.write(dob);
      ch.write(wrappedBuffer(dob.getData(), 0, dob.getLength()));

      ChannelFuture writeFuture =
          ch.write(
              new ChunkedStream(
                  sorter.getSortedStream(reduce), sslFileBufferSize
                  )
              );
      metrics.shuffleConnections.incr();
      metrics.shuffleOutputBytes.incr(header.getCompressedLength()); // optimistic
View Full Code Here

                throw e;
            }
        } else if (is != null) {
            ChannelFuture writeFuture = ctx.getChannel().write(nettyResponse);
            if (!nettyRequest.getMethod().equals(HttpMethod.HEAD) && !nettyResponse.getStatus().equals(HttpResponseStatus.NOT_MODIFIED)) {
                writeFuture = ctx.getChannel().write(new ChunkedStream(is));
            } else {
                is.close();
            }
            if (!keepAlive) {
                writeFuture.addListener(ChannelFutureListener.CLOSE);
View Full Code Here

                try {
                    channel.write(new DefaultFileRegion(fChannel, 0, fChannel.size(), true));

                } catch (IOException e) {
                    // We handle this later
                    channel.write(new ChunkedStream(new ExceptionInputStream(e)));
                }
                return;

            } else if (in instanceof CombinedInputStream) {
                Iterator<InputStream> streams = ((CombinedInputStream) in).iterator();
                while(streams.hasNext()) {
                    InputStream pIn = streams.next();
                    if (pIn instanceof FileInputStream) {
                        FileChannel fChannel = ((FileInputStream) in).getChannel();
                        try {
                            channel.write(new DefaultFileRegion(fChannel, 0, fChannel.size(), true));
                            return;

                        } catch (IOException e) {
                            // We handle this later
                            channel.write(new ChunkedStream(new ExceptionInputStream(e)));
                        }                   
                    } else {
                        channel.write(new ChunkedStream(in));
                    }
                }
                return;
            }
        }
        channel.write(new ChunkedStream(in));
    }
View Full Code Here

      // Send the response headers to the client.
      future = e.getChannel().write(output);

      if (lowRange != DLNAMediaInfo.ENDFILE_POS && !method.equals("HEAD")) {
        // Send the response body to the client in chunks.
        ChannelFuture chunkWriteFuture = e.getChannel().write(new ChunkedStream(inputStream, BUFFER_SIZE));

        // Add a listener to clean up after sending the entire response body.
        chunkWriteFuture.addListener(new ChannelFutureListener() {
          @Override
          public void operationComplete(ChannelFuture future) {
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.stream.ChunkedStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.