More javadoc fixes

This commit is contained in:
Norman Maurer 2012-12-21 22:32:16 +01:00
parent 8a7bc2c606
commit 5b44fe6e65
5 changed files with 24 additions and 17 deletions

View File

@ -41,8 +41,7 @@ import io.netty.handler.codec.MessageToMessageDecoder;
* and then you can use an array of bytes instead of a {@link ByteBuf} * and then you can use an array of bytes instead of a {@link ByteBuf}
* as a message: * as a message:
* <pre> * <pre>
* void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) { * void messageReceived({@link ChannelHandlerContext} ctx, byte[] bytes) {
* byte[] bytes = (byte[]) e.getMessage();
* ... * ...
* } * }
* </pre> * </pre>

View File

@ -43,8 +43,7 @@ import io.netty.handler.codec.MessageToMessageEncoder;
* and then you can use an array of bytes instead of a {@link ByteBuf} * and then you can use an array of bytes instead of a {@link ByteBuf}
* as a message: * as a message:
* <pre> * <pre>
* void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) { * void messageReceived({@link ChannelHandlerContext} ctx, byte[] bytes) {
* byte[] bytes = (byte[]) e.getMessage();
* ... * ...
* } * }
* </pre> * </pre>

View File

@ -32,8 +32,19 @@ public abstract class ZlibEncoder extends ByteToByteEncoder {
*/ */
public abstract boolean isClosed(); public abstract boolean isClosed();
/**
* Close this {@link ZlibEncoder} and so finish the encoding.
*
* The returned {@link ChannelFuture} will be notified once the
* operation completes.
*/
public abstract ChannelFuture close(); public abstract ChannelFuture close();
/**
* Close this {@link ZlibEncoder} and so finish the encoding.
* The given {@link ChannelFuture} will be notified once the operation
* completes and will also be returned.
*/
public abstract ChannelFuture close(ChannelFuture future); public abstract ChannelFuture close(ChannelFuture future);
} }

View File

@ -19,23 +19,24 @@ import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.DelimiterBasedFrameDecoder; import io.netty.handler.codec.DelimiterBasedFrameDecoder;
import io.netty.handler.codec.Delimiters; import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.MessageToMessageDecoder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
/** /**
* Decodes a received {@link ByteBuf} into a {@link String}. Please * Decodes a received {@link ByteBuf} into a {@link String}. Please
* note that this decoder must be used with a proper {@link FrameDecoder} * note that this decoder must be used with a proper {@link ByteToMessageDecoder}
* such as {@link DelimiterBasedFrameDecoder} if you are using a stream-based * such as {@link DelimiterBasedFrameDecoder} or {@link LineBasedFrameDecoder}
* transport such as TCP/IP. A typical setup for a text-based line protocol * if you are using a stream-based transport such as TCP/IP. A typical setup for a
* in a TCP/IP socket would be: * text-based line protocol in a TCP/IP socket would be:
* <pre> * <pre>
* {@link ChannelPipeline} pipeline = ...; * {@link ChannelPipeline} pipeline = ...;
* *
* // Decoders * // Decoders
* pipeline.addLast("frameDecoder", new {@link DelimiterBasedFrameDecoder}(80, {@link Delimiters#lineDelimiter()})); * pipeline.addLast("frameDecoder", new {@link LineBasedFrameDecoder}(80));
* pipeline.addLast("stringDecoder", new {@link StringDecoder}(CharsetUtil.UTF_8)); * pipeline.addLast("stringDecoder", new {@link StringDecoder}(CharsetUtil.UTF_8));
* *
* // Encoder * // Encoder
@ -44,8 +45,7 @@ import java.nio.charset.Charset;
* and then you can use a {@link String} instead of a {@link ByteBuf} * and then you can use a {@link String} instead of a {@link ByteBuf}
* as a message: * as a message:
* <pre> * <pre>
* void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) { * void messageReceived({@link ChannelHandlerContext} ctx, {@link String} msg) {
* String msg = (String) e.getMessage();
* ch.write("Did you say '" + msg + "'?\n"); * ch.write("Did you say '" + msg + "'?\n");
* } * }
* </pre> * </pre>

View File

@ -20,8 +20,7 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.DelimiterBasedFrameDecoder; import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.Delimiters;
import io.netty.handler.codec.MessageToMessageEncoder; import io.netty.handler.codec.MessageToMessageEncoder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
@ -33,7 +32,7 @@ import java.nio.charset.Charset;
* {@link ChannelPipeline} pipeline = ...; * {@link ChannelPipeline} pipeline = ...;
* *
* // Decoders * // Decoders
* pipeline.addLast("frameDecoder", new {@link DelimiterBasedFrameDecoder}({@link Delimiters#lineDelimiter()})); * pipeline.addLast("frameDecoder", new {@link LineBasedFrameDecoder}(80));
* pipeline.addLast("stringDecoder", new {@link StringDecoder}(CharsetUtil.UTF_8)); * pipeline.addLast("stringDecoder", new {@link StringDecoder}(CharsetUtil.UTF_8));
* *
* // Encoder * // Encoder
@ -42,8 +41,7 @@ import java.nio.charset.Charset;
* and then you can use a {@link String} instead of a {@link ByteBuf} * and then you can use a {@link String} instead of a {@link ByteBuf}
* as a message: * as a message:
* <pre> * <pre>
* void messageReceived({@link ChannelHandlerContext} ctx, {@link MessageEvent} e) { * void messageReceived({@link ChannelHandlerContext} ctx, {@link String} msg) {
* String msg = (String) e.getMessage();
* ch.write("Did you say '" + msg + "'?\n"); * ch.write("Did you say '" + msg + "'?\n");
* } * }
* </pre> * </pre>