Code example for ObjectOutputStream

Methods: flushresetwriteObject

0
        ObjectOutputStream oout = this.oout;
        if (resetInterval != 0) {
            // Resetting will prevent OOM on the receiving side. 
            writtenObjects ++;
            if (writtenObjects % resetInterval == 0) {
                oout.reset();
 
                // Also discard the byproduct to avoid OOM on the sending side. 
                buffer.discardReadBytes();
            } 
        } 
        oout.writeObject(msg);
        oout.flush();
 
        ChannelBuffer encoded = buffer.readBytes(buffer.readableBytes());
        return encoded;
    } 
 
    private ChannelBuffer buffer(ChannelHandlerContext ctx) throws Exception {
        ChannelBuffer buf = buffer.get();
Stop searching for code, let great code find you!  Add Codota to your java IDE