@Override public MALEncodedElement getEncodedUpdate(final int listIndex, final int updateIndex) throws MALException { //ToDo throw new MALException("Not supported yet."); } }
/** * Throws a MALException when supplied with a NULL value * * @param value The value to check * @throws MALException if value is NULL */ protected void checkForNull(Object value) throws MALException { if (null == value) { throw new MALException("Null value supplied in a non-nullable field"); } }
@Override public MALListEncoder createListEncoder(final java.util.List value) throws MALException { try { outputStream.addUnsignedInt(value.size()); return this; } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public MALListEncoder createListEncoder(final java.util.List value) throws MALException { try { outputStream.addUnsignedInt(value.size()); return this; } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public int getSignedInt() throws MALException { try { return Integer.valueOf(removeFirst()); } catch (NumberFormatException ex) { throw new MALException(ex.getLocalizedMessage(), ex); } }
@Override public long getSignedLong() throws MALException { try { return Long.valueOf(removeFirst()); } catch (NumberFormatException ex) { throw new MALException(ex.getLocalizedMessage(), ex); } }
@Override public short getSignedShort() throws MALException { try { return Short.valueOf(removeFirst()); } catch (NumberFormatException ex) { throw new MALException(ex.getLocalizedMessage(), ex); } }
@Override public byte get8() throws MALException { try { return Byte.valueOf(removeFirst()); } catch (NumberFormatException ex) { throw new MALException(ex.getLocalizedMessage(), ex); } }
@Override public BigInteger getBigInteger() throws MALException { try { return new BigInteger(removeFirst()); } catch (NumberFormatException ex) { throw new MALException(ex.getLocalizedMessage(), ex); } }
/** * Encode an unsigned integer using split-binary encoding for a 4-byte * variable sized int */ @Override public void encodeUInteger(final UInteger value) throws MALException { try { ((TCPIPStreamHolder) outputStream).addUnsignedVarint4((int) value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeString(final String value) throws MALException { try { checkForNull(value); outputStream.addString(value); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeOctet(final Byte value) throws MALException { try { checkForNull(value); outputStream.addByte(value); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeShort(final Short value) throws MALException { try { checkForNull(value); outputStream.addSignedShort(value); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeOctet(final Byte value) throws MALException { try { checkForNull(value); outputStream.addByte(value); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeShort(final Short value) throws MALException { try { checkForNull(value); outputStream.addSignedShort(value); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeString(final String value) throws MALException { try { checkForNull(value); outputStream.addString(value); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeFineTime(final FineTime value) throws MALException { try { checkForNull(value); outputStream.addUnsignedLong(value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeUShort(final UShort value) throws MALException { try { checkForNull(value); outputStream.addUnsignedInt16(value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeUShort(final UShort value) throws MALException { try { checkForNull(value); outputStream.addUnsignedInt16(value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }
@Override public void encodeDuration(final Duration value) throws MALException { try { checkForNull(value); outputStream.addDouble(value.getValue()); } catch (IOException ex) { throw new MALException(ENCODING_EXCEPTION_STR, ex); } }