checkstyle passes
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@50 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/util/NetProxy.java b/dev/core/src/com/google/gwt/dev/util/NetProxy.java
index b332750..1d3332f 100644
--- a/dev/core/src/com/google/gwt/dev/util/NetProxy.java
+++ b/dev/core/src/com/google/gwt/dev/util/NetProxy.java
@@ -21,85 +21,28 @@
import java.net.ServerSocket;
import java.net.Socket;
-/**
- * Protocol-blind byte-level proxy.
- */
public class NetProxy {
-<<<<<<< .mine
- private class ClientToServerProxyConnection extends ProxyConnection {
- public ClientToServerProxyConnection(Socket clientSideSocket,
- Socket serverSideSocket) {
- super(clientSideSocket, serverSideSocket);
- setName(fFromPort + " => " + fToPort + " #" + fConnections);
- }
-=======
private class ClientToServerProxyConnection extends ProxyConnection {
public ClientToServerProxyConnection(Socket clientSideSocket,
Socket serverSideSocket) {
super(clientSideSocket, serverSideSocket);
setName(fromPort + " => " + toPort + " #" + connections);
}
->>>>>>> .r47
protected void recordBytesTransferred(byte[] bytes, int avail) {
addBytesSent(avail, bytes);
}
}
-<<<<<<< .mine
- private abstract class ProxyConnection extends Thread {
- private Socket fFromSocket;
- private Socket fToSocket;
-=======
private abstract class ProxyConnection extends Thread {
private Socket fromSocket;
private Socket toSocket;
->>>>>>> .r47
-<<<<<<< .mine
- public ProxyConnection(Socket fromSocket, Socket toSocket) {
- fFromSocket = fromSocket;
- fToSocket = toSocket;
-=======
public ProxyConnection(Socket fromSocket, Socket toSocket) {
this.fromSocket = fromSocket;
this.toSocket = toSocket;
->>>>>>> .r47
}
-<<<<<<< .mine
-
- public void run() {
- try {
- InputStream fromSideInput = fFromSocket.getInputStream();
- OutputStream toSideOutput = fToSocket.getOutputStream();
-
- /*
- * Spin and pass data in one direction.
- */
- int avail;
- byte[] bytes = new byte[32768];
- while (true) {
- // Read 'from' side
- avail = fromSideInput.read(bytes);
- if (avail > 0) {
- // Forward to 'to' side
- toSideOutput.write(bytes, 0, avail);
- // Accumulate bytes received
- recordBytesTransferred(bytes, avail);
- } else if (avail == -1) {
- break;
- }
- }
- } catch (Throwable e) {
- } finally {
- try {
- fFromSocket.close();
- fToSocket.close();
- } catch (Throwable e) {
- }
- }
-=======
public void run() {
try {
@@ -131,18 +74,8 @@
} catch (Throwable e) {
}
}
->>>>>>> .r47
}
-<<<<<<< .mine
- protected abstract void recordBytesTransferred(byte[] bytes, int avail);
- }
- private class ServerToClientProxyConnection extends ProxyConnection {
- public ServerToClientProxyConnection(Socket clientSideSocket,
- Socket serverSideSocket) {
- super(serverSideSocket, clientSideSocket);
- setName(fFromPort + " <= " + fToPort + " #" + fConnections);
-=======
protected abstract void recordBytesTransferred(byte[] bytes, int avail);
}
private class ServerToClientProxyConnection extends ProxyConnection {
@@ -150,7 +83,6 @@
Socket serverSideSocket) {
super(serverSideSocket, clientSideSocket);
setName(fromPort + " <= " + toPort + " #" + connections);
->>>>>>> .r47
}
protected void recordBytesTransferred(byte[] bytes, int avail) {
@@ -164,44 +96,6 @@
return;
}
-<<<<<<< .mine
- int localPort = Integer.parseInt(args[0]);
- int remotePort = Integer.parseInt(args[1]);
- String remoteHost = args.length < 3 ? "localhost" : args[2];
- NetProxy netProxy = new NetProxy(localPort, remoteHost, remotePort, true);
- netProxy.run();
- }
-
- private boolean fDumpChars;
- private int fFromPort;
- private String fToName;
- private int fToPort;
- private int fBytesSent;
- private int fBytesReceived;
-
- private int fConnections;
-
- private boolean fEnd;
-
- private long fStartTime = System.currentTimeMillis();
-
- public NetProxy(int fromPort, String toName, int toPort, boolean dumpChars) {
- fFromPort = fromPort;
- fToName = toName;
- fToPort = toPort;
- fDumpChars = dumpChars;
- }
-
- public void end() {
- fEnd = true;
- }
-
- public void run() {
- try {
- System.out.println("Time\tBytes Sent\tBytes Received\tTotal Bytes\tHTTP Data");
- ServerSocket serverSocket = new ServerSocket(fFromPort);
- while (!fEnd) {
-=======
int localPort = Integer.parseInt(args[0]);
int remotePort = Integer.parseInt(args[1]);
String remoteHost = args.length < 3 ? "localhost" : args[2];
@@ -238,13 +132,8 @@
System.out.println("Time\tBytes Sent\tBytes Received\tTotal Bytes\tHTTP Data");
ServerSocket serverSocket = new ServerSocket(fromPort);
while (!end) {
->>>>>>> .r47
try {
-<<<<<<< .mine
- ++fConnections;
-=======
++connections;
->>>>>>> .r47
/*
* Listen for and accept the client-initiated connection. Connect to
@@ -254,13 +143,8 @@
Socket clientSideSocket = serverSocket.accept();
clientSideSocket.setTcpNoDelay(true);
-<<<<<<< .mine
- Socket serverSideSocket = new Socket(fToName, fToPort);
- serverSideSocket.setTcpNoDelay(true);
-=======
Socket serverSideSocket = new Socket(toName, toPort);
serverSideSocket.setTcpNoDelay(true);
->>>>>>> .r47
new ClientToServerProxyConnection(clientSideSocket, serverSideSocket).start();
new ServerToClientProxyConnection(clientSideSocket, serverSideSocket).start();
@@ -274,62 +158,14 @@
}
}
-<<<<<<< .mine
- protected int getBytesReceived() {
- return fBytesReceived;
- }
-=======
protected int getBytesReceived() {
return bytesReceived;
}
->>>>>>> .r47
-<<<<<<< .mine
- protected int getBytesSent() {
- return fBytesSent;
- }
-=======
protected int getBytesSent() {
return bytesSent;
}
->>>>>>> .r47
-<<<<<<< .mine
- private synchronized void addBytesReceived(int byteCount, byte[] bytes) {
- fBytesReceived += byteCount;
- log(0, byteCount, bytes);
- }
-
- private synchronized void addBytesSent(int byteCount, byte[] bytes) {
- fBytesSent += byteCount;
- log(byteCount, 0, bytes);
- }
-
- private synchronized void log(int bytesSent, int bytesReceived,
- byte[] dataBuffer) {
- System.out.print(System.currentTimeMillis() - fStartTime);
- System.out.print("\t");
- System.out.print(bytesSent);
- System.out.print("\t");
- System.out.print(bytesReceived);
- System.out.print("\t");
- System.out.print(fBytesSent + fBytesReceived);
- System.out.print("\t");
- char ch;
- int avail = (bytesSent != 0 ? bytesSent : bytesReceived);
- if (fDumpChars) {
- int limit = (avail < 1024 ? avail : 1024);
- for (int i = 0; i < limit; ++i) {
- ch = (char) dataBuffer[i];
- if (ch >= 32 && ch < 128) {
- System.out.print(ch);
- } else if (ch == '\n') {
- System.out.print("\\n");
- } else if (ch == '\r') {
- System.out.print("\\r");
- } else {
- System.out.print('.');
-=======
private synchronized void addBytesReceived(int byteCount, byte[] bytes) {
bytesReceived += byteCount;
log(0, byteCount, bytes);
@@ -364,7 +200,6 @@
System.out.print("\\r");
} else {
System.out.print('.');
->>>>>>> .r47
}
}
} else {
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java b/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
index d9fe856..3bc0317 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
@@ -19,20 +19,8 @@
import java.io.PrintWriter;
import java.util.Arrays;
-/**
- * Adapts {@link TextOutput} to a character array.
- */
public class TextOutputOnCharArray implements TextOutput {
-<<<<<<< .mine
- private final CharArrayWriter fCharArrayWriter;
- private final boolean fCompact;
- private int fIndent = 0;
- private int fIndentGranularity;
- private char[][] fIndents = new char[][] {new char[0]};
- private boolean fJustNewlined;
- private final PrintWriter p;
-=======
private final CharArrayWriter charArrayWriter;
private final boolean compact;
private int indent = 0;
@@ -40,57 +28,22 @@
private char[][] indents = new char[][] {new char[0]};
private boolean justNewlined;
private final PrintWriter p;
->>>>>>> .r47
-<<<<<<< .mine
- public TextOutputOnCharArray(boolean compact) {
- fIndentGranularity = 2;
- fCharArrayWriter = new CharArrayWriter(50 * 1024);
- p = new PrintWriter(fCharArrayWriter);
- fCompact = compact;
- }
-=======
public TextOutputOnCharArray(boolean compact) {
indentGranularity = 2;
charArrayWriter = new CharArrayWriter(50 * 1024);
p = new PrintWriter(charArrayWriter);
this.compact = compact;
}
->>>>>>> .r47
-<<<<<<< .mine
- public int getIndent() {
- return fIndent;
- }
-=======
public int getIndent() {
return indent;
}
->>>>>>> .r47
-<<<<<<< .mine
- public char[] getText() {
- return fCharArrayWriter.toCharArray();
- }
-=======
public char[] getText() {
return charArrayWriter.toCharArray();
}
->>>>>>> .r47
-<<<<<<< .mine
- public void indentIn() {
- ++fIndent;
- if (fIndent >= fIndents.length) {
- // Cache a new level of indentation string.
- //
- char[] newIndentLevel = new char[fIndent * fIndentGranularity];
- Arrays.fill(newIndentLevel, ' ');
- char[][] newIndents = new char[fIndents.length + 1][];
- System.arraycopy(fIndents, 0, newIndents, 0, fIndents.length);
- newIndents[fIndent] = newIndentLevel;
- fIndents = newIndents;
-=======
public void indentIn() {
++indent;
if (indent >= indents.length) {
@@ -102,67 +55,29 @@
System.arraycopy(indents, 0, newIndents, 0, indents.length);
newIndents[indent] = newIndentLevel;
indents = newIndents;
->>>>>>> .r47
}
}
-<<<<<<< .mine
- public void indentOut() {
- --fIndent;
- }
-=======
public void indentOut() {
--indent;
}
->>>>>>> .r47
-<<<<<<< .mine
- public void newline() {
- p.print('\n');
- // TODO: remove flush calls
- p.flush();
- fJustNewlined = true;
- }
-=======
public void newline() {
p.print('\n');
// TODO: remove flush calls
p.flush();
justNewlined = true;
}
->>>>>>> .r47
-<<<<<<< .mine
- public void newlineOpt() {
- if (!fCompact) {
- p.print('\n');
- // TODO: remove flush calls
- p.flush();
-=======
public void newlineOpt() {
if (!compact) {
p.print('\n');
// TODO: remove flush calls
p.flush();
->>>>>>> .r47
}
-<<<<<<< .mine
- fJustNewlined = true;
- }
-=======
justNewlined = true;
}
->>>>>>> .r47
-<<<<<<< .mine
- public void print(char c) {
- maybeIndent();
- p.print(c);
- // TODO: remove flush calls
- p.flush();
- fJustNewlined = false;
- }
-=======
public void print(char c) {
maybeIndent();
p.print(c);
@@ -170,17 +85,7 @@
p.flush();
justNewlined = false;
}
->>>>>>> .r47
-<<<<<<< .mine
- public void print(char[] s) {
- maybeIndent();
- p.print(s);
- // TODO: remove flush calls
- p.flush();
- fJustNewlined = false;
- }
-=======
public void print(char[] s) {
maybeIndent();
p.print(s);
@@ -188,17 +93,7 @@
p.flush();
justNewlined = false;
}
->>>>>>> .r47
-<<<<<<< .mine
- public void print(String s) {
- maybeIndent();
- p.print(s);
- // TODO: remove flush calls
- p.flush();
- fJustNewlined = false;
- }
-=======
public void print(String s) {
maybeIndent();
p.print(s);
@@ -206,87 +101,44 @@
p.flush();
justNewlined = false;
}
->>>>>>> .r47
-<<<<<<< .mine
- public void printOpt(char c) {
- if (!fCompact) {
- maybeIndent();
- p.print(c);
- // TODO: remove flush calls
- p.flush();
-=======
public void printOpt(char c) {
if (!compact) {
maybeIndent();
p.print(c);
// TODO: remove flush calls
p.flush();
->>>>>>> .r47
}
}
-<<<<<<< .mine
- public void printOpt(char[] s) {
- if (!fCompact) {
- maybeIndent();
- p.print(s);
- // TODO: remove flush calls
- p.flush();
-=======
public void printOpt(char[] s) {
if (!compact) {
maybeIndent();
p.print(s);
// TODO: remove flush calls
p.flush();
->>>>>>> .r47
}
}
-<<<<<<< .mine
- public void printOpt(String s) {
- if (!fCompact) {
- maybeIndent();
- p.print(s);
- // TODO: remove flush calls
- p.flush();
-=======
public void printOpt(String s) {
if (!compact) {
maybeIndent();
p.print(s);
// TODO: remove flush calls
p.flush();
->>>>>>> .r47
}
}
-<<<<<<< .mine
- public void setIndent(int indent) {
- fIndent = indent;
- }
-=======
public void setIndent(int indent) {
this.indent = indent;
}
->>>>>>> .r47
-<<<<<<< .mine
- private void maybeIndent() {
- if (fJustNewlined && !fCompact) {
- p.print(fIndents[fIndent]);
- // TODO: remove flush calls
- p.flush();
- fJustNewlined = false;
-=======
private void maybeIndent() {
if (justNewlined && !compact) {
p.print(indents[indent]);
// TODO: remove flush calls
p.flush();
justNewlined = false;
->>>>>>> .r47
}
}
}