コード例 #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);
  }
コード例 #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);
   }
 }
コード例 #3
0
 @Override
 public final byte[] toByteArray() throws EncoderException {
   byte[] buffer = new byte[2];
   BitHelpers.putShortLE(value, buffer, 0);
   return buffer;
 }