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 [EMAIL PROTECTED] 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 ([EMAIL PROTECTED])
* @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 [EMAIL PROTECTED]
Charset}.
*/
- public TextLineCodecFactory() {
- this(Charset.defaultCharset());
+ public TextLineCodecFactory()
+ {
+ this( Charset.defaultCharset() );
}
+
/**
- * Creates a new instance with the specified [EMAIL PROTECTED] Charset}.
+ * Creates a new instance with the specified [EMAIL PROTECTED] Charset}.
The
+ * encoder uses a UNIX [EMAIL PROTECTED] LineDelimeter} and the decoder
uses
+ * the AUTO [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
TextLineDecoder#setMaxLineLength(int)}.
*/
- public void setDecoderMaxLineLength(int maxLineLength) {
- decoder.setMaxLineLength(maxLineLength);
+ public void setDecoderMaxLineLength( int maxLineLength )
+ {
+ decoder.setMaxLineLength( maxLineLength );
}
}