bug fix:
appending leading '0' when number < 0x10
This commit is contained in:
parent
bd2b6a9a53
commit
8e0150d44b
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ConnectionLogger.java,v 1.1 2006/08/21 12:12:56 fros4943 Exp $
|
* $Id: ConnectionLogger.java,v 1.2 2006/12/11 16:37:11 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja;
|
package se.sics.cooja;
|
||||||
|
@ -122,8 +122,11 @@ public class ConnectionLogger {
|
||||||
|
|
||||||
// Source data
|
// Source data
|
||||||
out.write("SRC_DATA\t".getBytes());
|
out.write("SRC_DATA\t".getBytes());
|
||||||
for (byte b : conn.getSourceData())
|
for (byte b : conn.getSourceData()) {
|
||||||
out.write(Integer.toHexString((int) b).getBytes());
|
String hexString = Integer.toHexString((int) b);
|
||||||
|
if (hexString.length() == 1) hexString = "0" + hexString;
|
||||||
|
out.write(hexString.getBytes());
|
||||||
|
}
|
||||||
out.write("\t".getBytes());
|
out.write("\t".getBytes());
|
||||||
|
|
||||||
// Destination pos
|
// Destination pos
|
||||||
|
@ -138,9 +141,11 @@ public class ConnectionLogger {
|
||||||
|
|
||||||
// Source data
|
// Source data
|
||||||
out.write("DEST_DATA\t".getBytes());
|
out.write("DEST_DATA\t".getBytes());
|
||||||
for (byte b : conn.getDestinationData()[i])
|
for (byte b : conn.getDestinationData()[i]) {
|
||||||
out.write(Integer.toHexString((int) b).getBytes());
|
String hexString = Integer.toHexString((int) b);
|
||||||
out.write("\t".getBytes());
|
if (hexString.length() == 1) hexString = "0" + hexString;
|
||||||
|
out.write(hexString.getBytes());
|
||||||
|
} out.write("\t".getBytes());
|
||||||
|
|
||||||
out.write("\n".getBytes());
|
out.write("\n".getBytes());
|
||||||
}
|
}
|
||||||
|
@ -158,9 +163,11 @@ public class ConnectionLogger {
|
||||||
|
|
||||||
// Source data
|
// Source data
|
||||||
out.write("SRC_DATA\t".getBytes());
|
out.write("SRC_DATA\t".getBytes());
|
||||||
for (byte b : conn.getSourceData())
|
for (byte b : conn.getSourceData()) {
|
||||||
out.write(Integer.toHexString((int) b).getBytes());
|
String hexString = Integer.toHexString((int) b);
|
||||||
|
if (hexString.length() == 1) hexString = "0" + hexString;
|
||||||
|
out.write(hexString.getBytes());
|
||||||
|
}
|
||||||
out.write("\n".getBytes());
|
out.write("\n".getBytes());
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
|
|
Loading…
Reference in a new issue