private short readInt16() { return (short) NB.decodeUInt16(buf, ptr += 2); }
private int getExtendedFlags() { if (isExtended()) return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; else return 0; }
/** * Copy the ObjectId and other meta fields from an existing entry. * <p> * This method copies everything except the path and possibly stage from one * entry to another, supporting renaming. * * @param src * the entry to copy ObjectId and meta fields from. * @param keepStage * if true, the stage attribute will not be copied */ void copyMetaData(DirCacheEntry src, boolean keepStage) { int origflags = NB.decodeUInt16(info, infoOffset + P_FLAGS); int newflags = NB.decodeUInt16(src.info, src.infoOffset + P_FLAGS); System.arraycopy(src.info, src.infoOffset, info, infoOffset, INFO_LEN); final int pLen = origflags & NAME_MASK; final int SHIFTED_STAGE_MASK = 0x3 << 12; final int pStageShifted; if (keepStage) pStageShifted = origflags & SHIFTED_STAGE_MASK; else pStageShifted = newflags & SHIFTED_STAGE_MASK; NB.encodeInt16(info, infoOffset + P_FLAGS, pStageShifted | pLen | (newflags & ~NAME_MASK & ~SHIFTED_STAGE_MASK)); }
final int version = NB.decodeUInt16(scratch, 4); if (version != 1) throw new IOException(MessageFormat.format( final int opts = NB.decodeUInt16(scratch, 6); if ((opts & OPT_FULL) == 0) throw new IOException(MessageFormat.format(
md.update(info, infoOffset, len); int pathLen = NB.decodeUInt16(info, infoOffset + P_FLAGS) & NAME_MASK; int skipped = 0; if (pathLen < NAME_MASK) {
restartCnt = NB.decodeUInt16(buf, bufLen - 2); restartTbl = bufLen - (restartCnt * 3 + 2); keysStart = ptr;
private short readInt16() { return (short) NB.decodeUInt16(buf, ptr += 2); }
int getOffset(byte[] index, int offsetTable, int nth) { return NB.decodeUInt16(index, offsetTable + (nth * 2)); } }
int getOffset(byte[] index, int offsetTable, int nth) { return NB.decodeUInt16(index, offsetTable + (nth * 2)); } }
private int getExtendedFlags() { if (isExtended()) return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; else return 0; }
private int getExtendedFlags() { if (isExtended()) return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16; else return 0; }
/** * Copy the ObjectId and other meta fields from an existing entry. * <p> * This method copies everything except the path and possibly stage from one * entry to another, supporting renaming. * * @param src * the entry to copy ObjectId and meta fields from. * @param keepStage * if true, the stage attribute will not be copied */ void copyMetaData(final DirCacheEntry src, boolean keepStage) { int origflags = NB.decodeUInt16(info, infoOffset + P_FLAGS); int newflags = NB.decodeUInt16(src.info, src.infoOffset + P_FLAGS); System.arraycopy(src.info, src.infoOffset, info, infoOffset, INFO_LEN); final int pLen = origflags & NAME_MASK; final int SHIFTED_STAGE_MASK = 0x3 << 12; final int pStageShifted; if (keepStage) pStageShifted = origflags & SHIFTED_STAGE_MASK; else pStageShifted = newflags & SHIFTED_STAGE_MASK; NB.encodeInt16(info, infoOffset + P_FLAGS, pStageShifted | pLen | (newflags & ~NAME_MASK & ~SHIFTED_STAGE_MASK)); }
/** * Copy the ObjectId and other meta fields from an existing entry. * <p> * This method copies everything except the path and possibly stage from one * entry to another, supporting renaming. * * @param src * the entry to copy ObjectId and meta fields from. * @param keepStage * if true, the stage attribute will not be copied */ void copyMetaData(DirCacheEntry src, boolean keepStage) { int origflags = NB.decodeUInt16(info, infoOffset + P_FLAGS); int newflags = NB.decodeUInt16(src.info, src.infoOffset + P_FLAGS); System.arraycopy(src.info, src.infoOffset, info, infoOffset, INFO_LEN); final int pLen = origflags & NAME_MASK; final int SHIFTED_STAGE_MASK = 0x3 << 12; final int pStageShifted; if (keepStage) pStageShifted = origflags & SHIFTED_STAGE_MASK; else pStageShifted = newflags & SHIFTED_STAGE_MASK; NB.encodeInt16(info, infoOffset + P_FLAGS, pStageShifted | pLen | (newflags & ~NAME_MASK & ~SHIFTED_STAGE_MASK)); }
fanout = new int[256]; for (int i = 0; i < 256; i++) { last += NB.decodeUInt16(indexBuf, ptr + 2 + i * 2); fanout[i] = last; throw new DhtException(MessageFormat.format( DhtText.get().unsupportedChunkIndex, Integer.toHexString(NB.decodeUInt16(indexBuf, ptr)), key));
fanout = new int[256]; for (int i = 0; i < 256; i++) { last += NB.decodeUInt16(indexBuf, ptr + 2 + i * 2); fanout[i] = last; throw new DhtException(MessageFormat.format( DhtText.get().unsupportedChunkIndex, Integer.toHexString(NB.decodeUInt16(indexBuf, ptr)), key));
static ChunkIndex fromBytes(ChunkKey key, byte[] index, int ptr, int len) throws DhtException { int v = index[ptr] & 0xff; switch (v) { case V1: { final int offsetFormat = index[ptr + 1] & 7; switch (offsetFormat) { case 1: return new Offset1(index, ptr, len, key); case 2: return new Offset2(index, ptr, len, key); case 3: return new Offset3(index, ptr, len, key); case 4: return new Offset4(index, ptr, len, key); default: throw new DhtException(MessageFormat.format( DhtText.get().unsupportedChunkIndex, Integer.toHexString(NB.decodeUInt16(index, ptr)), key)); } } default: throw new DhtException(MessageFormat.format( DhtText.get().unsupportedChunkIndex, Integer.toHexString(v), key)); } }
static ChunkIndex fromBytes(ChunkKey key, byte[] index, int ptr, int len) throws DhtException { int v = index[ptr] & 0xff; switch (v) { case V1: { final int offsetFormat = index[ptr + 1] & 7; switch (offsetFormat) { case 1: return new Offset1(index, ptr, len, key); case 2: return new Offset2(index, ptr, len, key); case 3: return new Offset3(index, ptr, len, key); case 4: return new Offset4(index, ptr, len, key); default: throw new DhtException(MessageFormat.format( DhtText.get().unsupportedChunkIndex, Integer.toHexString(NB.decodeUInt16(index, ptr)), key)); } } default: throw new DhtException(MessageFormat.format( DhtText.get().unsupportedChunkIndex, Integer.toHexString(v), key)); } }
md.update(info, infoOffset, len); int pathLen = NB.decodeUInt16(info, infoOffset + P_FLAGS) & NAME_MASK; int skipped = 0; if (pathLen < NAME_MASK) {
md.update(info, infoOffset, len); int pathLen = NB.decodeUInt16(info, infoOffset + P_FLAGS) & NAME_MASK; int skipped = 0; if (pathLen < NAME_MASK) {
restartCnt = NB.decodeUInt16(buf, bufLen - 2); restartTbl = bufLen - (restartCnt * 3 + 2); keysStart = ptr;