FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-tools/d0wnloader.java at master · javaarchive/java-tools · GitHub
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
javaarchive
/
java-tools
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-tools
/
d0wnloader.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (43 loc) · 1.71 KB
Breadcrumbs
java-tools
/
d0wnloader.java
Copy path
File metadata and controls
47 lines (43 loc) · 1.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import
java
.
io
.
File
;
import
java
.
io
.
FileNotFoundException
;
import
java
.
io
.
FileOutputStream
;
import
java
.
io
.
FileWriter
;
import
java
.
io
.
IOException
;
import
java
.
io
.
PrintWriter
;
import
java
.
net
.
MalformedURLException
;
import
java
.
net
.
URL
;
import
java
.
nio
.
channels
.
Channels
;
import
java
.
nio
.
channels
.
ReadableByteChannel
;
import
javax
.
swing
.
JFrame
;
import
javax
.
swing
.
JOptionPane
;
public
class
d0wnloader
{
private
static
JFrame
temp
;
public
static
void
download
(
String
url
,
String
out
)
throws
IOException
{
System
.
out
.
println
(
"DL "
+
url
+
" "
+
out
);
URL
website
;
try
{
website
=
new
URL
(
url
);
ReadableByteChannel
rbc
=
Channels
.
newChannel
(
website
.
openStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
new
File
(
out
));
fos
.
getChannel
().
transferFrom
(
rbc
,
0
,
Long
.
MAX_VALUE
);
fos
.
close
();
}
catch
(
Exception
e
) {
// TODO Auto-generated catch block
e
.
printStackTrace
();
System
.
err
.
println
(
"Internet error, press enter to proceed"
);
JOptionPane
.
showMessageDialog
(
temp
,
"Failed to download file due to a network error. Here's your debug data "
+
e
.
getMessage
());
(
new
PrintWriter
(
new
FileWriter
(
"Warning_Download_Failed.warning"
))).
close
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
repoBase
=
"https://raw.githubusercontent.com/"
;
// Need slash
String
repoEnd
=
"javaarchive/java-tools/master/"
;
// username/repo-name/branch/
String
u
=
repoBase
+
repoEnd
;
temp
=
new
JFrame
(
"Download..."
);
download
(
u
+
"javatools.java"
,
"javatools.java"
);
download
(
u
+
"jt.java"
,
"jt.java"
);
download
(
u
+
"compilestandard.java"
,
"compilestandard.java"
);
JOptionPane
.
showMessageDialog
(
temp
,
"Downloader is done!"
);
temp
.
dispose
();
}
}
Back
|
FazBrowse Home
|
New Git URL