public TextLineEncoder( Charset charset, LineDelimiter delimiter ) { if( charset == null ) { throw new NullPointerException( "charset" ); } if( delimiter == null ) { throw new NullPointerException( "delimiter" ); } if( LineDelimiter.AUTO.equals( delimiter ) ) { throw new IllegalArgumentException( "AUTO delimiter is not allowed for encoder." ); } this.charset = charset; this.delimiter = delimiter; }
/** * Creates a new instance with the specified <tt>charset</tt> * and the specified <tt>delimiter</tt>. * * @param charset The {@link Charset} to use * @param delimiter The line delimiter to use */ public TextLineEncoder(Charset charset, LineDelimiter delimiter) { if (charset == null) { throw new IllegalArgumentException("charset"); } if (delimiter == null) { throw new IllegalArgumentException("delimiter"); } if (LineDelimiter.AUTO.equals(delimiter)) { throw new IllegalArgumentException("AUTO delimiter is not allowed for encoder."); } this.charset = charset; this.delimiter = delimiter; }
/** * Creates a new instance with the spcified <tt>charset</tt> * and the specified <tt>delimiter</tt>. */ public TcpIpTextLineEncoder(final Charset charset, final LineDelimiter delimiter) { if (charset == null) { throw new IllegalArgumentException("charset"); } if (delimiter == null) { throw new IllegalArgumentException("delimiter"); } if (LineDelimiter.AUTO.equals(delimiter)) { throw new IllegalArgumentException( "AUTO delimiter is not allowed for encoder."); } this.charset = charset; //this.delimiter = delimiter; }
/** * Creates a new instance with the spcified <tt>charset</tt> * and the specified <tt>delimiter</tt>. */ public TextLineEncoder(Charset charset, LineDelimiter delimiter) { if (charset == null) { throw new NullPointerException("charset"); } if (delimiter == null) { throw new NullPointerException("delimiter"); } if (LineDelimiter.AUTO.equals(delimiter)) { throw new IllegalArgumentException( "AUTO delimiter is not allowed for encoder."); } this.charset = charset; this.delimiter = delimiter; }
/** * Creates a new instance with the specified <tt>charset</tt> * and the specified <tt>delimiter</tt>. * * @param charset The {@link Charset} to use * @param delimiter The line delimiter to use */ public TextLineEncoder(Charset charset, LineDelimiter delimiter) { if (charset == null) { throw new IllegalArgumentException("charset"); } if (delimiter == null) { throw new IllegalArgumentException("delimiter"); } if (LineDelimiter.AUTO.equals(delimiter)) { throw new IllegalArgumentException("AUTO delimiter is not allowed for encoder."); } this.charset = charset; this.delimiter = delimiter; }
public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { Context ctx = getContext(session); if (LineDelimiter.AUTO.equals(delimiter)) { decodeAuto(ctx, session, in, out); } else { decodeNormal(ctx, session, in, out); } }
/** * {@inheritDoc} */ @Override public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { Context ctx = getContext(session); if (LineDelimiter.AUTO.equals(delimiter)) { decodeAuto(ctx, session, in, out); } else { decodeNormal(ctx, session, in, out); } }
/** * {@inheritDoc} */ @Override public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { Context ctx = getContext(session); if (LineDelimiter.AUTO.equals(delimiter)) { decodeAuto(ctx, session, in, out); } else { decodeNormal(ctx, session, in, out); } }
public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out ) throws Exception { Context ctx = getContext(session); if( LineDelimiter.AUTO.equals( delimiter ) ) { ctx.setMatchCount( decodeAuto( in, ctx.getBuffer(), ctx.getMatchCount(), ctx.getDecoder(), out ) ); } else { ctx.setMatchCount( decodeNormal( in, ctx.getBuffer(), ctx.getMatchCount(), ctx.getDecoder(), out ) ); } }