public static void main(String[] args)  {
		if (args.length != 1) {
			System.out.println("This simple demo utility must be called with a JPEG file. For example:");
			System.out.println("    bin/jpegLister.sh myWonderfulJpegFile.jpg");
			return;
		}

        JpegData parser = new JpegData();
		try {
			RandomAccessFile file = new RandomAccessFile(args[0], "r");
			try {
				parser.read(file);
			} catch (Exception e) {
				System.out.println("EXCEPTION: " + e);
				e.printStackTrace();
			}
			if ( ! parser.isValid()) {
				System.out.println("INVALID FILE: " + args[0]);
				for (Exception e : parser.validate()) {
					System.out.println("PROBLEM: " + e.getMessage());
				}
			}
			for (DataItem item : parser) {
				if (item instanceof Marker) {
					Marker base = (Marker) item;
					System.out.println("Marker: " + base.getClass().getSimpleName() + " - " + base.getMarkerId());
					if (base instanceof ComSegment) {
						ComSegment segment = (ComSegment) base;
						String s = segment.getStringComment();
						System.out.println("\t\tComment: " + s);
					}
				} else if (item instanceof EntropyData) {
				//	System.out.println("        Entropy data (" + ((EntropyData)item).getData().length + " bytes)");
				}
			}
		} catch (Exception ex) {
			System.out.println("EXCEPTION: " + ex);
			ex.printStackTrace();
		}
    }