Reduced duplication between formatting scripts with Task base class (#80)

Also added scripts for EOF newline management and for removing trailing whitespace. configure.bat was rewritten to use CRLF line endings. Documentation for the existing scripts was also improved.
This commit is contained in:
Tyler Veness
2016-07-10 08:33:27 -07:00
committed by Peter Johnson
parent ea6876e81f
commit aafca4ed7f
57 changed files with 588 additions and 423 deletions

View File

@@ -34,15 +34,15 @@ import com.google.protobuf.Message;
*/
public class Connection {
private static int HEADER_SIZE = 8;
public String host;
public int port;
private Socket socket;
private ServerSocket ssocket;
private InputStream is;
private OutputStream os;
private static final Logger LOG = Logger.getLogger("Gazebo Transport");
public void connect(String host, int port) throws UnknownHostException, IOException {
@@ -114,7 +114,7 @@ public class Connection {
ssocket = null;
}
}
public byte[] rawRead() throws IOException {
synchronized (is) {
// Figure out the message size
@@ -125,18 +125,18 @@ public class Connection {
return null;
}
int size = Integer.parseInt(new String(buff), 16);
// Read in the actual message
buff = new byte[size];
n = is.read(buff);
if (n != size) {
throw new IOException("Failed to read whole message");
}
return buff;
}
}
public Packet read() throws IOException {
byte[] buff = rawRead();
if (buff == null) {

View File

@@ -15,23 +15,23 @@ public class Msgs {
public static GzString.String String() {
return GzString.String.getDefaultInstance();
}
public static GzString.String String(String s) {
return GzString.String.newBuilder().setData(s).build();
}
public static GzFloat64.Float64 Float64() {
return GzFloat64.Float64.getDefaultInstance();
}
public static GzFloat64.Float64 Float64(double d) {
return GzFloat64.Float64.newBuilder().setData(d).build();
}
public static Bool Bool() {
return Bool.getDefaultInstance();
}
public static Bool Bool(boolean b) {
return Bool.newBuilder().setData(b).build();
}

View File

@@ -21,9 +21,9 @@ public class Publisher<T extends Message> implements PublisherRecord {
private List<Connection> listeners;
private boolean latching = false;
private T lastMsg = null;
private static final Logger LOG = Logger.getLogger("Gazebo Transport");
public Publisher(String topic, String msgType, String localHost, int localPort) {
this.topic = topic;
this.msgType = msgType;

View File

@@ -35,9 +35,9 @@ public class RemotePublisherRecord implements PublisherRecord {
public String getMsgType() {
return pub.getMsgType();
}
public String toString() {
return String.format("%s (%s) %s:%s", getTopic(), getMsgType(), getHost(), getPort());
return String.format("%s (%s) %s:%s", getTopic(), getMsgType(), getHost(), getPort());
}
@Override