Changeset 97ae1e50


Ignore:
Timestamp:
Dec 13, 2015 4:38:06 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
db86850
Parents:
fee755b
Message:

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

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/i2cp/AbuseSeverity.java

    rfee755b r97ae1e50  
    4646    public void writeBytes(OutputStream out) throws DataFormatException, IOException {
    4747        if (_severityId < 0) throw new DataFormatException("Invalid abuse severity: " + _severityId);
    48         DataHelper.writeLong(out, 1, _severityId);
     48        out.write((byte) _severityId);
    4949    }
    5050
  • core/java/src/net/i2p/data/i2cp/I2CPMessageImpl.java

    rfee755b r97ae1e50  
    106106        try {
    107107            DataHelper.writeLong(out, 4, data.length);
    108             DataHelper.writeLong(out, 1, getType());
     108            out.write((byte) getType());
    109109        } catch (DataFormatException dfe) {
    110110            throw new I2CPMessageException("Unable to write the message length or type", dfe);
  • core/java/src/net/i2p/data/i2cp/MessagePayloadMessage.java

    rfee755b r97ae1e50  
    107107        try {
    108108            DataHelper.writeLong(out, 4, size);
    109             DataHelper.writeLong(out, 1, MESSAGE_TYPE);
     109            out.write((byte) MESSAGE_TYPE);
    110110            DataHelper.writeLong(out, 2, _sessionId);
    111111            DataHelper.writeLong(out, 4, _messageId);
  • core/java/src/net/i2p/data/i2cp/MessageStatusMessage.java

    rfee755b r97ae1e50  
    325325        try {
    326326            DataHelper.writeLong(out, 4, len);
    327             DataHelper.writeLong(out, 1, MESSAGE_TYPE);
     327            out.write((byte) MESSAGE_TYPE);
    328328            DataHelper.writeLong(out, 2, _sessionId);
    329329            DataHelper.writeLong(out, 4, _messageId);
    330             DataHelper.writeLong(out, 1, _status);
     330            out.write((byte) _status);
    331331            DataHelper.writeLong(out, 4, _size);
    332332            DataHelper.writeLong(out, 4, _nonce);
  • core/java/src/net/i2p/data/i2cp/ReceiveMessageBeginMessage.java

    rfee755b r97ae1e50  
    8787        try {
    8888            DataHelper.writeLong(out, 4, len);
    89             DataHelper.writeLong(out, 1, MESSAGE_TYPE);
     89            out.write((byte) MESSAGE_TYPE);
    9090            DataHelper.writeLong(out, 2, _sessionId);
    9191            DataHelper.writeLong(out, 4, _messageId);
  • core/java/src/net/i2p/data/i2cp/SendMessageExpiresMessage.java

    rfee755b r97ae1e50  
    118118        try {
    119119            DataHelper.writeLong(out, 4, len);
    120             DataHelper.writeLong(out, 1, MESSAGE_TYPE);
     120            out.write((byte) MESSAGE_TYPE);
    121121            _sessionId.writeBytes(out);
    122122            _destination.writeBytes(out);
  • core/java/src/net/i2p/data/i2cp/SendMessageMessage.java

    rfee755b r97ae1e50  
    140140        try {
    141141            DataHelper.writeLong(out, 4, len);
    142             DataHelper.writeLong(out, 1, getType());
     142            out.write((byte) getType());
    143143            _sessionId.writeBytes(out);
    144144            _destination.writeBytes(out);
  • router/java/src/net/i2p/data/i2np/DeliveryInstructions.java

    rfee755b r97ae1e50  
    431431        //               + " =?= " + flagMode(flags));
    432432        byte additionalInfo[] = getAdditionalInfo();
    433         DataHelper.writeLong(out, 1, flags);
     433        out.write((byte) flags);
    434434        if (additionalInfo != null) {
    435435            out.write(additionalInfo);
  • router/java/src/net/i2p/data/router/RouterAddress.java

    rfee755b r97ae1e50  
    289289        if (_transportStyle == null)
    290290            throw new DataFormatException("uninitialized");
    291         DataHelper.writeLong(out, 1, _cost);
     291        out.write((byte) _cost);
    292292        DataHelper.writeLong(out, 8, _expiration);
    293293        DataHelper.writeString(out, _transportStyle);
  • router/java/src/net/i2p/router/message/GarlicMessageBuilder.java

    rfee755b r97ae1e50  
    244244                byte clove[] = buildClove(ctx, (PayloadGarlicConfig)config);
    245245                baos = new ByteArrayOutputStream(clove.length + 16);
    246                 DataHelper.writeLong(baos, 1, 1);
     246                baos.write((byte) 1);
    247247                baos.write(clove);
    248248            } else {
     
    264264                    len += cloves[i].length;
    265265                baos = new ByteArrayOutputStream(len + 16);
    266                 DataHelper.writeLong(baos, 1, cloves.length);
     266                baos.write((byte) cloves.length);
    267267                for (int i = 0; i < cloves.length; i++)
    268268                    baos.write(cloves[i]);
Note: See TracChangeset for help on using the changeset viewer.