public void write(ArrayList<KeyValue> metadata,long imageStart,Raster raster,DataType dataType) throws IOException {
  OutputStream oStream=new FileOutputStream(filePath);
  if (oStream != null) {
    outputStream=new BufferedOutputStream(oStream);
  }
  LabelParser parser=new LabelParser();
  BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(outputStream));
  long size=parser.writeObject(writer,metadata,"");
  long pad=imageStart - size;
  for (int i=0; i < pad; ++i) {
    writer.write(' ');
  }
  writer.flush();
  dataStream=new DataOutputStream(outputStream);
  writeRaster(raster,dataType);
}

public void write ( ArrayList < KeyValue > metadata , long imageStart , Raster raster , DataType dataType ) throws IOException { OutputStream oStream = new FileOutputStream ( filePath ) ; if ( oStream != null ) { outputStream = new BufferedOutputStream ( oStream ) ; } LabelParser parser = new LabelParser ( ) ; BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( outputStream ) ) ; long size = parser . writeObject ( writer , metadata , "" ) ; long pad = imageStart - size ; for ( int i = 0 ; i < pad ; ++ i ) { writer . write ( ' ' ) ; } writer . flush ( ) ; dataStream = new DataOutputStream ( outputStream ) ; writeRaster ( raster , dataType ) ; }
write a raster to a file .
