/** * Get blockSize of the file, in bytes. * * @param ext * the file extension. * @return blockSize of the file, in bytes. If 0 the blockSize size is not * yet known and may be discovered when opening the file. */ public int getBlockSize(PackExt ext) { int i = ext.getPosition(); return i < blockSizeMap.length ? blockSizeMap[i] : 0; }
/** * Get size of the file, in bytes. * * @param ext * the file extension. * @return size of the file, in bytes. If 0 the file size is not yet known. */ public long getFileSize(PackExt ext) { int i = ext.getPosition(); return i < sizeMap.length ? sizeMap[i] : 0; }
/** * Get the bit mask of the extension e.g {@code 1 << getPosition()}. * * @return the bit mask of the extension e.g {@code 1 << getPosition()}. */ public int getBit() { return 1 << getPosition(); }
byte[] get(PackExt ext) { return fileMap[ext.getPosition()]; } }
void put(PackExt ext, byte[] data) { fileMap[ext.getPosition()] = data; }
/** * Set size of the file in bytes. * * @param ext * the file extension. * @param bytes * size of the file in bytes. If 0 the file is not known and will * be determined on first read. * @return {@code this} */ public DfsPackDescription setFileSize(PackExt ext, long bytes) { int i = ext.getPosition(); if (i >= sizeMap.length) { sizeMap = Arrays.copyOf(sizeMap, i + 1); } sizeMap[i] = Math.max(0, bytes); return this; }
/** * Set blockSize of the file, in bytes. * * @param ext * the file extension. * @param blockSize * blockSize of the file, in bytes. If 0 the blockSize is not * known and will be determined on first read. * @return {@code this} */ public DfsPackDescription setBlockSize(PackExt ext, int blockSize) { int i = ext.getPosition(); if (i >= blockSizeMap.length) { blockSizeMap = Arrays.copyOf(blockSizeMap, i + 1); } blockSizeMap[i] = Math.max(0, blockSize); return this; }
/** * Constructor for DfsStreamKey. * * @param hash * hash of the other identifying components of the key. * @param ext * pack file extension, or {@code null}. */ protected DfsStreamKey(int hash, @Nullable PackExt ext) { // Multiply by 31 here so we can more directly combine with another // value without doing the multiply there. this.hash = hash * 31; this.packExtPos = ext == null ? 0 : ext.getPosition(); }
/** * Get blockSize of the file, in bytes. * * @param ext * the file extension. * @return blockSize of the file, in bytes. If 0 the blockSize size is not * yet known and may be discovered when opening the file. */ public int getBlockSize(PackExt ext) { int i = ext.getPosition(); return i < blockSizeMap.length ? blockSizeMap[i] : 0; }
/** * Get the bit mask of the extension e.g {@code 1 << getPosition()}. * * @return the bit mask of the extension e.g {@code 1 << getPosition()}. */ public int getBit() { return 1 << getPosition(); }
/** @return the bit mask of the extension e.g {@code 1 << getPosition()}. */ public int getBit() { return 1 << getPosition(); }
/** * Get size of the file, in bytes. * * @param ext * the file extension. * @return size of the file, in bytes. If 0 the file size is not yet known. */ public long getFileSize(PackExt ext) { int i = ext.getPosition(); return i < sizeMap.length ? sizeMap[i] : 0; }
byte[] get(PackExt ext) { return fileMap[ext.getPosition()]; } }
void put(PackExt ext, byte[] data) { fileMap[ext.getPosition()] = data; }
/** * Set size of the file in bytes. * * @param ext * the file extension. * @param bytes * size of the file in bytes. If 0 the file is not known and will * be determined on first read. * @return {@code this} */ public DfsPackDescription setFileSize(PackExt ext, long bytes) { int i = ext.getPosition(); if (i >= sizeMap.length) { sizeMap = Arrays.copyOf(sizeMap, i + 1); } sizeMap[i] = Math.max(0, bytes); return this; }
/** * Set blockSize of the file, in bytes. * * @param ext * the file extension. * @param blockSize * blockSize of the file, in bytes. If 0 the blockSize is not * known and will be determined on first read. * @return {@code this} */ public DfsPackDescription setBlockSize(PackExt ext, int blockSize) { int i = ext.getPosition(); if (i >= blockSizeMap.length) { blockSizeMap = Arrays.copyOf(blockSizeMap, i + 1); } blockSizeMap[i] = Math.max(0, blockSize); return this; }
/** * Constructor for DfsStreamKey. * * @param hash * hash of the other identifying components of the key. * @param ext * pack file extension, or {@code null}. */ protected DfsStreamKey(int hash, @Nullable PackExt ext) { // Multiply by 31 here so we can more directly combine with another // value without doing the multiply there. this.hash = hash * 31; this.packExtPos = ext == null ? 0 : ext.getPosition(); }