private void writeData ( boolean close ) throws IOException { if ( pos != 0 && ( close || pos == chunk . length - 1 ) ) { byte [ ] data ; if ( pos != chunk . length - 1 ) { data = new byte [ ( int ) pos + 1 ] ; // we need to adjust the array System . arraycopy ( chunk , 0 , data , 0 , data . length ) ; } else { data = chunk ; } try { mutator . insert ( key , cf , HFactory . createColumn ( chunkPos , data , LongSerializer . get ( ) , BytesArraySerializer . get ( ) ) ) ; } catch ( HectorException e ) { throw new IOException ( "Unable to write data" , e ) ; } chunkPos ++ ; pos = 0 ; } }
Write the data to column if the configured chunk size is reached or if the stream should be closed