本文整理匯總了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;
}