public void write ( long record , int column , byte [ ] bytes ) throws IOException { if ( readonly ) { throw new UnsupportedOperationException ( RO_MSG ) ; } // (+ recordSize) allows skipping metadata record long pos = record * recordSize + recordSize ; int i = 0 ; for ( ; i < column ; i ++ ) { pos += columns [ i ] . size ; } if ( pos >= size ) { final String fmt = "bad seek to position: %d (size is %d)" ; final String msg = format ( fmt , pos , size ) ; throw new InvalidArgument ( msg ) ; } Column < ? > c = columns [ i ] ; if ( bytes . length != c . size ) { final String fmt = "invalid write of %d bytes, expected %d" ; final String msg = format ( fmt , bytes . length , c . size ) ; throw new InvalidArgument ( msg ) ; } raf . seek ( pos ) ; raf . write ( bytes ) ; }
Writes a record for a specific column to this record file overwriting the previous contents .