Cleanup: Don't use DataHelper.writeLong() for a single byte

This commit is contained in:
zzz
2015-12-13 16:38:06 +00:00
parent fee755bdb7
commit 97ae1e5034
10 changed files with 12 additions and 12 deletions

View File

@ -430,7 +430,7 @@ public class DeliveryInstructions extends DataStructureImpl {
// _log.debug("Write flags: " + flags + " mode: " + getDeliveryMode()
// + " =?= " + flagMode(flags));
byte additionalInfo[] = getAdditionalInfo();
DataHelper.writeLong(out, 1, flags);
out.write((byte) flags);
if (additionalInfo != null) {
out.write(additionalInfo);
out.flush();

View File

@ -288,7 +288,7 @@ public class RouterAddress extends DataStructureImpl {
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
if (_transportStyle == null)
throw new DataFormatException("uninitialized");
DataHelper.writeLong(out, 1, _cost);
out.write((byte) _cost);
DataHelper.writeLong(out, 8, _expiration);
DataHelper.writeString(out, _transportStyle);
DataHelper.writeProperties(out, _options);

View File

@ -243,7 +243,7 @@ public class GarlicMessageBuilder {
if (config instanceof PayloadGarlicConfig) {
byte clove[] = buildClove(ctx, (PayloadGarlicConfig)config);
baos = new ByteArrayOutputStream(clove.length + 16);
DataHelper.writeLong(baos, 1, 1);
baos.write((byte) 1);
baos.write(clove);
} else {
byte cloves[][] = new byte[config.getCloveCount()][];
@ -263,7 +263,7 @@ public class GarlicMessageBuilder {
for (int i = 0; i < cloves.length; i++)
len += cloves[i].length;
baos = new ByteArrayOutputStream(len + 16);
DataHelper.writeLong(baos, 1, cloves.length);
baos.write((byte) cloves.length);
for (int i = 0; i < cloves.length; i++)
baos.write(cloves[i]);
}