Пример #1
0
    protected static void _encodeBigInteger(NSCoder coder, BigInteger bigInteger) {
      BigInteger integer = bigInteger;
      boolean isNegative = integer.signum() < 0;
      if (isNegative) {
        integer = integer.negate();
      }

      byte[] bytes = integer.toByteArray();
      int length = bytes.length;
      short shortCount = (short) (length / 2 + length % 2);

      coder.encodeShort(shortCount);
      coder.encodeBoolean(isNegative);
      coder.encodeBoolean(false);
      coder.encodeInt(8);

      for (int i = 0; i < _MaxShortArrayLength; ++i)
        if (i < shortCount) coder.encodeShort(_shortFromByteArray(bytes, length - (2 * (i + 1))));
        else coder.encodeShort((short) 0);
    }
Пример #2
0
 public void encodeWithCoder(Object receiver, NSCoder coder) {
   _encodeUTF8("s", coder);
   coder.encodeShort(((Short) receiver).shortValue());
 }