You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Trustin Lee <tr...@gmail.com> on 2007/07/16 04:52:00 UTC
Re: svn commit: r556496 - /mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java
Oops, it seems like you reverted back to our old coding style? :)
Trustin
On 7/16/07, mwebb@apache.org <mw...@apache.org> wrote:
> Author: mwebb
> Date: Sun Jul 15 19:29:03 2007
> New Revision: 556496
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=556496
> Log:
> added constructor per DIRMINA-397.
>
> Modified:
> mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java
>
> Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java
> URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java?view=diff&rev=556496&r1=556495&r2=556496
> ==============================================================================
> --- mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java (original)
> +++ mina/trunk/core/src/main/java/org/apache/mina/filter/codec/textline/TextLineCodecFactory.java Sun Jul 15 19:29:03 2007
> @@ -19,6 +19,7 @@
> */
> package org.apache.mina.filter.codec.textline;
>
> +
> import java.nio.charset.Charset;
>
> import org.apache.mina.common.BufferDataException;
> @@ -26,6 +27,7 @@
> import org.apache.mina.filter.codec.ProtocolDecoder;
> import org.apache.mina.filter.codec.ProtocolEncoder;
>
> +
> /**
> * A {@link ProtocolCodecFactory} that performs encoding and decoding between
> * a text line data and a Java string object. This codec is useful especially
> @@ -34,34 +36,67 @@
> * @author The Apache MINA Project (dev@mina.apache.org)
> * @version $Rev$, $Date$
> */
> -public class TextLineCodecFactory implements ProtocolCodecFactory {
> +public class TextLineCodecFactory implements ProtocolCodecFactory
> +{
> private final TextLineEncoder encoder;
>
> private final TextLineDecoder decoder;
>
> +
> /**
> * Creates a new instance with the current default {@link Charset}.
> */
> - public TextLineCodecFactory() {
> - this(Charset.defaultCharset());
> + public TextLineCodecFactory()
> + {
> + this( Charset.defaultCharset() );
> }
>
> +
> /**
> - * Creates a new instance with the specified {@link Charset}.
> + * Creates a new instance with the specified {@link Charset}. The
> + * encoder uses a UNIX {@link LineDelimeter} and the decoder uses
> + * the AUTO {@link LineDelimeter}.
> + *
> + * @param charset
> + * The charset to use in the encoding and decoding
> */
> - public TextLineCodecFactory(Charset charset) {
> - encoder = new TextLineEncoder(charset, LineDelimiter.UNIX);
> - decoder = new TextLineDecoder(charset, LineDelimiter.AUTO);
> + public TextLineCodecFactory( Charset charset )
> + {
> + encoder = new TextLineEncoder( charset, LineDelimiter.UNIX );
> + decoder = new TextLineDecoder( charset, LineDelimiter.AUTO );
> }
>
> - public ProtocolEncoder getEncoder() {
> +
> + /**
> + * Creates a new instance of TextLineCodecFactory. This constructor
> + * provides more flexibility for the developer.
> + *
> + * @param charset
> + * The charset to use in the encoding and decoding
> + * @param encodingDelimiter
> + * The line delimeter for the encoder
> + * @param decodingDelimiter
> + * The line delimeter for the decoder
> + */
> + public TextLineCodecFactory( Charset charset, LineDelimiter encodingDelimiter, LineDelimiter decodingDelimiter )
> + {
> + encoder = new TextLineEncoder( charset, encodingDelimiter );
> + decoder = new TextLineDecoder( charset, decodingDelimiter );
> + }
> +
> +
> + public ProtocolEncoder getEncoder()
> + {
> return encoder;
> }
>
> - public ProtocolDecoder getDecoder() {
> +
> + public ProtocolDecoder getDecoder()
> + {
> return decoder;
> }
>
> +
> /**
> * Returns the allowed maximum size of the encoded line.
> * If the size of the encoded line exceeds this value, the encoder
> @@ -70,10 +105,12 @@
> * <p>
> * This method does the same job with {@link TextLineEncoder#getMaxLineLength()}.
> */
> - public int getEncoderMaxLineLength() {
> + public int getEncoderMaxLineLength()
> + {
> return encoder.getMaxLineLength();
> }
>
> +
> /**
> * Sets the allowed maximum size of the encoded line.
> * If the size of the encoded line exceeds this value, the encoder
> @@ -82,10 +119,12 @@
> * <p>
> * This method does the same job with {@link TextLineEncoder#setMaxLineLength(int)}.
> */
> - public void setEncoderMaxLineLength(int maxLineLength) {
> - encoder.setMaxLineLength(maxLineLength);
> + public void setEncoderMaxLineLength( int maxLineLength )
> + {
> + encoder.setMaxLineLength( maxLineLength );
> }
>
> +
> /**
> * Returns the allowed maximum size of the line to be decoded.
> * If the size of the line to be decoded exceeds this value, the
> @@ -94,10 +133,12 @@
> * <p>
> * This method does the same job with {@link TextLineDecoder#getMaxLineLength()}.
> */
> - public int getDecoderMaxLineLength() {
> + public int getDecoderMaxLineLength()
> + {
> return decoder.getMaxLineLength();
> }
>
> +
> /**
> * Sets the allowed maximum size of the line to be decoded.
> * If the size of the line to be decoded exceeds this value, the
> @@ -106,7 +147,8 @@
> * <p>
> * This method does the same job with {@link TextLineDecoder#setMaxLineLength(int)}.
> */
> - public void setDecoderMaxLineLength(int maxLineLength) {
> - decoder.setMaxLineLength(maxLineLength);
> + public void setDecoderMaxLineLength( int maxLineLength )
> + {
> + decoder.setMaxLineLength( maxLineLength );
> }
> }
>
>
>
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6