/** {@inheritDoc} */ @Override public long readLong() throws IOException { readFully(buf, 0, 8); return NB.decodeInt64(buf, 0); }
refIndexPosition = NB.decodeInt64(ftr, 24); long p = NB.decodeInt64(ftr, 32); objPosition = p >>> 5; objIdLen = (int) (p & 0x1f); objIndexPosition = NB.decodeInt64(ftr, 40); logPosition = NB.decodeInt64(ftr, 48); logIndexPosition = NB.decodeInt64(ftr, 56);
private byte[] readHeaderOrFooter(long pos, int len) throws IOException { ByteBuffer buf = src.read(pos, len); if (buf.position() != len) { throw new IOException(JGitText.get().shortReadOfBlock); } byte[] tmp = new byte[len]; buf.flip(); buf.get(tmp); if (!isFileHeaderMagic(tmp, 0, len)) { throw new IOException(JGitText.get().invalidReftableFile); } int v = NB.decodeInt32(tmp, 4); int version = v >>> 24; if (VERSION_1 != version) { throw new IOException(MessageFormat.format( JGitText.get().unsupportedReftableVersion, Integer.valueOf(version))); } if (blockSize == -1) { blockSize = v & 0xffffff; } minUpdateIndex = NB.decodeInt64(tmp, 8); maxUpdateIndex = NB.decodeInt64(tmp, 16); return tmp; }
/** * Convert an LongObjectId from raw binary representation. * * @param bs * the raw byte buffer to read from. At least 32 bytes after p * must be available within this byte array. * @param p * position to read the first byte of data from. */ public void fromRaw(final byte[] bs, final int p) { w1 = NB.decodeInt64(bs, p); w2 = NB.decodeInt64(bs, p + 8); w3 = NB.decodeInt64(bs, p + 16); w4 = NB.decodeInt64(bs, p + 24); }
/** * Convert a LongObjectId from raw binary representation. * * @param bs * the raw byte buffer to read from. At least 32 bytes after p * must be available within this byte array. * @param p * position to read the first byte of data from. */ public void fromRaw(byte[] bs, int p) { w1 = NB.decodeInt64(bs, p); w2 = NB.decodeInt64(bs, p + 8); w3 = NB.decodeInt64(bs, p + 16); w4 = NB.decodeInt64(bs, p + 24); }
/** * Convert a LongObjectId from raw binary representation. * * @param bs * the raw byte buffer to read from. At least 32 bytes after p * must be available within this byte array. * @param p * position to read the first byte of data from. * @return the converted object id. */ public static final LongObjectId fromRaw(byte[] bs, int p) { final long a = NB.decodeInt64(bs, p); final long b = NB.decodeInt64(bs, p + 8); final long c = NB.decodeInt64(bs, p + 16); final long d = NB.decodeInt64(bs, p + 24); return new LongObjectId(a, b, c, d); }
/** * Convert a LongObjectId from raw binary representation. * * @param bs * the raw byte buffer to read from. At least 32 bytes after p * must be available within this byte array. * @param p * position to read the first byte of data from. * @return the converted object id. */ public static final LongObjectId fromRaw(final byte[] bs, final int p) { final long a = NB.decodeInt64(bs, p); final long b = NB.decodeInt64(bs, p + 8); final long c = NB.decodeInt64(bs, p + 16); final long d = NB.decodeInt64(bs, p + 24); return new LongObjectId(a, b, c, d); }
/** {@inheritDoc} */ @Override public long readLong() throws IOException { readFully(buf, 0, 8); return NB.decodeInt64(buf, 0); }
public long readLong() throws IOException { readFully(buf, 0, 8); return NB.decodeInt64(buf, 0); }
/** * Compare this LongObjectId to a network-byte-order LongObjectId. * * @param bs * array containing the other LongObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 32 bytes, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(final byte[] bs, final int p) { int cmp; cmp = NB.compareUInt64(w1, NB.decodeInt64(bs, p)); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w2, NB.decodeInt64(bs, p + 8)); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w3, NB.decodeInt64(bs, p + 16)); if (cmp != 0) return cmp; return NB.compareUInt64(w4, NB.decodeInt64(bs, p + 24)); }
/** * Compare this LongObjectId to a network-byte-order LongObjectId. * * @param bs * array containing the other LongObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 32 bytes, starting at this position are required. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. */ public final int compareTo(byte[] bs, int p) { int cmp; cmp = NB.compareUInt64(w1, NB.decodeInt64(bs, p)); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w2, NB.decodeInt64(bs, p + 8)); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w3, NB.decodeInt64(bs, p + 16)); if (cmp != 0) return cmp; return NB.compareUInt64(w4, NB.decodeInt64(bs, p + 24)); }
refIndexPosition = NB.decodeInt64(ftr, 24); long p = NB.decodeInt64(ftr, 32); objPosition = p >>> 5; objIdLen = (int) (p & 0x1f); objIndexPosition = NB.decodeInt64(ftr, 40); logPosition = NB.decodeInt64(ftr, 48); logIndexPosition = NB.decodeInt64(ftr, 56);
private byte[] readHeaderOrFooter(long pos, int len) throws IOException { ByteBuffer buf = src.read(pos, len); if (buf.position() != len) { throw new IOException(JGitText.get().shortReadOfBlock); } byte[] tmp = new byte[len]; buf.flip(); buf.get(tmp); if (!isFileHeaderMagic(tmp, 0, len)) { throw new IOException(JGitText.get().invalidReftableFile); } int v = NB.decodeInt32(tmp, 4); int version = v >>> 24; if (VERSION_1 != version) { throw new IOException(MessageFormat.format( JGitText.get().unsupportedReftableVersion, Integer.valueOf(version))); } if (blockSize == -1) { blockSize = v & 0xffffff; } minUpdateIndex = NB.decodeInt64(tmp, 8); maxUpdateIndex = NB.decodeInt64(tmp, 16); return tmp; }
/** * Compare this abbreviation to a network-byte-order LongObjectId. * * @param bs * array containing the other LongObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 32 bytes, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(byte[] bs, int p) { int cmp; cmp = NB.compareUInt64(w1, mask(1, NB.decodeInt64(bs, p))); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w2, mask(2, NB.decodeInt64(bs, p + 8))); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w3, mask(3, NB.decodeInt64(bs, p + 16))); if (cmp != 0) return cmp; return NB.compareUInt64(w4, mask(4, NB.decodeInt64(bs, p + 24))); }
/** * Compare this abbreviation to a network-byte-order LongObjectId. * * @param bs * array containing the other LongObjectId in network byte order. * @param p * position within {@code bs} to start the compare at. At least * 32 bytes, starting at this position are required. * @return <0 if this abbreviation names an object that is less than * <code>other</code>; 0 if this abbreviation exactly matches the * first {@link #length()} digits of <code>other.name()</code>; * >0 if this abbreviation names an object that is after * <code>other</code>. */ public final int prefixCompare(final byte[] bs, final int p) { int cmp; cmp = NB.compareUInt64(w1, mask(1, NB.decodeInt64(bs, p))); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w2, mask(2, NB.decodeInt64(bs, p + 8))); if (cmp != 0) return cmp; cmp = NB.compareUInt64(w3, mask(3, NB.decodeInt64(bs, p + 16))); if (cmp != 0) return cmp; return NB.compareUInt64(w4, mask(4, NB.decodeInt64(bs, p + 24))); }