@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 ) 
        {
            
            buffout = (FSTOutputStream) conf.getCachedObject(FSTOutputStream.class);
            if ( buffout == null ) 
                buffout = new FSTOutputStream(1000, outstream);
            else
                buffout.reset(); 
        }
        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