Example #1
0
  @Override
  public final void decode(byte[] bytes) throws DecoderException {
    if (bytes.length < 2)
      throw new DecoderException("Insufficient space remaining in buffer to decode this value");

    this.value = BitHelpers.readShortLE(bytes, 0);
  }
Example #2
0
 @Override
 public final void decode(byte[] bytes) throws DecoderException {
   try {
     this.value = BitHelpers.readIntLE(bytes, 0);
   } catch (Exception e) {
     throw new DecoderException(e.getMessage(), e);
   }
 }
Example #3
0
 @Override
 public final byte[] toByteArray() throws EncoderException {
   byte[] buffer = new byte[2];
   BitHelpers.putShortLE(value, buffer, 0);
   return buffer;
 }