JPProxy update

This commit is contained in:
Jindra Petk
2011-07-16 12:40:49 +02:00
parent 991b08d8bc
commit 49a8fd03bf
24 changed files with 2419 additions and 1577 deletions

View File

@@ -1,35 +1,39 @@
package com.jpexs.proxy;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.net.SocketException;
class Copy implements Runnable {
class Copy implements Runnable
{
InputStream in = null;
OutputStream out = null;
Copy(InputStream in, OutputStream out) {
this.in = in;
this.out = out;
Copy(InputStream in, OutputStream out)
{
this.in = in;
this.out = out;
}
public void run() {
int n;
byte buffer[] = new byte[8192];
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();
}
}
try
{
while ((n = in.read(buffer, 0, buffer.length)) > 0)
{
out.write(buffer, 0, n);
out.flush();
}
out.flush();
}catch(SocketException e){
}
catch (IOException e)
{
//Ignore errors
}
}
}
}