@Test public void testReadBsdiffLong() throws Exception { byte[] data = { (byte) 0x78, (byte) 0x56, (byte) 0x34, (byte) 0x12, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0xef, (byte) 0xbe, (byte) 0xad, (byte) 0x0e, (byte) 0, (byte) 0, (byte) 0, (byte) 0 }; ByteArrayInputStream inputStream = new ByteArrayInputStream(data); long actual = BsPatch.readBsdiffLong(inputStream); Assert.assertEquals(0x12345678, actual); actual = BsPatch.readBsdiffLong(inputStream); Assert.assertEquals(0x0eadbeef, actual); }
static final long readBsdiffLong(InputStream in) throws PatchFormatException, IOException { long result = 0; for (int bitshift = 0; bitshift < 64; bitshift += 8) { result |= ((long) in.read()) << bitshift; } if (result == NEGATIVE_LONG_SIGN_MASK) { throw new PatchFormatException("read negative zero"); } if ((result & NEGATIVE_LONG_SIGN_MASK) != 0) { result = -(result & ~NEGATIVE_LONG_SIGN_MASK); } return result; }
BsPatch { static final long readBsdiffLong(InputStream in) throws PatchFormatException, IOException { long result = 0; for (int bitshift = 0; bitshift < 64; bitshift += 8) { result |= ((long) in.read()) << bitshift; } if (result == NEGATIVE_LONG_SIGN_MASK) { throw new PatchFormatException("read negative zero"); } if ((result & NEGATIVE_LONG_SIGN_MASK) != 0) { result = -(result & ~NEGATIVE_LONG_SIGN_MASK); } return result; } }
BsPatch { static final long readBsdiffLong(InputStream in) throws PatchFormatException, IOException { long result = 0; for (int bitshift = 0; bitshift < 64; bitshift += 8) { result |= ((long) in.read()) << bitshift; } if (result == NEGATIVE_LONG_SIGN_MASK) { throw new PatchFormatException("read negative zero"); } if ((result & NEGATIVE_LONG_SIGN_MASK) != 0) { result = -(result & ~NEGATIVE_LONG_SIGN_MASK); } return result; }  }
BsPatch { static final long readBsdiffLong(InputStream in) throws PatchFormatException, IOException { long result = 0; for (int bitshift = 0; bitshift < 64; bitshift += 8) { result |= ((long) in.read()) << bitshift; } if (result == NEGATIVE_LONG_SIGN_MASK) { throw new PatchFormatException("read negative zero"); } if ((result & NEGATIVE_LONG_SIGN_MASK) != 0) { result = -(result & ~NEGATIVE_LONG_SIGN_MASK); } return result; }  static void applyPatch(
      RandomAccessFile oldData, OutputStream newData, InputStream patchData); }
BsPatch { static final long readBsdiffLong(InputStream in) throws PatchFormatException, IOException { long result = 0; for (int bitshift = 0; bitshift < 64; bitshift += 8) { result |= ((long) in.read()) << bitshift; } if (result == NEGATIVE_LONG_SIGN_MASK) { throw new PatchFormatException("read negative zero"); } if ((result & NEGATIVE_LONG_SIGN_MASK) != 0) { result = -(result & ~NEGATIVE_LONG_SIGN_MASK); } return result; }  static void applyPatch(
      RandomAccessFile oldData, OutputStream newData, InputStream patchData);  }