public BigInteger readBigInteger(DataBuffer rawInput, int numBytes) { byte[] myBytes = new byte[numBytes]; System.ArrayCopy(rawInput.GetBytes(), rawInput.GetStreamPosition(), myBytes, 0, numBytes); rawInput.AddToStreamPosition(numBytes); return(new BigInteger(myBytes)); }
/** * Move to the next byte with an index in the byte array * which is dividable by four. */ public void MoveToFourByteBoundry(DataBuffer rawInput) { // If i am already at a 4 byte boundry, I need to move to the next one int mod = rawInput.GetStreamPosition() % 4; rawInput.AddToStreamPosition(4 - mod); }
public String ReadString(DataBuffer rawInput) { int strLen = lengthOfCurrentString(rawInput); // final String res = new String(rawInput.getBytes(), rawInput.getStreamPosition(), strLen, charset); String res = new String(rawInput.GetBytes(), rawInput.GetStreamPosition(), strLen); rawInput.AddToStreamPosition(strLen); MoveToFourByteBoundry(rawInput); return(res); }