blob: 39ed27285fe102de1d527c93d61e38c3324e34f7 (
plain)
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
|
import java.io.*;
import static cn.ac.iie.storm.utils.http.HttpAsncClient.getConnAnsyHttpPost;
public class TestHos {
public static void main(String[] args) throws IOException {
InputStream input = new FileInputStream(new File("src/resources/test"));
byte[] buffer = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[1024];
int n;
while ((n = input.read(b)) != -1)
{
bos.write(b, 0, n);
}
input.close();
bos.close();
buffer = bos.toByteArray();
getConnAnsyHttpPost("http://10.111.151.217:8888/yd-test/testfile?method=put",buffer);
}
}
|