/** * Transfers the last {@code count} blocks from this file to the end of the given target file. */ void transferBlocksTo(RegularFile target, int count) { copyBlocksTo(target, count); truncateBlocks(blockCount - count); }
/** * Frees the last {@code count} blocks from the given file. */ public synchronized void free(RegularFile file, int count) { int remainingCacheSpace = maxCachedBlockCount - blockCache.blockCount(); if (remainingCacheSpace > 0) { file.copyBlocksTo(blockCache, Math.min(count, remainingCacheSpace)); } file.truncateBlocks(file.blockCount() - count); allocatedBlockCount -= count; } }
/** * Transfers the last {@code count} blocks from this file to the end of the given target file. */ void transferBlocksTo(RegularFile target, int count) { copyBlocksTo(target, count); truncateBlocks(blockCount - count); }
/** * Frees the last {@code count} blocks from the given file. */ public synchronized void free(RegularFile file, int count) { int remainingCacheSpace = maxCachedBlockCount - blockCache.blockCount(); if (remainingCacheSpace > 0) { file.copyBlocksTo(blockCache, Math.min(count, remainingCacheSpace)); } file.truncateBlocks(file.blockCount() - count); allocatedBlockCount -= count; } }