Requirements: Part#2 - AhmadBadir/Downloader GitHub Wiki

Problem description update

After you implemented the Multipart.openStream, where the openStream( url ) method of the API returns an InputStream for reading from the multipart stream; the GUI (attached) offers a text field and an adjacent button marked Start. The user enters a URL in the text field pointing to a manifest stream (which may be local or on another machine) and clicks on the button. The application then downloads the stream part-by-part. If the stream results in a single finite file, the file is downloaded in its entirety and then displayed in the window. The GUI also supports (potentially endless) file-sequence streams, described below. Each file in these sequences is downloaded and displayed in succession, creating, for example, an image animation or textual progression. The Step button downloads and displays the next file in a sequence stream, and the Animate slider controls automatic stepping, for example to watch an animated sequence of image files. In order for the GUI to function as expected you are required to implement the following in your project

  1. If the url input for the Multipart.openStream is NOT a .segments file then the url will be downloaded as one single file and returned by openstream as a stream.
  2. The file-sequence streams that the GUI also handles is also a multipart download the only difference is that each part in the sequence is full file (e.g. one image as a part of an animation). In order to enable the GUI of handling the streams you need to do two things a. DO NOT CHANGE Multipart class because regarding this class it always returns one stream b. Implement a new class FileSequenceReader that has the method readOneFile(InputStream squence) that returns Returns the data from the next sub-file in the given file sequence stream. sequence files consist of a (4-byte) int giving the size of the sub-file, followed by the sub-file, followed by another size, followed by the sub-file, and so on until EOF Example: the file http://...... / image.jpg.segments contains http://...... / image.jpg.part1 ** http://...... / image.jpg.part2 ** http://...... / image.jpg.part3 this stream will be one image file image.jpg the file-sequence file the file http://...... / image.jpg-seq.segments contains http://...... / image1.jpg-seq ** http://...... / image2.jpg-seq ** http://...... / image3.jpg-seq this stream will be the combination of three image files that can be displayed sequentially as an animation. *Also you need to implement one of the attached compression algorithms if the downloaded file is an image file. Please note: the GUI code does the job of distinguishing file-sequence streams from normal streams. You job is to implement the FileSequenceReader class to help the GUI display it correctly. You can review the attached code to learn how the different classes work together. Please follow the function protoypes in the attached files A variety of failures can occur, and it will be up to you to figure out what they are and decide how they should be handled. Feel free to modify the attached GUI to handle any failures you may discover.