本文整理汇总了Java中org.apache.mina.filter.codec.ProtocolEncoder类的典型用法代码示例。如果您正苦于以下问题:Java ProtocolEncoder类的具体用法?Java ProtocolEncoder怎么用?Java ProtocolEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProtocolEncoder类属于org.apache.mina.filter.codec包,在下文中一共展示了ProtocolEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test1
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Test
public void test1 () throws Exception
{
final DataGenerator dg = new DataGenerator ( new HashSet<String> ( Arrays.asList ( "AVG", "MIN", "MAX" ) ), 1200 );
final UpdateQueryData message = dg.createData ();
final ProtocolEncoder encoder = new ObjectSerializationEncoder ();
testEncoder ( encoder, message );
}
示例2: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception
{
if(mProtocolEncoder == null)
{
mProtocolEncoder = new IcecastEncoder();
}
return mProtocolEncoder;
}
示例3: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception
{
if(mEncoder == null)
{
mEncoder = new UltravoxEncoder();
}
return mEncoder;
}
示例4: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
MinaEncoder minaEncoder = null;
Object value = session.getAttribute(ENCODER_ATTRIBUTE);
if (value != null && value instanceof MinaEncoder)
minaEncoder = (MinaEncoder) value;
if (minaEncoder == null) {
minaEncoder = new MinaEncoder(codecFactory.getEncoder());
session.setAttribute(ENCODER_ATTRIBUTE, minaEncoder);
}
return minaEncoder;
}
示例5: filterWrite
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception {
Object message = writeRequest.getMessage();
ProtocolEncoder encoder = getEncoder(session);
ProtocolEncoderOutput encoderOut = new DirectOutput(session, nextFilter, writeRequest);
try {
encoder.encode(session, message, encoderOut);
nextFilter.filterWrite(session, new EndOfMessage(writeRequest));
} catch (ProtocolEncoderException e) {
throw e;
} catch (Throwable t) {
throw new ProtocolEncoderException(t);
}
}
示例6: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public ProtocolEncoder getEncoder(IoSession arg0) throws Exception {
return encoder;
}
示例7: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return msgEncoder;
}
示例8: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
public ProtocolEncoder getEncoder() {
return encoder;
}
示例9: ModbusRtuProtocolCodecFilter
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
public ModbusRtuProtocolCodecFilter ( final ProtocolEncoder encoder, final ModbusRtuDecoder decoder )
{
super ( encoder, decoder );
this.decoder = decoder;
}
示例10: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
public ProtocolEncoder getEncoder(IoSession session) {
return encoder;
}
示例11: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return encoder;
}
示例12: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return encoder;
}
示例13: testEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
private void testEncoder ( final ProtocolEncoder encoder, final Object message ) throws Exception
{
final TestingOutput output = new TestingOutput ();
encoder.encode ( null, message, output );
System.out.println ( String.format ( "Encoder %s: %s bytes", encoder, output.getSize () ) );
}
示例14: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
public ProtocolEncoder getEncoder() throws Exception {
return encoder;
}
示例15: getEncoder
import org.apache.mina.filter.codec.ProtocolEncoder; //导入依赖的package包/类
@Override
public ProtocolEncoder getEncoder() throws Exception {
return encoder;
}