List of utility methods to do BigInteger from Stream
BigInteger | readBigInteger(ByteArrayInputStream bais) read Big Integer return new BigInteger(readData(bais)); |
BigInteger | readBigInteger(DataInputStream dis) Read a (reasonably short) BigInteger from a DataInputStream short i = dis.readShort(); if (i < 0) { throw new IOException("Invalid BigInteger length: " + i); byte[] buf = new byte[i]; dis.readFully(buf); return new BigInteger(1, buf); |
BigInteger | readBigInteger(InputStream input) Read the signed arbitrary sized BigInteger BigInteger in vint format BigInteger result = BigInteger.ZERO; long work = 0; int offset = 0; long b; do { b = input.read(); if (b == -1) { throw new EOFException("Reading BigInteger past EOF from " + input); ... |
BigInteger | readBigInteger(int n, DataInput dis) read Big Integer BigInteger ret = BigInteger.ZERO; byte[] temp = new byte[n]; dis.readFully(temp, 0, n); for (int j = n - 1; j >= 0; j--) { ret = ret.or(BigInteger.valueOf(0xFF & temp[j])); ret = ret.shiftLeft(8); ret = ret.shiftRight(8); ... |
BigInteger | readLineAsBigInteger(BufferedReader br) Executes readline with the given buffered reader Converts the read string to an BigInteger String str = br.readLine(); if (str == null) { throw new IOException(); return new BigInteger(str); |
BigInteger | readLuposBigInteger(final int numberOfBits, final InputStream is) readLuposBigInteger. BigInteger result = BigInteger.ZERO; BigInteger factor = BigInteger.ONE; final BigInteger BYTE = BigInteger.valueOf(256); int remainingBits = numberOfBits; while (remainingBits > 0) { final int currentValueByte = is.read(); if (currentValueByte < 0) { return null; ... |