Example usage for io.netty.handler.codec.serialization ObjectEncoderOutputStream ObjectEncoderOutputStream

List of usage examples for io.netty.handler.codec.serialization ObjectEncoderOutputStream ObjectEncoderOutputStream

Introduction

In this page you can find the example usage for io.netty.handler.codec.serialization ObjectEncoderOutputStream ObjectEncoderOutputStream.

Prototype

public ObjectEncoderOutputStream(OutputStream out) 

Source Link

Document

Creates a new ObjectOutput with the estimated length of 512 bytes.

Usage

From source file:de.sanandrew.core.manpack.util.javatuples.Tuple.java

License:Apache License

public static void writeToByteBufStream(Tuple tuple, ByteBufOutputStream stream) {
    try (ObjectEncoderOutputStream oeos = new ObjectEncoderOutputStream(stream)) {
        oeos.writeObject(tuple);/*w w w . java2  s.co m*/
    } catch (IOException ex) {
        ManPackLoadingPlugin.MOD_LOG.log(Level.ERROR, "Cannot serialize Tuple!", ex);
    }
}

From source file:de.sanandrew.mods.sanlib.lib.Tuple.java

License:Creative Commons License

/**
 * Serializes this Tuple and writes it into an OutputStream via an {@link ObjectEncoderOutputStream}.
 * @param stream The OutputStream this Tuple should be written in.
 *//*from  ww w .  j a v  a  2 s . c o m*/
public void writeToStream(OutputStream stream) {
    try (ObjectEncoderOutputStream oeos = new ObjectEncoderOutputStream(stream)) {
        oeos.writeObject(this);
    } catch (IOException ex) {
        SanLib.LOG.log(Level.ERROR, "Cannot serialize Tuple!", ex);
    }
}