├── 0072229713_code.zip
├── Capture-(Part 1).JPG
├── Capture-(Part 2).JPG
├── Capture_SUCCESS.JPG
├── manifest.mf
├── Capture_SUCCESS_2.JPG
├── Capture_SUCCESS_3.JPG
├── dist
├── Download_Manager.jar
└── README.TXT
├── Screenshots
├── screenshot_1.png
├── screenshot_2.JPG
└── screenshot_3.JPG
├── nbproject
├── private
│ ├── private.properties
│ └── private.xml
├── genfiles.properties
├── project.xml
├── project.properties
└── build-impl.xml
├── Download Links.txt
├── src
└── download
│ └── manager
│ ├── ProgressRenderer.java
│ ├── DownloadsTableModel.java
│ ├── abc.java
│ ├── Download.java
│ └── DownloadManager.java
├── README.md
└── df
/0072229713_code.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/0072229713_code.zip
--------------------------------------------------------------------------------
/Capture-(Part 1).JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Capture-(Part 1).JPG
--------------------------------------------------------------------------------
/Capture-(Part 2).JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Capture-(Part 2).JPG
--------------------------------------------------------------------------------
/Capture_SUCCESS.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Capture_SUCCESS.JPG
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/Capture_SUCCESS_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Capture_SUCCESS_2.JPG
--------------------------------------------------------------------------------
/Capture_SUCCESS_3.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Capture_SUCCESS_3.JPG
--------------------------------------------------------------------------------
/dist/Download_Manager.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/dist/Download_Manager.jar
--------------------------------------------------------------------------------
/Screenshots/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Screenshots/screenshot_1.png
--------------------------------------------------------------------------------
/Screenshots/screenshot_2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Screenshots/screenshot_2.JPG
--------------------------------------------------------------------------------
/Screenshots/screenshot_3.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nowshad-hasan/Download_Manager/master/Screenshots/screenshot_3.JPG
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\NowshadApu\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties
3 |
--------------------------------------------------------------------------------
/Download Links.txt:
--------------------------------------------------------------------------------
1 | http://vorboss.dl.sourceforge.net/project/codeblocks/Binaries/16.01/Windows/codeblocks-16.01-setup.exe
2 |
3 | http://books.mcgraw-hill.com/downloads/products/0072229713/0072229713_code.zip
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=26d9174a
2 | build.xml.script.CRC32=311b5870
3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=26d9174a
7 | nbproject/build-impl.xml.script.CRC32=0ae71abd
8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
9 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | Download Manager
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | src/download/manager/DownloadManager.java
6 |
7 |
8 | 62
9 |
10 |
11 |
12 |
13 |
14 |
15 | file:/F:/Projects/My%20Projects/Networking%20Lab/Download_Manager/src/download/manager/abc.java
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/download/manager/ProgressRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package download.manager;
7 |
8 | /**
9 | *
10 | * @author NowshadApu
11 | */
12 |
13 | import java.awt.*;
14 | import javax.swing.*;
15 | import javax.swing.table.TableCellRenderer;
16 |
17 | public class ProgressRenderer extends JProgressBar implements TableCellRenderer{
18 |
19 | public ProgressRenderer(int min,int max)
20 |
21 | {
22 | super(min,max);
23 | }
24 |
25 | @Override
26 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
27 |
28 | setValue((int)((Float)value).floatValue());
29 | return this;
30 | }
31 |
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/dist/README.TXT:
--------------------------------------------------------------------------------
1 | ========================
2 | BUILD OUTPUT DESCRIPTION
3 | ========================
4 |
5 | When you build an Java application project that has a main class, the IDE
6 | automatically copies all of the JAR
7 | files on the projects classpath to your projects dist/lib folder. The IDE
8 | also adds each of the JAR files to the Class-Path element in the application
9 | JAR files manifest file (MANIFEST.MF).
10 |
11 | To run the project from the command line, go to the dist folder and
12 | type the following:
13 |
14 | java -jar "Download_Manager.jar"
15 |
16 | To distribute this project, zip up the dist folder (including the lib folder)
17 | and distribute the ZIP file.
18 |
19 | Notes:
20 |
21 | * If two JAR files on the project classpath have the same name, only the first
22 | JAR file is copied to the lib folder.
23 | * Only JAR files are copied to the lib folder.
24 | If the classpath contains other types of files or folders, these files (folders)
25 | are not copied.
26 | * If a library on the projects classpath also has a Class-Path element
27 | specified in the manifest,the content of the Class-Path element has to be on
28 | the projects runtime path.
29 | * To set a main class in a standard Java project, right-click the project node
30 | in the Projects window and choose Properties. Then click Run and enter the
31 | class name in the Main Class field. Alternatively, you can manually type the
32 | class name in the manifest Main-Class element.
33 |
34 |
35 | It is the Jar file of Download Manager . It can parallely download
36 | different parts of the file andmerge those in correct order. I check
37 | it form the link bellow:
38 | http://books.mcgraw-hill.com/downloads/products/0072229713/0072229713_code.zip
39 | But I'm not sure if it works well in the other link or not.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Download_Manager
2 | This project is made for our academic projct of **Networking lab**. It is the project which is described in _Java- The Complete Reference_. But some extra features are added.
3 |
4 | ## Getting Started
5 | **JAVA- The Complete Reference** is one of the nicest books I've ever read for JAVA language by **_Herbert Schildt_**. There is a project in the last chapter named **Download Manager**. It is a nice project but has some limitations. For individual download, it creates a separate thread. But for a particular file download, it uses only one thread. If we can download a file using multiple threads, wouldn't be it nice? That's the project I did in my _Networking Lab_.
6 |
7 | 
8 |
9 | We all know that file is downloaded _byte by byte_. So, I save those bytes from the server in different ArrayList from different threads. After downloading the last byte, I merged those downloaded bytes from ArrayList sequentially. Finally, the **_File to be Downloaded_** is made. Here is the screenshot of those bytes of the downloading file.
10 |
11 | 
12 |
13 | After finishing the download, the file is saved on the destination folder.
14 |
15 | 
16 |
17 | ### Prerequisites
18 | You need to install _JAVA_ for running this project. Please check by typing `java -version` if _JAVA_ is installed or not.
19 |
20 | ### Installation
21 | Go to **_Download_Manager/dist_** folder or click the link https://github.com/nowshad-hasan/Download_Manager/tree/master/dist.
22 | Download the **Download_Manager.jar** file and run `java -jar Download_Manager.jar` in _terminal or cmd_.
23 |
--------------------------------------------------------------------------------
/src/download/manager/DownloadsTableModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package download.manager;
7 |
8 | /**
9 | *
10 | * @author NowshadApu
11 | */
12 |
13 | import java.util.*;
14 | import javax.swing.*;
15 | import javax.swing.table.*;
16 |
17 | public class DownloadsTableModel extends AbstractTableModel implements Observer{
18 |
19 | private static final String[] columnNames={"URL","Size","Progress","Status"};
20 | private static final Class[] columnClasses={String.class,String.class,JProgressBar.class,String.class};
21 | private ArrayList downloadList=new ArrayList();
22 |
23 | public void addDownload(Download download)
24 | {
25 | download.addObserver(this);
26 | downloadList.add(download);
27 | fireTableRowsInserted(getRowCount()-1, getRowCount()-1);
28 | }
29 |
30 | public Download getDownload(int row)
31 | {
32 | return downloadList.get(row);
33 | }
34 |
35 | public void clearDownload(int row)
36 | {
37 | downloadList.remove(row);
38 | fireTableRowsDeleted(row, row);
39 | }
40 |
41 | public int getColumnCount()
42 | {
43 | return columnNames.length;
44 | }
45 |
46 | public String getColumnName(int col)
47 | {
48 | return columnNames[col];
49 |
50 | }
51 |
52 | public Class> getColumnClass(int col)
53 | {
54 | return columnClasses[col];
55 | }
56 |
57 | public int getRowCount()
58 | {
59 | return downloadList.size();
60 | }
61 |
62 | public Object getValueAt(int row,int col)
63 | {
64 | Download download=downloadList.get(row);
65 | switch(col)
66 | {
67 | case 0:
68 | return download.getUrl();
69 |
70 | case 1:
71 | int size= download.getSize();
72 | return (size==-1)? "":Integer.toString(size);
73 |
74 | case 2:
75 | return new Float(download.getProgress());
76 |
77 | case 3:
78 | return Download.STATUSES[download.getStatus()];
79 | }
80 | return "";
81 | }
82 |
83 | public void update(Observable o,Object arg)
84 | {
85 | int index=downloadList.indexOf(o);
86 | fireTableRowsUpdated(index, index);
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/Download_Manager.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | includes=**
31 | jar.compress=false
32 | javac.classpath=
33 | # Space-separated list of extra javac options
34 | javac.compilerargs=
35 | javac.deprecation=false
36 | javac.processorpath=\
37 | ${javac.classpath}
38 | javac.source=1.8
39 | javac.target=1.8
40 | javac.test.classpath=\
41 | ${javac.classpath}:\
42 | ${build.classes.dir}
43 | javac.test.processorpath=\
44 | ${javac.test.classpath}
45 | javadoc.additionalparam=
46 | javadoc.author=false
47 | javadoc.encoding=${source.encoding}
48 | javadoc.noindex=false
49 | javadoc.nonavbar=false
50 | javadoc.notree=false
51 | javadoc.private=false
52 | javadoc.splitindex=true
53 | javadoc.use=true
54 | javadoc.version=false
55 | javadoc.windowtitle=
56 | main.class=download.manager.DownloadManager
57 | manifest.file=manifest.mf
58 | meta.inf.dir=${src.dir}/META-INF
59 | mkdist.disabled=false
60 | platform.active=default_platform
61 | run.classpath=\
62 | ${javac.classpath}:\
63 | ${build.classes.dir}
64 | # Space-separated list of JVM arguments used when running the project.
65 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
66 | # To set system properties for unit tests define test-sys-prop.name=value:
67 | run.jvmargs=
68 | run.test.classpath=\
69 | ${javac.test.classpath}:\
70 | ${build.test.classes.dir}
71 | source.encoding=UTF-8
72 | src.dir=src
73 | test.src.dir=test
74 |
--------------------------------------------------------------------------------
/src/download/manager/abc.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package download.manager;
7 |
8 | import static download.manager.Download.DOWNLOADING;
9 | import java.io.IOException;
10 | import java.io.InputStream;
11 | import java.net.HttpURLConnection;
12 | import java.util.logging.Level;
13 | import java.util.logging.Logger;
14 |
15 | /**
16 | *
17 | * @author NowshadApu
18 | *
19 | * This class is the actual 'function1' which runs in the different thread.And parallel thread is 'Main thread '. The 'Download' class is referenced
20 | * in this class.So, when I change the different values in this class original values in the 'Download' class are also changed.
21 | */
22 |
23 | /*
24 | This class extends thread. that means it runs thread by calling run() method. Here, all value come from Download class .So, I had to be careful if those are
25 | changed accidently in this class.
26 | */
27 | public class abc extends Thread {
28 |
29 | Download d;
30 | int result;
31 |
32 | public abc(Download dd) {
33 |
34 | //Here dd is the reference of original Download object.
35 | d = dd;
36 |
37 | }
38 |
39 | //Now thread starts with the function calling run() .
40 |
41 | public void run() {
42 |
43 | /*
44 | In this function all values are changed in d.(something). That means all changes are kept in Download object.
45 | */
46 |
47 | int flag1 = 0;
48 |
49 | HttpURLConnection connection;
50 | try {
51 |
52 | connection = (HttpURLConnection) d.url.openConnection();
53 | connection.setRequestProperty("Range", "bytes=" + d.downloaded + "-");
54 | connection.connect();
55 | d.stream = connection.getInputStream();
56 | } catch (IOException ex) {
57 | ex.printStackTrace();
58 | }
59 |
60 | while (d.status == DOWNLOADING) {
61 |
62 | try {
63 |
64 | d.read1[d.counter1] = d.stream.read(d.buffer1[d.counter1]);
65 | } catch (IOException ex) {
66 | ex.printStackTrace();
67 | }
68 |
69 | System.out.println("Downloaded from Part 1 " + d.downloaded);
70 |
71 | System.out.println("Read-- Psrt1 " + d.read1[d.counter1] + "\n");
72 | System.out.println("size-downloaded Part1 " + (d.size - d.downloaded));
73 |
74 | if (flag1 == 1) {
75 | d.downloaded = d.size;
76 | }
77 |
78 | if (d.read1[d.counter1] == -1 || (d.size - d.downloaded) == 0) {
79 | System.out.println("It is broken! Part1\n");
80 | break;
81 |
82 | }
83 |
84 | if ((d.size - d.downloaded) <= d.MAX_BUFFER_SIZE) {
85 | flag1 = 1;
86 | }
87 | System.out.println("Bytes from Buffer1 ar (Part 1) ");
88 | for (int i = 0; i < d.buffer1[d.counter1].length; ++i) {
89 | System.out.print(" " + d.buffer1[d.counter1][i] + " ");
90 | }
91 | System.out.print("\n");
92 |
93 | d.downloaded += d.read1[d.counter1];
94 |
95 | ++d.counter1;
96 |
97 | System.out.println("Hiji Biji- Part1 " + d.counter1);
98 | d.stateChanged();
99 | }
100 |
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/src/download/manager/Download.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package download.manager;
7 |
8 | /**
9 | *
10 | * @author NowshadApu
11 | */
12 | import java.io.*;
13 | import java.net.HttpURLConnection;
14 | import java.net.URL;
15 | import java.util.Observable;
16 | import java.util.*;
17 | import java.net.*;
18 | import java.nio.file.Path;
19 |
20 | public class Download extends Observable implements Runnable {
21 |
22 | public static final int MAX_BUFFER_SIZE = 1024;
23 | public static final String STATUSES[] = {"Downloading", "Paused", "Complete", "Cancelled", "Error"};
24 |
25 | public static final int DOWNLOADING = 0;
26 | public static final int PAUSED = 1;
27 | public static final int COMPLETE = 2;
28 | public static final int CANCELLED = 3;
29 | public static final int ERROR = 4;
30 |
31 | public URL url;
32 | public int size;
33 | public int downloaded;
34 | public int status;
35 |
36 | public String fileNameNew;
37 | public int counter1 = 0;
38 |
39 | /*The reason for taking two dimensional byte array is to store the byte arrarys in another array. I don't want to read and write sequentially.
40 | My plan is to read all the byte arrays sequentially or separately and then to write sequentially.
41 | */
42 | byte buffer1[][] = new byte[100000][MAX_BUFFER_SIZE];
43 | byte buffer2[][] = new byte[100000][MAX_BUFFER_SIZE];
44 |
45 | //These two read array are also for storing 'read' information from reading bytes.
46 |
47 | int[] read1 = new int[100000];
48 | int[] read2 = new int[100000];
49 |
50 | public Download(URL url) {
51 | this.url = url;
52 | size = -1;
53 | downloaded = 0;
54 | status = DOWNLOADING;
55 |
56 | download();
57 | }
58 |
59 | public String getUrl() {
60 | return url.toString();
61 | }
62 |
63 | public int getSize() {
64 | return size;
65 | }
66 |
67 | public float getProgress() {
68 | return ((float) downloaded / size) * 100;
69 | }
70 |
71 | public int getStatus() {
72 | return status;
73 | }
74 |
75 | public void pause() {
76 | status = PAUSED;
77 | stateChanged();
78 | }
79 |
80 | public void cancel() {
81 | status = CANCELLED;
82 | stateChanged();
83 | }
84 |
85 | public void resume() {
86 | status = DOWNLOADING;
87 | stateChanged();
88 | download();
89 | }
90 |
91 | public void error() {
92 | status = ERROR;
93 | stateChanged();
94 | }
95 |
96 | public void download() {
97 | Thread thread = new Thread(this);
98 | thread.start();
99 | }
100 |
101 | public String getFileName(URL url) {
102 |
103 | String fileName = url.getFile();
104 | return fileName.substring(fileName.lastIndexOf('/') + 1);
105 |
106 | }
107 | RandomAccessFile file = null;
108 | RandomAccessFile file2 = null;
109 | InputStream stream = null;
110 | InputStream stream2 = null;
111 | int a, b;
112 | abc ABC;
113 |
114 | public void run() {
115 |
116 | try {
117 |
118 | HttpURLConnection connection = (HttpURLConnection) url.openConnection();
119 |
120 | connection.setRequestProperty("Range", "bytes=" + downloaded + "-");
121 | connection.connect();
122 |
123 |
124 | if (connection.getResponseCode() / 100 != 2) {
125 | error();
126 | }
127 |
128 | int contentLength = connection.getContentLength();
129 |
130 | if (contentLength < 1) {
131 | error();
132 | }
133 | System.out.println("Full Content is " + contentLength);
134 |
135 | if (size == -1) {
136 | size = 10000;
137 | /*Some of the place in the code I use 10000.It means that I want to download 10000 bytes at the first time.
138 | Then remaining bytes will be downloaded.
139 | */
140 |
141 | stateChanged();
142 | }
143 |
144 | fileNameNew = getFileName(url);
145 | file = new RandomAccessFile(getFileName(url), "rw");
146 |
147 | file.seek(downloaded);
148 |
149 | stream = connection.getInputStream();
150 |
151 | size = 10000;
152 | downloaded = 0;
153 |
154 | /*
155 | Here I make a function named 'function1' to download the first 10000 bytes.I use 'size' and 'downloaded' as parameter.
156 | */
157 |
158 | function1(size, downloaded);
159 |
160 | System.out.println("Starting of FUNCTION2");
161 |
162 | /*
163 | 'function2' downloads from 100001(In original,I think 1000001+1215) to remainging bytes.
164 | */
165 |
166 | int sizeX = contentLength;
167 | int downloadedX = 10000 + 1215;
168 | int counter2 = finction2(sizeX, downloadedX);
169 |
170 | /*
171 | From this thread(Main thread) I run another thread from 'abc' class from 'function1'. So, I wait here untill that thread finishes its work. After
172 | finishing I write the random access file with buffer1(from function1) and buffer2 (from function2).
173 | */
174 |
175 | ABC.join();
176 |
177 | /*
178 | From these part I write the file
179 | equentially . That means, bytes downloaded from function1 and function2 are sequentially merged in the file .
180 | */
181 |
182 | for (int i = 0; i <= (counter1); ++i) {
183 | file.write(buffer1[i], 0, read1[i]);
184 | }
185 |
186 | for (int i = 0; i < (counter2); ++i) {
187 | file.write(buffer2[i], 0, read2[i]);
188 | }
189 |
190 | if (status == DOWNLOADING) {
191 | System.out.println("Joss!!!");
192 | status = COMPLETE;
193 | stateChanged();
194 |
195 | }
196 |
197 | /*
198 | movingDirectory is the current directory and targerDirectory is what I choose from 'Select Folder' button.If I select nothing then the
199 | file will'be downloaded in the Project folder(By default).
200 | */
201 |
202 | String movingDirectory = DownloadManager.targetDirectory;
203 | System.out.println(movingDirectory);
204 |
205 | } catch (Exception e) {
206 | error();
207 | } finally {
208 | if (file != null) {
209 |
210 |
211 |
212 | String movingDirectory = DownloadManager.targetDirectory;
213 | String currentDirectory = System.getProperty("user.dir");
214 |
215 | try {
216 | file.close();
217 |
218 | try {
219 |
220 | //if there is a file created then finally that file will be moved to target directory
221 |
222 | File afile = new File(currentDirectory + "\\" + getFileName(url));
223 |
224 | if (afile.renameTo(new File(movingDirectory + "\\" + getFileName(url)))) {
225 | System.out.println("File is moved successful!");
226 | } else {
227 | System.out.println("File is failed to move!");
228 | }
229 |
230 | } catch (Exception e) {
231 | e.printStackTrace();
232 | }
233 |
234 | } catch (Exception e) {
235 | e.printStackTrace();
236 | }
237 | }
238 |
239 | if (stream != null) {
240 | try {
241 | stream.close();
242 | } catch (Exception e) {
243 | e.printStackTrace();
244 | }
245 | }
246 | }
247 | }
248 |
249 | public void stateChanged() {
250 | setChanged();
251 | notifyObservers();
252 | }
253 |
254 | public void function1(int size, int downloaded) throws IOException {
255 |
256 | /*
257 | Here, new Thread in abc class is started. But value of this 'Download' class is passed to 'abc' class. This is called Pass By Reference.
258 | So if there is a change in abc class then, the value of this class is changed .
259 | */
260 |
261 | ABC = new abc(this);
262 | ABC.start();
263 |
264 | }
265 |
266 | public int finction2(int size, int downloaded) throws IOException, InterruptedException {
267 |
268 | /*
269 | Here, new Input Stream, HTTPURL connection, setRequestProperty all are set for this function.
270 | */
271 |
272 |
273 | InputStream streamX = null;
274 | HttpURLConnection connectionX = (HttpURLConnection) url.openConnection();
275 | connectionX.setRequestProperty("Range", "bytes=" + 0 + "-");
276 | connectionX.connect();
277 | streamX = connectionX.getInputStream();
278 |
279 | int counter2 = 0;
280 | int flag2 = 0;
281 |
282 | //As I want to download 10,001-remaining bytes for this URL , so I use 'skip' function for skipping the bytes.
283 |
284 | System.out.println("Skipped " + (byte) streamX.skip(10000 + 1215));
285 |
286 | while (status == DOWNLOADING) {
287 |
288 | if (size - downloaded > MAX_BUFFER_SIZE) {
289 |
290 | System.out.println("First Size-downloaded Part2 " + (size - downloaded));
291 | } else {
292 |
293 | System.out.println("second Size-downloaded Part 2 " + (size - downloaded));
294 | }
295 |
296 | read2[counter2] = streamX.read(buffer2[counter2]);
297 |
298 | System.out.println("Read-- Part2 " + read2[counter2] + "\n");
299 |
300 | if (read2[counter2] == -1 || (size - downloaded) == 0) {
301 | System.out.println("It is broken! part2 \n");
302 | break;
303 | }
304 |
305 | /*
306 | This part is to actually seeing the original bytes
307 | */
308 |
309 | System.out.println("Bytes from Buffer1 ar (Part 2) ");
310 | for (int i = 0; i < buffer2[counter2].length; ++i) {
311 | System.out.print(" " + buffer2[counter2][i] + " ");
312 | }
313 | System.out.print("\n");
314 |
315 | downloaded += read2[counter2];
316 | ++counter2;
317 | System.out.println("Hiji Biji- Part 2 " + counter2);
318 | stateChanged();
319 |
320 | }
321 |
322 | return counter2;
323 |
324 | }
325 |
326 | }
327 |
--------------------------------------------------------------------------------
/src/download/manager/DownloadManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package download.manager;
7 |
8 | /**
9 | *
10 | * @author NowshadApu
11 | */
12 |
13 | import java.awt.*;
14 | import java.awt.event.*;
15 | import java.io.File;
16 | import java.net.*;
17 | import java.util.*;
18 | import javafx.stage.DirectoryChooser;
19 | import javax.swing.*;
20 | import javax.swing.*;
21 | import javax.swing.event.*;
22 |
23 |
24 |
25 |
26 |
27 | public class DownloadManager extends JFrame implements Observer
28 | {
29 | private JTextField addTextField;
30 |
31 | private DownloadsTableModel tableModel;
32 |
33 | private JTable table;
34 |
35 | private JButton pauseButton,resumeButton;
36 |
37 | private JButton cancelButton, clearButton;
38 | private JButton selectFolder,showDownloads;
39 |
40 | private static Download selectedDownload;
41 |
42 | private boolean clearing;
43 |
44 | static public String emni,targetDirectory;
45 |
46 | public static boolean selectionFlag=false;
47 |
48 | public DownloadManager()
49 | {
50 |
51 | setTitle("Download Manager");
52 |
53 | setSize(640, 480);
54 |
55 | addWindowListener(new WindowAdapter(){
56 | public void windowClosing(WindowEvent e){
57 | actionExit();
58 | }
59 | });
60 |
61 | JMenuBar menuBar=new JMenuBar();
62 | JMenu fileMenu=new JMenu("File");
63 | fileMenu.setMnemonic(KeyEvent.VK_F);
64 | JMenuItem fileExitMenuItem=new JMenuItem("Exit",KeyEvent.VK_X);
65 | fileExitMenuItem.addActionListener(new ActionListener() {
66 |
67 | @Override
68 | public void actionPerformed(ActionEvent e) {
69 | actionExit();
70 | }
71 | });
72 |
73 |
74 | fileMenu.add(fileExitMenuItem);
75 | menuBar.add(fileMenu);
76 | setJMenuBar(menuBar);
77 |
78 |
79 |
80 | JPanel addPanel= new JPanel();
81 |
82 | selectFolder=new JButton("Select Folder");
83 | selectFolder.addActionListener(new ActionListener() {
84 |
85 | @Override
86 | public void actionPerformed(ActionEvent e) {
87 | actionSelectFolder();
88 | }
89 | });
90 | addPanel.add(selectFolder);
91 | selectFolder.setEnabled(true);
92 |
93 |
94 | addTextField= new JTextField(30);
95 | addPanel.add(addTextField);
96 |
97 |
98 |
99 |
100 |
101 | JButton addButton = new JButton("Add Download");
102 | addButton.addActionListener(new ActionListener(){
103 | public void actionPerformed(ActionEvent e){
104 | actionAdd();
105 | }
106 | });
107 |
108 | addPanel.add(addButton);
109 |
110 |
111 | tableModel= new DownloadsTableModel();
112 | table= new JTable(tableModel);
113 | table.getSelectionModel().addListSelectionListener(new
114 | ListSelectionListener(){
115 | public void valueChanged(ListSelectionEvent e){
116 | tableSelectionChanged();
117 | }
118 | });
119 |
120 | table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
121 | ProgressRenderer renderer= new ProgressRenderer(0, 100);
122 | renderer.setStringPainted(true);
123 | table.setDefaultRenderer(JProgressBar.class, renderer);
124 |
125 | table.setRowHeight((int)renderer.getPreferredSize().getHeight());
126 |
127 | JPanel downloadsPanel= new JPanel();
128 | downloadsPanel.setBorder(
129 | BorderFactory.createTitledBorder("downloads"));
130 | downloadsPanel.setLayout(new BorderLayout());
131 | downloadsPanel.add(new JScrollPane(table),
132 | BorderLayout.CENTER);
133 |
134 | JPanel buttonsPanel= new JPanel();
135 |
136 |
137 |
138 |
139 |
140 |
141 | pauseButton= new JButton("pause");
142 | pauseButton.addActionListener(new ActionListener() {
143 |
144 | @Override
145 | public void actionPerformed(ActionEvent e) {
146 | actionPause();
147 | }
148 | });
149 | pauseButton.setEnabled(false);
150 | buttonsPanel.add(pauseButton);
151 |
152 |
153 | resumeButton= new JButton("Resume");
154 | resumeButton.addActionListener(new ActionListener(){
155 | public void actionPerformed(ActionEvent e){
156 | actionResume();
157 | }
158 | });
159 | resumeButton.setEnabled(false);
160 | buttonsPanel.add(resumeButton);
161 |
162 |
163 | cancelButton= new JButton("cancel");
164 | cancelButton.addActionListener(new ActionListener(){
165 | public void actionPerformed(ActionEvent e){
166 | actionCancel();
167 | }
168 | });
169 | cancelButton.setEnabled(false);
170 | buttonsPanel.add(cancelButton);
171 |
172 |
173 | clearButton= new JButton("clear");
174 | clearButton.addActionListener(new ActionListener(){
175 | public void actionPerformed(ActionEvent e){
176 | actionClear();
177 | }
178 | });
179 | clearButton.setEnabled(false);
180 | buttonsPanel.add(clearButton);
181 |
182 |
183 |
184 | showDownloads=new JButton("Show Downloads");
185 | showDownloads.addActionListener(new ActionListener() {
186 |
187 | @Override
188 | public void actionPerformed(ActionEvent e) {
189 | actionShowDownloads();
190 | }
191 | });
192 | buttonsPanel.add(showDownloads);
193 | showDownloads.setEnabled(true);
194 |
195 |
196 |
197 | getContentPane().setLayout(new BorderLayout());
198 | getContentPane().add(addPanel, BorderLayout.NORTH);
199 | getContentPane().add(downloadsPanel, BorderLayout.CENTER);
200 | getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
201 |
202 | //String dfgh=selectedDownload.fileNameNew;
203 | //System.out.println(dfgh);
204 | }
205 |
206 | private void actionExit(){
207 | System.exit(0);
208 | }
209 |
210 | private void actionAdd(){
211 | URL verifiedUrl= verifyUrl(addTextField.getText());
212 | if(verifiedUrl!= null){
213 | tableModel.addDownload(new Download(verifiedUrl));
214 | addTextField.setText("");
215 | }else{
216 | JOptionPane.showMessageDialog(this,
217 | "Invalid Download URL", "Error", JOptionPane.ERROR_MESSAGE);
218 | }
219 | }
220 |
221 | private URL verifyUrl(String url)
222 | {
223 | if(!url.toLowerCase().startsWith("http://"))
224 | return null;
225 |
226 | URL verifiedUrl =null;
227 | try
228 | {
229 | verifiedUrl=new URL(url);
230 | }catch(Exception e)
231 | {
232 | return null;
233 |
234 | }
235 |
236 | if(verifiedUrl.getFile().length()<2)
237 | return null;
238 |
239 | return verifiedUrl;
240 | }
241 |
242 | private void tableSelectionChanged()
243 | {
244 | if(selectedDownload!=null)
245 | selectedDownload.deleteObserver(DownloadManager.this);
246 |
247 | if(!clearing && table.getSelectedRow()>-1)
248 | {
249 | selectedDownload=tableModel.getDownload(table.getSelectedRow());
250 | selectedDownload.addObserver(DownloadManager.this);
251 | updateButtons();
252 | }
253 | }
254 |
255 |
256 |
257 | public void actionSelectFolder()
258 | {
259 | JFileChooser fc=new JFileChooser();
260 | fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
261 | if(fc.showOpenDialog(this)==JFileChooser.APPROVE_OPTION)
262 | {
263 | targetDirectory=String.valueOf(fc.getSelectedFile());
264 |
265 | }
266 |
267 | }
268 |
269 | public static String getTargetDirectory()
270 | {
271 | return targetDirectory;
272 | }
273 |
274 | private void actionPause()
275 | {
276 | selectedDownload.pause();
277 | updateButtons();
278 |
279 | }
280 |
281 | private void actionResume()
282 | {
283 | selectedDownload.resume();
284 | updateButtons();
285 | }
286 |
287 | private void actionCancel()
288 | {
289 | selectedDownload.cancel();
290 | updateButtons();
291 | }
292 |
293 | private void actionClear()
294 | {
295 | clearing=true;
296 | tableModel.clearDownload(table.getSelectedRow());
297 | clearing=false;
298 | selectedDownload=null;
299 | updateButtons();
300 | }
301 |
302 | private void actionShowDownloads()
303 | {
304 | try{
305 | if(targetDirectory==null)
306 | {
307 | //String currentDirectory=System.getProperty("user.dir");
308 | Desktop.getDesktop().open(new File(System.getProperty("user.dir")));
309 | }
310 | else
311 | {
312 | Desktop.getDesktop().open(new File(targetDirectory));
313 | // System.out.println(targetDirectory);
314 | }
315 | }
316 | catch(Exception ex)
317 | {ex.printStackTrace();}
318 | }
319 |
320 | private void updateButtons()
321 | {
322 | if(selectedDownload!=null)
323 | {
324 | int status=selectedDownload.getStatus();
325 |
326 | switch(status)
327 | {
328 | case Download.DOWNLOADING:
329 | pauseButton.setEnabled(true);
330 | resumeButton.setEnabled(false);
331 | cancelButton.setEnabled(true);
332 | clearButton.setEnabled(false);
333 | break;
334 |
335 | case Download.PAUSED:
336 | pauseButton.setEnabled(false);
337 | resumeButton.setEnabled(true);
338 | cancelButton.setEnabled(true);
339 | clearButton.setEnabled(false);
340 | break;
341 |
342 | case Download.ERROR:
343 | pauseButton.setEnabled(false);
344 | resumeButton.setEnabled(true);
345 | cancelButton.setEnabled(false);
346 | clearButton.setEnabled(true);
347 | break;
348 |
349 | default:
350 | pauseButton.setEnabled(false);
351 | resumeButton.setEnabled(false);
352 | cancelButton.setEnabled(false);
353 | clearButton.setEnabled(true);
354 |
355 | }
356 | }
357 | else
358 | {
359 | pauseButton.setEnabled(false);
360 | resumeButton.setEnabled(false);
361 | cancelButton.setEnabled(false);
362 | clearButton.setEnabled(false);
363 | }
364 | }
365 |
366 | public void update(Observable o,Object arg)
367 | {
368 | if(selectedDownload!=null && selectedDownload.equals(o))
369 |
370 | SwingUtilities.invokeLater(new Runnable() {
371 |
372 | @Override
373 | public void run() {
374 | updateButtons();
375 | }
376 | });
377 | }
378 |
379 | /* public static String returnString()
380 | {
381 | return selectedDownload.fileNameNew;
382 | }
383 | */
384 |
385 |
386 | public static void main(String[] args)
387 | {
388 |
389 | SwingUtilities.invokeLater(new Runnable() {
390 |
391 | @Override
392 | public void run() {
393 | DownloadManager manager=new DownloadManager();
394 | manager.setVisible(true);
395 |
396 |
397 |
398 | }
399 | });
400 |
401 |
402 |
403 |
404 | /*String movingDirectory=DownloadManager.getTargetDirectory();
405 | System.out.println(currentDirectory);
406 | System.out.println(movingDirectory);
407 | */
408 |
409 |
410 |
411 |
412 |
413 | }
414 |
415 |
416 |
417 |
418 | }
419 |
420 |
421 |
422 |
423 |
424 |
--------------------------------------------------------------------------------
/df:
--------------------------------------------------------------------------------
1 | [1mdiff --git a/build/classes/download/manager/Download.class b/build/classes/download/manager/Download.class[m
2 | [1mindex 194cc89..8440bf9 100644[m
3 | Binary files a/build/classes/download/manager/Download.class and b/build/classes/download/manager/Download.class differ
4 | [1mdiff --git a/nbproject/private/private.xml b/nbproject/private/private.xml[m
5 | [1mindex 1071aad..e326a28 100644[m
6 | [1m--- a/nbproject/private/private.xml[m
7 | [1m+++ b/nbproject/private/private.xml[m
8 | [36m@@ -11,6 +11,8 @@[m
9 | [m
10 | [m
11 | [m
12 | [31m- [m
13 | [32m+[m[32m [m
14 | [32m+[m[32m file:/F:/Projects/My%20Projects/Networking%20Lab/Download_Manager/src/download/manager/abc.java[m
15 | [32m+[m[32m [m
16 | [m
17 | [m
18 | [1mdiff --git a/src/download/manager/Download.java b/src/download/manager/Download.java[m
19 | [1mindex 797bca7..29ba4ea 100644[m
20 | [1m--- a/src/download/manager/Download.java[m
21 | [1m+++ b/src/download/manager/Download.java[m
22 | [36m@@ -9,7 +9,6 @@[m [mpackage download.manager;[m
23 | *[m
24 | * @author NowshadApu[m
25 | */[m
26 | [31m-[m
27 | import java.io.*;[m
28 | import java.net.HttpURLConnection;[m
29 | import java.net.URL;[m
30 | [36m@@ -18,227 +17,310 @@[m [mimport java.util.*;[m
31 | import java.net.*;[m
32 | import java.nio.file.Path;[m
33 | [m
34 | [31m-[m
35 | public class Download extends Observable implements Runnable {[m
36 | [31m- [m
37 | [31m- private static final int MAX_BUFFER_SIZE=1024;[m
38 | [31m- public static final String STATUSES[]={"Downloading","Paused","Complete","Cancelled","Error"};[m
39 | [31m- [m
40 | [31m- public static final int DOWNLOADING=0;[m
41 | [31m- public static final int PAUSED=1;[m
42 | [31m- public static final int COMPLETE=2;[m
43 | [31m- public static final int CANCELLED=3;[m
44 | [31m- public static final int ERROR=4;[m
45 | [31m- [m
46 | [31m- private URL url;[m
47 | [31m- private int size;[m
48 | [31m- private int downloaded;[m
49 | [31m- private int status;[m
50 | [31m- [m
51 | [32m+[m
52 | [32m+[m[32m public static final int MAX_BUFFER_SIZE = 1024;[m
53 | [32m+[m[32m public static final String STATUSES[] = {"Downloading", "Paused", "Complete", "Cancelled", "Error"};[m
54 | [32m+[m
55 | [32m+[m[32m public static final int DOWNLOADING = 0;[m
56 | [32m+[m[32m public static final int PAUSED = 1;[m
57 | [32m+[m[32m public static final int COMPLETE = 2;[m
58 | [32m+[m[32m public static final int CANCELLED = 3;[m
59 | [32m+[m[32m public static final int ERROR = 4;[m
60 | [32m+[m
61 | [32m+[m[32m public URL url;[m
62 | [32m+[m[32m public int size;[m
63 | [32m+[m[32m public int downloaded;[m
64 | [32m+[m[32m public int status;[m
65 | [32m+[m
66 | public String fileNameNew;[m
67 | [32m+[m[32m public int counter1 = 0;[m
68 | [m
69 | [31m- public Download(URL url)[m
70 | [31m- {[m
71 | [31m- this.url=url;[m
72 | [31m- size=-1;[m
73 | [31m- downloaded=0;[m
74 | [31m- status=DOWNLOADING;[m
75 | [31m- [m
76 | [32m+[m[32m /*The reason for taking two dimensional byte array is to store the byte arrarys in another array. I don't want to read and write sequentially.[m
77 | [32m+[m[32m My plan is to read all the byte arrays sequentially or separately and then to write sequentially.[m[41m [m
78 | [32m+[m[32m*/[m
79 | [32m+[m[32m byte buffer1[][] = new byte[100000][MAX_BUFFER_SIZE];[m
80 | [32m+[m[32m byte buffer2[][] = new byte[100000][MAX_BUFFER_SIZE];[m
81 | [32m+[m[41m [m
82 | [32m+[m[32m //These two read array are also for storing 'read' information from reading bytes.[m
83 | [32m+[m
84 | [32m+[m[32m int[] read1 = new int[100000];[m
85 | [32m+[m[32m int[] read2 = new int[100000];[m
86 | [32m+[m
87 | [32m+[m[32m public Download(URL url) {[m
88 | [32m+[m[32m this.url = url;[m
89 | [32m+[m[32m size = -1;[m
90 | [32m+[m[32m downloaded = 0;[m
91 | [32m+[m[32m status = DOWNLOADING;[m
92 | [32m+[m
93 | download();[m
94 | }[m
95 | [31m- public String getUrl()[m
96 | [31m- {[m
97 | [31m- return url.toString();[m
98 | [31m- }[m
99 | [31m- [m
100 | [31m- public int getSize()[m
101 | [31m- {[m
102 | [31m- return size;[m
103 | [31m- }[m
104 | [31m- [m
105 | [31m- public float getProgress()[m
106 | [31m- {[m
107 | [31m- return ((float)downloaded/size)*100;[m
108 | [31m- }[m
109 | [31m- [m
110 | [31m- public int getStatus(){[m
111 | [31m- return status;[m
112 | [31m- }[m
113 | [31m- [m
114 | [31m- public void pause()[m
115 | [31m- {[m
116 | [31m- status=PAUSED;[m
117 | [31m- stateChanged();[m
118 | [31m- }[m
119 | [31m- [m
120 | [31m- public void cancel()[m
121 | [31m- {[m
122 | [31m- status=CANCELLED;[m
123 | [31m- stateChanged();[m
124 | [31m- }[m
125 | [31m- [m
126 | [31m- public void resume()[m
127 | [31m- {[m
128 | [31m- status=DOWNLOADING;[m
129 | [31m- stateChanged();[m
130 | [31m- download();[m
131 | [31m- }[m
132 | [31m- [m
133 | [31m- private void error()[m
134 | [31m- {[m
135 | [31m- status=ERROR;[m
136 | [31m- stateChanged();[m
137 | [31m- }[m
138 | [m
139 | [31m- [m
140 | [32m+[m[32m public String getUrl() {[m
141 | [32m+[m[32m return url.toString();[m
142 | [32m+[m[32m }[m
143 | [32m+[m
144 | [32m+[m[32m public int getSize() {[m
145 | [32m+[m[32m return size;[m
146 | [32m+[m[32m }[m
147 | [32m+[m
148 | [32m+[m[32m public float getProgress() {[m
149 | [32m+[m[32m return ((float) downloaded / size) * 100;[m
150 | [32m+[m[32m }[m
151 | [32m+[m
152 | [32m+[m[32m public int getStatus() {[m
153 | [32m+[m[32m return status;[m
154 | [32m+[m[32m }[m
155 | [32m+[m
156 | [32m+[m[32m public void pause() {[m
157 | [32m+[m[32m status = PAUSED;[m
158 | [32m+[m[32m stateChanged();[m
159 | [32m+[m[32m }[m
160 | [m
161 | [31m- private void download() {[m
162 | [31m- Thread thread=new Thread(this);[m
163 | [32m+[m[32m public void cancel() {[m
164 | [32m+[m[32m status = CANCELLED;[m
165 | [32m+[m[32m stateChanged();[m
166 | [32m+[m[32m }[m
167 | [32m+[m
168 | [32m+[m[32m public void resume() {[m
169 | [32m+[m[32m status = DOWNLOADING;[m
170 | [32m+[m[32m stateChanged();[m
171 | [32m+[m[32m download();[m
172 | [32m+[m[32m }[m
173 | [32m+[m
174 | [32m+[m[32m public void error() {[m
175 | [32m+[m[32m status = ERROR;[m
176 | [32m+[m[32m stateChanged();[m
177 | [32m+[m[32m }[m
178 | [32m+[m
179 | [32m+[m[32m public void download() {[m
180 | [32m+[m[32m Thread thread = new Thread(this);[m
181 | thread.start();[m
182 | }[m
183 | [31m- [m
184 | [31m- public String getFileName(URL url)[m
185 | [31m- {[m
186 | [31m- String fileName=url.getFile();[m
187 | [31m- return fileName.substring(fileName.lastIndexOf('/')+1);[m
188 | [31m- [m
189 | [31m- [m
190 | [32m+[m
191 | [32m+[m[32m public String getFileName(URL url) {[m
192 | [32m+[m
193 | [32m+[m[32m String fileName = url.getFile();[m
194 | [32m+[m[32m return fileName.substring(fileName.lastIndexOf('/') + 1);[m
195 | [32m+[m
196 | }[m
197 | [31m- [m
198 | [31m- public void run ()[m
199 | [31m- {[m
200 | [31m- RandomAccessFile file=null;[m
201 | [31m- InputStream stream=null;[m
202 | [31m- [m
203 | [31m- try{[m
204 | [31m- HttpURLConnection connection=(HttpURLConnection)url.openConnection();[m
205 | [31m- connection.setRequestProperty("Range", "bytes="+downloaded+"-");[m
206 | [31m- connection.connect();[m
207 | [31m- [m
208 | [31m- if(connection.getResponseCode()/100!=2)[m
209 | [31m- {[m
210 | [31m- error();[m
211 | [31m- }[m
212 | [31m- [m
213 | [31m- int contentLength=connection.getContentLength();[m
214 | [31m- if(contentLength<1)[m
215 | [31m- error();[m
216 | [31m- [m
217 | [31m- if(size==-1)[m
218 | [31m- {[m
219 | [31m- size=contentLength;[m
220 | [31m- stateChanged();[m
221 | [31m- }[m
222 | [31m- [m
223 | [31m- fileNameNew=getFileName(url);[m
224 | [31m- file=new RandomAccessFile(getFileName(url),"rw");[m
225 | [31m- file.seek(downloaded);[m
226 | [31m- //System.out.println(fileNameNew);[m
227 | [31m- [m
228 | [31m- [m
229 | [31m- stream=connection.getInputStream();[m
230 | [31m- while(status==DOWNLOADING)[m
231 | [31m- {[m
232 | [31m- byte buffer[];[m
233 | [31m- if(size-downloaded>MAX_BUFFER_SIZE)[m
234 | [31m- buffer=new byte[MAX_BUFFER_SIZE];[m
235 | [31m- else[m
236 | [31m- buffer=new byte[size-downloaded];[m
237 | [31m- [m
238 | [31m- int read=stream.read(buffer);[m
239 | [31m- if(read==-1)[m
240 | [31m- break;[m
241 | [31m- [m
242 | [31m- file.write( buffer,0,read);[m
243 | [31m- downloaded+=read;[m
244 | [31m- stateChanged();[m
245 | [31m- }[m
246 | [31m- [m
247 | [31m- if(status==DOWNLOADING)[m
248 | [31m- {[m
249 | [31m- status=COMPLETE;[m
250 | [31m- stateChanged();[m
251 | [31m- [m
252 | [31m- }[m
253 | [31m- [m
254 | [31m- [m
255 | [31m- String movingDirectory=DownloadManager.targetDirectory;[m
256 | [31m- System.out.println(movingDirectory);[m
257 | [31m- /* String currentDirectory=System.getProperty("user.dir");[m
258 | [31m- [m
259 | [31m- [m
260 | [31m- [m
261 | [31m- [m
262 | [31m- // System.out.println(currentDirectory+" "+movingDirectory);[m
263 | [31m- [m
264 | [31m- try{[m
265 | [31m-[m
266 | [31m- File afile =new File(currentDirectory+"\\"+getFileName(url));[m
267 | [31m-[m
268 | [31m- if(afile.renameTo(new File(movingDirectory+"\\"+getFileName(url)+afile.getName()))){[m
269 | [31m- System.out.println("File is moved successful!");[m
270 | [31m- }else{[m
271 | [31m- System.out.println("File is failed to move!");[m
272 | [31m- }[m
273 | [31m-[m
274 | [31m- }catch(Exception e){[m
275 | [31m- e.printStackTrace();[m
276 | [31m- }[m
277 | [31m- */[m
278 | [31m- [m
279 | [31m- }catch(Exception e)[m
280 | [31m- {[m
281 | [31m- error();[m
282 | [31m- }[m
283 | [31m- finally[m
284 | [31m- {[m
285 | [31m- if(file!=null)[m
286 | [31m- {[m
287 | [31m- [m
288 | [31m- [m
289 | [31m- String movingDirectory=DownloadManager.targetDirectory;[m
290 | [31m- String currentDirectory=System.getProperty("user.dir");[m
291 | [31m- [m
292 | [31m- try[m
293 | [31m- {[m
294 | [31m- file.close();[m
295 | [31m- [m
296 | [31m- try{[m
297 | [31m-[m
298 | [31m- File afile =new File(currentDirectory+"\\"+getFileName(url));[m
299 | [31m-[m
300 | [31m- if(afile.renameTo(new File(movingDirectory+"\\"+getFileName(url)))){[m
301 | [31m- System.out.println("File is moved successful!");[m
302 | [31m- }else{[m
303 | [31m- System.out.println("File is failed to move!");[m
304 | [31m- }[m
305 | [31m-[m
306 | [31m- }catch(Exception e){[m
307 | [31m- e.printStackTrace();[m
308 | [31m- }[m
309 | [31m- [m
310 | [31m- [m
311 | [31m- [m
312 | [31m- [m
313 | [31m- }catch(Exception e)[m
314 | [31m- {[m
315 | [31m- e.printStackTrace();[m
316 | [31m- }[m
317 | [31m- }[m
318 | [31m- [m
319 | [31m- if(stream!=null)[m
320 | [31m- {[m
321 | [31m- try{[m
322 | [31m- stream.close();[m
323 | [31m- }catch(Exception e)[m
324 | [31m- { e.printStackTrace();}[m
325 | [31m- }[m
326 | [31m- }[m
327 | [31m- }[m
328 | [31m- [m
329 | [31m- private void stateChanged() {[m
330 | [32m+[m[32m RandomAccessFile file = null;[m
331 | [32m+[m[32m RandomAccessFile file2 = null;[m
332 | [32m+[m[32m InputStream stream = null;[m
333 | [32m+[m[32m InputStream stream2 = null;[m
334 | [32m+[m[32m int a, b;[m
335 | [32m+[m[32m abc ABC;[m
336 | [32m+[m
337 | [32m+[m[32m public void run() {[m
338 | [32m+[m
339 | [32m+[m[32m try {[m
340 | [32m+[m
341 | [32m+[m[32m HttpURLConnection connection = (HttpURLConnection) url.openConnection();[m
342 | [32m+[m
343 | [32m+[m[32m connection.setRequestProperty("Range", "bytes=" + downloaded + "-");[m
344 | [32m+[m[32m connection.connect();[m
345 | [32m+[m
346 | [32m+[m[41m [m
347 | [32m+[m[32m if (connection.getResponseCode() / 100 != 2) {[m
348 | [32m+[m[32m error();[m
349 | [32m+[m[32m }[m
350 | [32m+[m
351 | [32m+[m[32m int contentLength = connection.getContentLength();[m
352 | [32m+[m
353 | [32m+[m[32m if (contentLength < 1) {[m
354 | [32m+[m[32m error();[m
355 | [32m+[m[32m }[m
356 | [32m+[m[32m System.out.println("Full Content is " + contentLength);[m
357 | [32m+[m
358 | [32m+[m[32m if (size == -1) {[m
359 | [32m+[m[32m size = 10000;[m[41m [m
360 | [32m+[m[32m/*Some of the place in the code I use 10000.It means that I want to download 10000 bytes at the first time.[m
361 | [32m+[m[32m Then remaining bytes will be downloaded.[m
362 | [32m+[m[32m */[m
363 | [32m+[m
364 | [32m+[m[32m stateChanged();[m
365 | [32m+[m[32m }[m
366 | [32m+[m
367 | [32m+[m[32m fileNameNew = getFileName(url);[m
368 | [32m+[m[32m file = new RandomAccessFile(getFileName(url), "rw");[m
369 | [32m+[m
370 | [32m+[m[32m file.seek(downloaded);[m
371 | [32m+[m
372 | [32m+[m[32m stream = connection.getInputStream();[m
373 | [32m+[m
374 | [32m+[m[32m size = 10000;[m
375 | [32m+[m[32m downloaded = 0;[m
376 | [32m+[m[41m [m
377 | [32m+[m[32m /*[m
378 | [32m+[m[32m Here I make a function named 'function1' to download the first 10000 bytes.I use 'size' and 'downloaded' as parameter.[m[41m [m
379 | [32m+[m[32m */[m
380 | [32m+[m[41m [m
381 | [32m+[m[32m function1(size, downloaded);[m
382 | [32m+[m
383 | [32m+[m[32m System.out.println("Starting of FUNCTION2");[m
384 | [32m+[m[41m [m
385 | [32m+[m[32m /*[m
386 | [32m+[m[32m 'function2' downloads from 100001(In original,I think 1000001+1215) to remainging bytes.[m
387 | [32m+[m[32m */[m
388 | [32m+[m
389 | [32m+[m[32m int sizeX = contentLength;[m
390 | [32m+[m[32m int downloadedX = 10000 + 1215;[m
391 | [32m+[m[32m int counter2 = finction2(sizeX, downloadedX);[m
392 | [32m+[m
393 | [32m+[m[32m /*[m
394 | [32m+[m[32m From this thread(Main thread) I run another thread from 'abc' class from 'function1'. So, I wait here untill that thread finishes its work. After[m[41m [m
395 | [32m+[m[32m finishing I write the random access file with buffer1(from function1) and buffer2 (from function2).[m
396 | [32m+[m[32m */[m
397 | [32m+[m[41m [m
398 | [32m+[m[32m ABC.join();[m
399 | [32m+[m[41m [m
400 | [32m+[m[32m /*[m
401 | [32m+[m[32m From these part I write the file[m[41m [m
402 | [32m+[m[32m equentially . That means, bytes downloaded from function1 and function2 are sequentially merged in the file .[m[41m [m
403 | [32m+[m[32m */[m
404 | [32m+[m
405 | [32m+[m[32m for (int i = 0; i <= (counter1); ++i) {[m
406 | [32m+[m[32m file.write(buffer1[i], 0, read1[i]);[m
407 | [32m+[m[32m }[m
408 | [32m+[m
409 | [32m+[m[32m for (int i = 0; i < (counter2); ++i) {[m
410 | [32m+[m[32m file.write(buffer2[i], 0, read2[i]);[m
411 | [32m+[m[32m }[m
412 | [32m+[m
413 | [32m+[m[32m if (status == DOWNLOADING) {[m
414 | [32m+[m[32m System.out.println("Joss!!!");[m
415 | [32m+[m[32m status = COMPLETE;[m
416 | [32m+[m[32m stateChanged();[m
417 | [32m+[m
418 | [32m+[m[32m }[m
419 | [32m+[m[41m [m
420 | [32m+[m[32m /*[m
421 | [32m+[m[32m movingDirectory is the current directory and targerDirectory is what I choose from 'Select Folder' button.If I select nothing then the[m
422 | [32m+[m[32m file will'be downloaded in the Project folder(By default).[m
423 | [32m+[m[32m */[m
424 | [32m+[m
425 | [32m+[m[32m String movingDirectory = DownloadManager.targetDirectory;[m
426 | [32m+[m[32m System.out.println(movingDirectory);[m
427 | [32m+[m
428 | [32m+[m[32m } catch (Exception e) {[m
429 | [32m+[m[32m error();[m
430 | [32m+[m[32m } finally {[m
431 | [32m+[m[32m if (file != null) {[m
432 | [32m+[m[41m [m
433 | [32m+[m[41m [m
434 | [32m+[m
435 | [32m+[m[32m String movingDirectory = DownloadManager.targetDirectory;[m
436 | [32m+[m[32m String currentDirectory = System.getProperty("user.dir");[m
437 | [32m+[m
438 | [32m+[m[32m try {[m
439 | [32m+[m[32m file.close();[m
440 | [32m+[m
441 | [32m+[m[32m try {[m
442 | [32m+[m[41m [m
443 | [32m+[m[32m //if there is a file created then finally that file will be moved to target directory[m
444 | [32m+[m
445 | [32m+[m[32m File afile = new File(currentDirectory + "\\" + getFileName(url));[m
446 | [32m+[m
447 | [32m+[m[32m if (afile.renameTo(new File(movingDirectory + "\\" + getFileName(url)))) {[m
448 | [32m+[m[32m System.out.println("File is moved successful!");[m
449 | [32m+[m[32m } else {[m
450 | [32m+[m[32m System.out.println("File is failed to move!");[m
451 | [32m+[m[32m }[m
452 | [32m+[m
453 | [32m+[m[32m } catch (Exception e) {[m
454 | [32m+[m[32m e.printStackTrace();[m
455 | [32m+[m[32m }[m
456 | [32m+[m
457 | [32m+[m[32m } catch (Exception e) {[m
458 | [32m+[m[32m e.printStackTrace();[m
459 | [32m+[m[32m }[m
460 | [32m+[m[32m }[m
461 | [32m+[m
462 | [32m+[m[32m if (stream != null) {[m
463 | [32m+[m[32m try {[m
464 | [32m+[m[32m stream.close();[m
465 | [32m+[m[32m } catch (Exception e) {[m
466 | [32m+[m[32m e.printStackTrace();[m
467 | [32m+[m[32m }[m
468 | [32m+[m[32m }[m
469 | [32m+[m[32m }[m
470 | [32m+[m[32m }[m
471 | [32m+[m
472 | [32m+[m[32m public void stateChanged() {[m
473 | setChanged();[m
474 | notifyObservers();[m
475 | }[m
476 | [31m- [m
477 | [32m+[m
478 | [32m+[m[32m public void function1(int size, int downloaded) throws IOException {[m
479 | [32m+[m[41m [m
480 | [32m+[m[32m /*[m
481 | [32m+[m[32m Here, new Thread in abc class is started. But value of this 'Download' class is passed to 'abc' class. This is called Pass By Reference.[m
482 | [32m+[m[32m So if there is a change in abc class then, the value of this class is changed .[m[41m [m
483 | [32m+[m[32m */[m
484 | [32m+[m
485 | [32m+[m[32m ABC = new abc(this);[m
486 | [32m+[m[32m ABC.start();[m
487 | [32m+[m
488 | [32m+[m[32m }[m
489 | [32m+[m
490 | [32m+[m[32m public int finction2(int size, int downloaded) throws IOException, InterruptedException {[m
491 | [32m+[m[41m [m
492 | [32m+[m[32m /*[m
493 | [32m+[m[32m Here, new Input Stream, HTTPURL connection, setRequestProperty all are set for this function.[m
494 | [32m+[m[32m */[m
495 | [32m+[m[41m [m
496 | [32m+[m
497 | [32m+[m[32m InputStream streamX = null;[m
498 | [32m+[m[32m HttpURLConnection connectionX = (HttpURLConnection) url.openConnection();[m
499 | [32m+[m[32m connectionX.setRequestProperty("Range", "bytes=" + 0 + "-");[m
500 | [32m+[m[32m connectionX.connect();[m
501 | [32m+[m[32m streamX = connectionX.getInputStream();[m
502 | [32m+[m
503 | [32m+[m[32m int counter2 = 0;[m
504 | [32m+[m[32m int flag2 = 0;[m
505 | [32m+[m[41m [m
506 | [32m+[m[32m //As I want to download 10,001-remaining bytes for this URL , so I use 'skip' function for skipping the bytes.[m[41m [m
507 | [32m+[m
508 | [32m+[m[32m System.out.println("Skipped " + (byte) streamX.skip(10000 + 1215));[m
509 | [32m+[m
510 | [32m+[m[32m while (status == DOWNLOADING) {[m
511 | [32m+[m
512 | [32m+[m[32m if (size - downloaded > MAX_BUFFER_SIZE) {[m
513 | [32m+[m
514 | [32m+[m[32m System.out.println("First Size-downloaded Part2 " + (size - downloaded));[m
515 | [32m+[m[32m } else {[m
516 | [32m+[m
517 | [32m+[m[32m System.out.println("second Size-downloaded Part 2 " + (size - downloaded));[m
518 | [32m+[m[32m }[m
519 | [32m+[m
520 | [32m+[m[32m read2[counter2] = streamX.read(buffer2[counter2]);[m
521 | [32m+[m
522 | [32m+[m[32m System.out.println("Read-- Part2 " + read2[counter2] + "\n");[m
523 | [32m+[m
524 | [32m+[m[32m if (read2[counter2] == -1 || (size - downloaded) == 0) {[m
525 | [32m+[m[32m System.out.println("It is broken! part2 \n");[m
526 | [32m+[m[32m break;[m
527 | [32m+[m[32m }[m
528 | [32m+[m[41m [m
529 | [32m+[m[32m /*[m
530 | [32m+[m[32m This part is to actually seeing the original bytes[m[41m [m
531 | [32m+[m[32m */[m
532 | [32m+[m
533 | [32m+[m[32m System.out.println("Bytes from Buffer1 ar (Part 2) ");[m
534 | [32m+[m[32m for (int i = 0; i < buffer2[counter2].length; ++i) {[m
535 | [32m+[m[32m System.out.print(" " + buffer2[counter2][i] + " ");[m
536 | [32m+[m[32m }[m
537 | [32m+[m[32m System.out.print("\n");[m
538 | [32m+[m
539 | [32m+[m[32m downloaded += read2[counter2];[m
540 | [32m+[m[32m ++counter2;[m
541 | [32m+[m[32m System.out.println("Hiji Biji- Part 2 " + counter2);[m
542 | [32m+[m[32m stateChanged();[m
543 | [32m+[m
544 | [32m+[m[32m }[m
545 | [32m+[m
546 | [32m+[m[32m return counter2;[m
547 | [32m+[m
548 | [32m+[m[32m }[m
549 | [32m+[m
550 | }[m
551 | [1mdiff --git a/src/download/manager/DownloadManager.java b/src/download/manager/DownloadManager.java[m
552 | [1mindex 9ec86ba..d5bd420 100644[m
553 | [1m--- a/src/download/manager/DownloadManager.java[m
554 | [1m+++ b/src/download/manager/DownloadManager.java[m
555 | [36m@@ -261,9 +261,9 @@[m [mimport javax.swing.event.*;[m
556 | if(fc.showOpenDialog(this)==JFileChooser.APPROVE_OPTION)[m
557 | {[m
558 | targetDirectory=String.valueOf(fc.getSelectedFile());[m
559 | [31m- //System.out.println(targetDirectory);[m
560 | [32m+[m[41m [m
561 | }[m
562 | [31m- //selectionFlag=true;[m
563 | [32m+[m[41m [m
564 | }[m
565 | [m
566 | public static String getTargetDirectory()[m
567 |
--------------------------------------------------------------------------------
/nbproject/build-impl.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 | Must set src.dir
227 | Must set test.src.dir
228 | Must set build.dir
229 | Must set dist.dir
230 | Must set build.classes.dir
231 | Must set dist.javadoc.dir
232 | Must set build.test.classes.dir
233 | Must set build.test.results.dir
234 | Must set build.classes.excludes
235 | Must set dist.jar
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 | Must set javac.includes
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 | No tests executed.
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 | Must set JVM to use for profiling in profiler.info.jvm
716 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
717 |
718 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 | Must select some files in the IDE or set javac.includes
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 | To run this application from the command line without Ant, try:
995 |
996 | java -jar "${dist.jar.resolved}"
997 |
998 |
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1032 |
1033 |
1034 |
1035 |
1036 |
1037 |
1038 |
1039 |
1040 |
1041 |
1042 |
1043 | Must select one file in the IDE or set run.class
1044 |
1045 |
1046 |
1047 | Must select one file in the IDE or set run.class
1048 |
1049 |
1050 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 | Must select one file in the IDE or set debug.class
1075 |
1076 |
1077 |
1078 |
1079 | Must select one file in the IDE or set debug.class
1080 |
1081 |
1082 |
1083 |
1084 | Must set fix.includes
1085 |
1086 |
1087 |
1088 |
1089 |
1090 |
1091 |
1096 |
1099 |
1100 | This target only works when run from inside the NetBeans IDE.
1101 |
1102 |
1103 |
1104 |
1105 |
1106 |
1107 |
1108 |
1109 | Must select one file in the IDE or set profile.class
1110 | This target only works when run from inside the NetBeans IDE.
1111 |
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 | This target only works when run from inside the NetBeans IDE.
1120 |
1121 |
1122 |
1123 |
1124 |
1125 |
1126 |
1127 |
1128 |
1129 |
1130 |
1131 |
1132 | This target only works when run from inside the NetBeans IDE.
1133 |
1134 |
1135 |
1136 |
1137 |
1138 |
1139 |
1140 |
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1157 |
1158 |
1159 |
1160 |
1161 |
1162 |
1163 |
1164 |
1165 |
1166 |
1167 |
1168 |
1169 |
1170 | Must select one file in the IDE or set run.class
1171 |
1172 |
1173 |
1174 |
1175 |
1176 | Must select some files in the IDE or set test.includes
1177 |
1178 |
1179 |
1180 |
1181 | Must select one file in the IDE or set run.class
1182 |
1183 |
1184 |
1185 |
1186 | Must select one file in the IDE or set applet.url
1187 |
1188 |
1189 |
1190 |
1195 |
1196 |
1197 |
1198 |
1199 |
1200 |
1201 |
1202 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 |
1223 |
1224 |
1225 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 |
1239 |
1240 |
1241 |
1242 |
1243 |
1244 |
1245 |
1246 |
1247 |
1248 |
1249 |
1250 |
1251 |
1252 |
1253 |
1254 |
1255 |
1256 |
1257 |
1258 |
1259 |
1260 |
1261 |
1262 |
1263 |
1264 |
1265 | Must select some files in the IDE or set javac.includes
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 |
1273 |
1274 |
1275 |
1276 |
1277 |
1282 |
1283 |
1284 |
1285 |
1286 |
1287 |
1288 |
1289 | Some tests failed; see details above.
1290 |
1291 |
1292 |
1293 |
1294 |
1295 |
1296 |
1297 |
1298 | Must select some files in the IDE or set test.includes
1299 |
1300 |
1301 |
1302 | Some tests failed; see details above.
1303 |
1304 |
1305 |
1306 | Must select some files in the IDE or set test.class
1307 | Must select some method in the IDE or set test.method
1308 |
1309 |
1310 |
1311 | Some tests failed; see details above.
1312 |
1313 |
1314 |
1319 |
1320 | Must select one file in the IDE or set test.class
1321 |
1322 |
1323 |
1324 | Must select one file in the IDE or set test.class
1325 | Must select some method in the IDE or set test.method
1326 |
1327 |
1328 |
1329 |
1330 |
1331 |
1332 |
1333 |
1334 |
1335 |
1336 |
1337 |
1342 |
1343 | Must select one file in the IDE or set applet.url
1344 |
1345 |
1346 |
1347 |
1348 |
1349 |
1350 |
1355 |
1356 | Must select one file in the IDE or set applet.url
1357 |
1358 |
1359 |
1360 |
1361 |
1362 |
1363 |
1364 |
1369 |
1370 |
1371 |
1372 |
1373 |
1374 |
1375 |
1376 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 |
1383 |
1384 |
1385 |
1386 |
1387 |
1388 |
1389 |
1390 |
1391 |
1392 |
1393 |
1394 |
1395 |
1396 |
1397 |
1398 |
1399 |
1400 |
1401 |
1402 |
1403 |
1404 |
1405 |
1406 |
1407 |
1408 |
1409 |
1410 |
1411 |
1412 |
1413 |
1414 |
--------------------------------------------------------------------------------