|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.netty.handler.stream.ChunkedWriteHandler
public class ChunkedWriteHandler
A ChannelHandler that adds support for writing a large data stream
asynchronously neither spending a lot of memory nor getting
OutOfMemoryError. Large data streaming such as file
transfer requires complicated state management in a ChannelHandler
implementation. ChunkedWriteHandler manages such complicated states
so that you can send a large data stream without difficulties.
To use ChunkedWriteHandler in your application, you have to insert
a new ChunkedWriteHandler instance:
Once inserted, you can write aChannelPipelinep = ...; p.addLast("streamer", newChunkedWriteHandler()); p.addLast("handler", new MyHandler());
ChunkedInput so that the
ChunkedWriteHandler can pick it up and fetch the content of the
stream chunk by chunk and write the fetched chunk downstream:
Channelch = ...; ch.write(newChunkedFile(new File("video.mkv"));
ChunkedInput generates a chunk on a certain event or timing.
Such ChunkedInput implementation often returns false on
ChunkedInput.hasNextChunk(), resulting in the indefinitely suspended
transfer. To resume the transfer when a new chunk is available, you have to
call resumeTransfer().
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
|---|
ChannelHandler.Sharable |
| Constructor Summary | |
|---|---|
ChunkedWriteHandler()
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
handleDownstream(ChannelHandlerContext ctx,
ChannelEvent e)
Handles the specified downstream event. |
void |
handleUpstream(ChannelHandlerContext ctx,
ChannelEvent e)
Handles the specified upstream event. |
void |
resumeTransfer()
Continues to fetch the chunks from the input. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ChunkedWriteHandler()
| Method Detail |
|---|
public void resumeTransfer()
public void handleDownstream(ChannelHandlerContext ctx,
ChannelEvent e)
throws java.lang.Exception
ChannelDownstreamHandler
handleDownstream in interface ChannelDownstreamHandlerctx - the context object for this handlere - the downstream event to process or intercept
java.lang.Exception
public void handleUpstream(ChannelHandlerContext ctx,
ChannelEvent e)
throws java.lang.Exception
ChannelUpstreamHandler
handleUpstream in interface ChannelUpstreamHandlerctx - the context object for this handlere - the upstream event to process or intercept
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||