puts and gets PixeledImages.
Examples
Write to an image repository
// Make a Pixeled Image
PixeledImage pi = new PixeledImage(100,200);
// Define a place to keep images. This one is in your home direectory.
String irName = (new File(System.getProperty("user.home"), "goodImages")).getAbsolutePath();
// Set up the image repository
ImageRepository ir = new ImageRepository(irName);
// Pick a file name and write.
String fileName = "par1.fit"; // file name
boolean overwrite = true; // overwrite a file with the same name if it is there
ir.putPixeledImage(fileName, pi, overwrite);
Read from an image repository
// Define a place where the images are
String irName = (new File(System.getProperty("user.home"), "goodImages")).getAbsolutePath();
// Set up the image repository
ImageRepository ir = new ImageRepository(irName);
// Pick a file name and get the image.
String fileName = "par1.fit"; // file name
PixeledImage pi = ir.getPixeledImage(fileName);
Discover what is in a repository
// Define a place where the images are
String irName = (new File(System.getProperty("user.home"), "goodImages")).getAbsolutePath();
// Set up the image repository
ImageRepository ir = new ImageRepository(irName);
// Inventory
int verbosity = 2; // This will print out each file name with its size in bytes
HashMap hm = ir.inventory(verbosity);
// Dig out useful numbers from the HashMap
int nFiles = ((Integer) hm.get("nFiles")).intValue();
int nBytes = ((Integer) hm.get("nBytes")).intValue();
Manage a group of image repositories
// This reads in the repository names from the file
// new File(System.getProperty("user.home"), ".ImageRepositoryManager")
ImageRepositoryManager rm = new ImageRepositoryManager();
// Add another repository to the the list of repositories to be managed
String newIrName = "whatever";
rm.addRepository(newIrName);
// Write a PixeledImage to the first image repository on the list
rm.putPixeledImage("one.fit", pi1, true);
// Read a PixeledImage from the image repository manager.
// Use the first image repository that has a file of the same name.
PixeledImage pi1Copy = rm.getPixeledImage("one.fit");
// Or, if you think one.fit might be in more than one image repository, specify which one to use
PixeledImage pi1Copy2 = rm.getPixeledImage("ImageRepositoryName", "one.fit");
// Get a listing of what is where
HashMap = rm.inventory();