src/main/java/org/nustaq/serialization/coders/FSTStreamEncoder.java
@Override
    public void setOutstream(OutputStream outstream) {
        if ( buffout == null ) 
        {
            // try reuse
            buffout = (FSTOutputStream) conf.getCachedObject(FSTOutputStream.class);
            if ( buffout == null ) // if fail, alloc
                buffout = new FSTOutputStream(1000, outstream);
            else
                buffout.reset(); // reset resued fstoutput
        }
        if ( outstream == null )
            buffout.setOutstream(buffout);
        else
            buffout.setOutstream(outstream);
    }
@Override
    public void setOutstream(OutputStream outstream) {
        if ( buffout == null ) 
        {
            // try reuse
            buffout = (FSTOutputStream) conf.getCachedObject(FSTOutputStream.class);
            if ( buffout == null ) // if fail, alloc
                buffout = new FSTOutputStream(1000, outstream);
            else
                buffout.reset(); // reset resued fstoutput
        }
        if ( outstream == null )
            buffout.setOutstream(buffout);
        else
            buffout.setOutstream(outstream);
    }
@ Override public void setOutstream ( OutputStream outstream ) { if ( buffout == null ) { // try reuse buffout = ( FSTOutputStream ) conf . getCachedObject ( FSTOutputStream . class ) ; if ( buffout == null ) // if fail, alloc buffout = new FSTOutputStream ( 1000 , outstream ) ; else buffout . reset ( ) ; // reset resued fstoutput } if ( outstream == null ) buffout . setOutstream ( buffout ) ; else buffout . setOutstream ( outstream ) ; }
if output stream is null, just encode into a byte array
@param outstream
if output stream is null just encode into a byte array