Java Code Examples for org.jboss.marshalling.Marshalling#getProvidedMarshallerFactory()

The following examples show how to use org.jboss.marshalling.Marshalling#getProvidedMarshallerFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractMarshallingTest.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void checkSupported() throws Throwable {
    Throwable error = null;
    try {
        Marshalling.getProvidedMarshallerFactory(SERIAL_FACTORY);
    } catch (Throwable cause) {
        // This may fail on Java 9+ depending on which command-line arguments are used when building.
        if (PlatformDependent.javaVersion() < 9) {
            throw cause;
        }
        error = cause;
    }
    Assume.assumeNoException(error);
}
 
Example 2
Source File: MarshallingCodeCFactory.java    From netty-custom-protocol with MIT License 5 votes vote down vote up
/**
   * 创建Jboss Marshaller编码对象
   * @return Marshaller
   * @throws IOException 
   */
  public static Marshaller buildMarshalling() throws IOException {
  	//首先通过Marshalling工具类的精通方法获取Marshalling实例对象 参数serial标识创建的是java序列化工厂对象。
final MarshallerFactory marshallerFactory = Marshalling.getProvidedMarshallerFactory("serial");
//创建了MarshallingConfiguration对象,配置了版本号为5 
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
return marshaller;
  }
 
Example 3
Source File: MarshallingCodeCFactory.java    From netty-custom-protocol with MIT License 5 votes vote down vote up
/**
   * 创建Jboss Unmarshaller解码对象
   * @return Unmarshaller
   * @throws IOException 
   */
  public static Unmarshaller buildUnMarshalling() throws IOException {
final MarshallerFactory marshallerFactory = Marshalling.getProvidedMarshallerFactory("serial");
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(configuration);
return unmarshaller;
  }
 
Example 4
Source File: MarshallingCodeCFactory.java    From fileserver with Apache License 2.0 5 votes vote down vote up
/**
    * 创建Jboss Marshalling解码器MarshallingDecoder
    * 
    * @return
    */
   public static MarshallingDecoder buildMarshallingDecoder() {
final MarshallerFactory marshallerFactory = Marshalling
	.getProvidedMarshallerFactory("serial");
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
UnmarshallerProvider provider = new DefaultUnmarshallerProvider(
	marshallerFactory, configuration);
MarshallingDecoder decoder = new MarshallingDecoder(provider, 1024*1024*10);
return decoder;
   }
 
Example 5
Source File: MarshallingCodeCFactory.java    From fileserver with Apache License 2.0 5 votes vote down vote up
/**
    * 创建Jboss Marshalling编码器MarshallingEncoder
    * 
    * @return
    */
   public static MarshallingEncoder buildMarshallingEncoder() {
final MarshallerFactory marshallerFactory = Marshalling
	.getProvidedMarshallerFactory("serial");
final MarshallingConfiguration configuration = new MarshallingConfiguration();
configuration.setVersion(5);
MarshallerProvider provider = new DefaultMarshallerProvider(
	marshallerFactory, configuration);
MarshallingEncoder encoder = new MarshallingEncoder(provider);
return encoder;
   }
 
Example 6
Source File: MarshallingCodec.java    From redisson with Apache License 2.0 5 votes vote down vote up
public MarshallingCodec(Protocol protocol, MarshallingConfiguration configuration) {
    this.factory = Marshalling.getProvidedMarshallerFactory(protocol.toString().toLowerCase());
    if (factory == null) {
        throw new IllegalArgumentException(protocol.toString());
    }
    if (configuration == null) {
        configuration = createConfig();
    }
    this.configuration = configuration;
}
 
Example 7
Source File: RiverCompatibleMarshallingDecoderTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory(RIVER_FACTORY);
}
 
Example 8
Source File: RiverCompatibleMarshallingEncoderTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory(RIVER_FACTORY);
}
 
Example 9
Source File: SerialCompatibleMarshallingEncoderTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory(SERIAL_FACTORY);
}
 
Example 10
Source File: SerialCompatibleMarshallingDecoderTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory(SERIAL_FACTORY);
}
 
Example 11
Source File: RiverCompatibleMarshallingDecoderTest.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory("river");
}
 
Example 12
Source File: RiverCompatibleMarshallingEncoderTest.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory("river");
}
 
Example 13
Source File: SerialCompatibleMarshallingEncoderTest.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory("serial");
}
 
Example 14
Source File: SerialCompatibleMarshallingDecoderTest.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
@Override
protected MarshallerFactory createMarshallerFactory() {
    return Marshalling.getProvidedMarshallerFactory("serial");
}