/** @param args */ public static void main(String[] args) { if (args.length != 1) { System.out.println("usage:\nXPMFile <file>"); } try { String out = args[0].substring(0, args[0].indexOf(".")) + ".raw"; XPMFile file = XPMFile.load(args[0]); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(out))); bos.write(file.getBytes()); bos.close(); // showResult(file.getBytes()); } catch (Exception e) { e.printStackTrace(); } }
/** * Loads the XPM file * * @param is InputStream to read file from * @return XPMFile loaded, or exception */ public static XPMFile load(InputStream is) { XPMFile xFile = new XPMFile(); xFile.readImage(is); return xFile; }