mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 07:05:06 +00:00
Initial version based on previous work. (Version alpha 7)
This commit is contained in:
35
trunk/libsrc/jpproxy/src/com/jpexs/proxy/Copy.java
Normal file
35
trunk/libsrc/jpproxy/src/com/jpexs/proxy/Copy.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.jpexs.proxy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
class Copy implements Runnable {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
|
||||
Copy(InputStream in, OutputStream out) {
|
||||
this.in = in;
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
int n;
|
||||
byte buffer[] = new byte[8192];
|
||||
|
||||
try {
|
||||
while ((n = in.read(buffer, 0, buffer.length)) > 0) {
|
||||
out.write(buffer, 0, n);
|
||||
out.flush();
|
||||
}
|
||||
out.flush();
|
||||
}
|
||||
catch (IOException e) {
|
||||
String s = e.toString();
|
||||
// ignore socket closed exceptions
|
||||
if (s.toLowerCase().indexOf("socket closed") == -1) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user