-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code.java
53 lines (47 loc) · 1.04 KB
/
Code.java
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
48
49
50
51
52
53
package code;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.swing.JLabel;
import graph.JobDone;
public class Code
{
JobDone asa;
///constructor
public Code(JobDone asa)
{
this.asa = asa;
}
public Code(){}
///fonctions
public void asaOK(InputStream in , OutputStream out , boolean closeOnExit)
{
try
{
if (asa != null)
{
asa.setVisible(true);
}
byte[] buf = new byte[1024];
int n = in.read(buf);
while(n != -1)
{
out.write(buf , 0 , n);
n = in.read(buf);
if (asa != null)
{
asa.add(new JLabel("Done !!"));
}
}
if (closeOnExit)
{
in.close();
out.close();
}
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
}
}