public int rawContentsTo ( Writer w ) throws IOException { // Let's first see if we have created helper objects: if ( mResultArray != null ) { w . write ( mResultArray ) ; return mResultArray . length ; } if ( mResultString != null ) { w . write ( mResultString ) ; return mResultString . length ( ) ; } // Do we use shared array? if ( mInputStart >= 0 ) { if ( mInputLen > 0 ) { w . write ( mInputBuffer , mInputStart , mInputLen ) ; } return mInputLen ; } // Nope, need to do full segmented output int rlen = 0 ; if ( mSegments != null ) { for ( int i = 0 , len = mSegments . size ( ) ; i < len ; ++ i ) { char [ ] ch = mSegments . get ( i ) ; w . write ( ch ) ; rlen += ch . length ; } } if ( mCurrentSize > 0 ) { w . write ( mCurrentSegment , 0 , mCurrentSize ) ; rlen += mCurrentSize ; } return rlen ; }
Method that will stream contents of this buffer into specified Writer .