package cafe.test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import cafe.image.tiff.TIFFTweaker;
import cafe.io.FileCacheRandomAccessInputStream;
import cafe.io.FileCacheRandomAccessOutputStream;
import cafe.io.RandomAccessInputStream;
import cafe.io.RandomAccessOutputStream;

import java.io.FileOutputStream;

public class TestTiffMerge {

	public static void main(String[] args) throws FileNotFoundException, IOException {
		FileInputStream is1 = new FileInputStream(args[0]);
		FileInputStream is2 = new FileInputStream(args[1]);
		FileOutputStream out = new FileOutputStream(args[2]);
		RandomAccessInputStream src1 = new FileCacheRandomAccessInputStream(is1);
		RandomAccessInputStream src2 = new FileCacheRandomAccessInputStream(is2);
		RandomAccessOutputStream dest = new FileCacheRandomAccessOutputStream(out);
		TIFFTweaker.mergeTiffImages(src1, src2, dest);
		// Release resources
		src1.close();
		src2.close();
		dest.close();
		is1.close();
		is2.close();
		out.close();
	}
}
@@ -32,27 +32,16 @@
 .io.File
-InputStream
 ;%0Aimport
@@ -141,57 +141,8 @@
 er;%0A
-import cafe.io.FileCacheRandomAccessInputStream;%0A
 impo
@@ -191,48 +191,8 @@
 am;%0A
-import cafe.io.RandomAccessInputStream;%0A
 impo
@@ -387,536 +387,242 @@
 File
-InputStream is1 = new FileInputStream(args%5B0%5D);%0A%09%09FileInputStream is2 = new FileInputStream(args%5B1%5D);%0A%09%09FileOutputStream out = new FileOutputStream(args%5B2%5D);%0A%09%09RandomAccessInputStream src1 = new FileCacheRandomAccessInputStream(is1);%0A%09%09RandomAccessInputStream src2 = new FileCacheRandomAccessInputStream(is2);%0A%09%09RandomAccessOutputStream dest = new FileCacheRandomAccessOutputStream(out);%0A%09%09TIFFTweaker.mergeTiffImages(src1, src2, dest);%0A%09%09// Release resources%0A%09%09src1.close();%0A%09%09src2.close();%0A%09%09dest.close();%0A%09%09is1.close();%0A%09%09is2
+OutputStream out = new FileOutputStream(args%5B2%5D);%0A%09%09RandomAccessOutputStream dest = new FileCacheRandomAccessOutputStream(out);%0A%09%09TIFFTweaker.mergeTiffImagesEx(dest, new File(args%5B0%5D), new File(args%5B1%5D));%0A%09%09// Release resources%0A%09%09dest
 .clo

Test merge with mergeTiffImagesEx