PA #2: MIMP I/O

Objectives

The purpose of this assignment is to gain experience working with Java I/O and exception handling.

Introduction

Congratulations! MIMP has been a huge commercial success. Your next task is to add some additional functionality related to file I/O. Specifically, you will need to:

Image I/O

The first phase of this project is to design a file format that will allow you to store images to disk. Your file format must be text-based, but beyond that, the layout of your files is entirely up to you. Part of your submission for this project will be a short document describing your file format. You should provide enough information in that document for someone else to implement file I/O methods that could read and write your image files.

Once you have decided on a strategy for storing images to disk, you must update your Image class so that it conforms to the following UML diagram:

Each of the methods highlighted in red are new. No existing methods will need to be modified.

Method Details:

Notes:

  1. The InputStream and OutputStream classes are abstract. We will discuss abstract classes later in the course. For now, you can think of them as a categories of classes rather than as specific classes that can be instantiated directly. Any class in the InputStream category (any subclass of InputStream) may be passed into the first constructor above. For the second and third constructors, the most appropriate type of InputStream to work with with is a FileInputStream. You can find more information on all of these classes in the java.io API.
  2. Java 7 includes a new I/O library: java.nio. This library has some advantages over java.io, but nothing that would be particularly helpful for this assignment. For the sake of keeping everyone on the same page, please do not use java.nio for this project.

GUI Modifications

The second part of this project is to make the necessary modifications to MimpApp.java so that we can read and write .mim files using the graphical application. Files should automatically be saved in the .mim format if they have the .mim file extension.

The file MimpApp.java is fairly large, complicated, and hard to read. (Most of the code in that file was automatically generated by a GUI design tool.) Don't panic! The changes you need to make are relatively minor. Don't worry if you don't understand every line of code. Just do the necessary detective work to figure out what needs to be modified.

The existing implementation of MimpApp.java presents the same error messages if there is any kind of error in reading or writing files. You may stick to that design: you don't need to print different error messages for missing or corrupted files.

Submitting/Grading (Updated 9/12)

Submit four files through Web-CAT by the project deadline:

Your grade will be based on the following factors, and may also be affected by the number of submissions that you make. See below for more details on how each component will be calculated.

Autograding based on correctness/testing: 50%
Instructor grading of GUI functionality: 20%
Instructor grading of .mim design document: 10%
Autograding based on static analysis of style: 10%
Instructor grading based on style and readability: 10%

You do not need to submit your own unit tests for this project. Your code will be tested against instructor provided unit tests.

Autograding based on static analysis of style

Web-CAT will use checkstyle to analyze your code for conformance to the course style guide. I strongly suggest that you to install checkstyle for Eclipse on your own machine so that you can run your own style checks before submission. You can find the checkstyle configuration file that Web-CAT will use on the course supplemental material page.

Instructor grading based on style and readability

This portion of your grade will based on stylistic issues that cannot be checked automatically. This includes:

Submission penalties

Your grade will also be based on the number of submissions that you make. You may make up to six submissions with no penalty. Your grade will then be reduced by 3% after every six submissions:

Number of submissions Penalty
1-6 0
7-12 -3%
13-18 -6%
... ...