本文整理汇总了Java中org.apache.mina.filter.codec.textline.LineDelimiter.AUTO属性的典型用法代码示例。如果您正苦于以下问题:Java LineDelimiter.AUTO属性的具体用法?Java LineDelimiter.AUTO怎么用?Java LineDelimiter.AUTO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.mina.filter.codec.textline.LineDelimiter
的用法示例。
在下文中一共展示了LineDelimiter.AUTO属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLineDelimiterParameter
private static LineDelimiter getLineDelimiterParameter(TextLineDelimiter delimiter) {
if (delimiter == null) {
return LineDelimiter.DEFAULT;
}
switch (delimiter) {
case DEFAULT:
return LineDelimiter.DEFAULT;
case AUTO:
return LineDelimiter.AUTO;
case UNIX:
return LineDelimiter.UNIX;
case WINDOWS:
return LineDelimiter.WINDOWS;
case MAC:
return LineDelimiter.MAC;
default:
throw new IllegalArgumentException("Unknown textline delimiter: " + delimiter);
}
}
示例2: getLineDelimiterParameter
private static LineDelimiter getLineDelimiterParameter(Mina2TextLineDelimiter delimiter) {
if (delimiter == null) {
return LineDelimiter.DEFAULT;
}
switch (delimiter) {
case DEFAULT:
return LineDelimiter.DEFAULT;
case AUTO:
return LineDelimiter.AUTO;
case UNIX:
return LineDelimiter.UNIX;
case WINDOWS:
return LineDelimiter.WINDOWS;
case MAC:
return LineDelimiter.MAC;
default:
throw new IllegalArgumentException("Unknown textline delimiter: " + delimiter);
}
}
示例3: MinaCubeClient
public MinaCubeClient(String hostname, int port) {
this.hostname = hostname;
this.port = port;
connector = new NioSocketConnector(1);
connector.setConnectTimeoutMillis(2000);
connector.getFilterChain().addLast("logger", new LoggingFilter());
TextLineCodecFactory codecFactory = new TextLineCodecFactory(UTF_8, LineDelimiter.CRLF, LineDelimiter.AUTO);
codecFactory.setDecoderMaxLineLength(4096);
codecFactory.setEncoderMaxLineLength(4096);
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(codecFactory));
handler = new ConnectHandler();
connector.setHandler(handler);
}
示例4: TextLineConsumer
/**
* Creates a new instance with the specified <tt>charset</tt>
* the specified <tt>delimiter</tt> and the specified
* {@link IoFilterCodec}. Delimiter
* {@link LineDelimiter#AUTO} is not allowed.
*/
public TextLineConsumer( Charset charset, LineDelimiter delimiter, IoFilterCodec codec )
{
if( charset == null )
{
throw new NullPointerException( "charset" );
}
if( delimiter == null )
{
throw new NullPointerException( "delimiter" );
}
if( delimiter == LineDelimiter.AUTO )
{
throw new IllegalArgumentException("LineDelimiter.AUTO is not allowed");
}
this.codec = codec;
// Convert delimiter to ByteBuffer.
delimBuf = IoBuffer.allocate( 2 ).setAutoExpand( true );
try
{
delimBuf.putString( delimiter.getValue(), charset.newEncoder() );
}
catch (CharacterCodingException e)
{
throw new RuntimeException(e);
}
delimBuf.flip();
}
示例5: TextLineDecoder
/**
* Creates a new instance with the current default {@link Charset} and
* {@link LineDelimiter#AUTO} delimiter.
*/
public TextLineDecoder() {
this(LineDelimiter.AUTO);
}
示例6: TextLineCodecFactory
/**
* Creates a new instance with the specified {@link Charset}. The encoder uses
* a UNIX {@link LineDelimiter} and the decoder uses the AUTO
* {@link LineDelimiter}.
*
* @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);
}