private ArrayList<Integer> writeTileData(IFD ifd) throws IOException {
    ArrayList<Integer> newTileOffsets = new ArrayList<Integer>();
    IfdTags metadata = ifd.getMetadata();
    TagValue tileOffsets = metadata.get(324);
    TagValue tileSizes = metadata.get(325);
    for (int i = 0; i < tileOffsets.getCardinality(); i++) {
      int pos = (int) data.position();
      if (pos % 2 != 0) {
        // Correct word alignment
        data.put((byte) 0);
        pos = (int) data.position();
      }
      newTileOffsets.add(pos);
      this.input.seekOffset(tileOffsets.getValue().get(i).toInt());
      for (int j = 0; j < tileSizes.getValue().get(i).toInt(); j++) {
        byte v = this.input.readDirectByte();
        data.put(v);
      }
      if (data.position() % 2 != 0) {
        // Correct word alignment
        data.put((byte) 0);
      }
    }
    return newTileOffsets;
  }
private ArrayList < Integer > writeTileData ( IFD ifd ) throws IOException { ArrayList < Integer > newTileOffsets = new ArrayList < Integer > ( ) ; IfdTags metadata = ifd . getMetadata ( ) ; TagValue tileOffsets = metadata . get ( 324 ) ; TagValue tileSizes = metadata . get ( 325 ) ; for ( int i = 0 ; i < tileOffsets . getCardinality ( ) ; i ++ ) { int pos = ( int ) data . position ( ) ; if ( pos % 2 != 0 ) { data . put ( ( byte ) 0 ) ; pos = ( int ) data . position ( ) ; } newTileOffsets . add ( pos ) ; this . input . seekOffset ( tileOffsets . getValue ( ) . get ( i ) . toInt ( ) ) ; for ( int j = 0 ; j < tileSizes . getValue ( ) . get ( i ) . toInt ( ) ; j ++ ) { byte v = this . input . readDirectByte ( ) ; data . put ( v ) ; } if ( data . position ( ) % 2 != 0 ) { data . put ( ( byte ) 0 ) ; } } return newTileOffsets ; }
Write tile data.

@param ifd the ifd
@return the array list
@throws IOException Signals that an I/O exception has occurred.