private void shrink(int newSize, boolean preserveData) throws IOException {

		this.size = newSize;

		// Currently using a single data buffer - data is always preserved
		if (dataBufferIdTable.length == 1) {
			DataBuffer buffer = bufferMgr.getBuffer(firstBufferId);
			buffer.putInt(DATA_LENGTH_OFFSET, getObfuscationDataLengthFieldValue());
			bufferMgr.releaseBuffer(buffer);
		}

		// Already using an index
		else if (!shrinkToSingleBuffer(preserveData)) {

			// Compute index counts
			int newIndexCount = ((newSize - 1) / dataSpace) + 1;
			int newIndexBufferCount = ((newIndexCount - 1) / indexesPerBuffer) + 1;

			// Delete extra data buffers
			int oldIndexCount = dataBufferIdTable.length;
			for (int i = newIndexCount; i < oldIndexCount; i++) {
				if (dataBufferIdTable[i] >= 0) {
					bufferMgr.deleteBuffer(dataBufferIdTable[i]);
				}
			}

			// Shrink dataBufferIdTable
			int[] newDataBufferIdTable = new int[newIndexCount];
			System.arraycopy(dataBufferIdTable, 0, newDataBufferIdTable, 0,
				newDataBufferIdTable.length);
			dataBufferIdTable = newDataBufferIdTable;

			// Shrink indexBufferIdTable
			int oldIndexBufferCount = indexBufferIdTable.length;
			if (oldIndexBufferCount > newIndexBufferCount) {

				// Delete extra index and data buffers
				for (int i = newIndexBufferCount; i < oldIndexBufferCount; i++) {
					bufferMgr.deleteBuffer(indexBufferIdTable[i]);
				}

				int[] newIndexBufferIdTable = new int[newIndexBufferCount];
				System.arraycopy(indexBufferIdTable, 0, newIndexBufferIdTable, 0,
					newIndexBufferCount);
				indexBufferIdTable = newIndexBufferIdTable;
			}

			// Adjust stored buffer size
			DataBuffer buffer = bufferMgr.getBuffer(firstBufferId);
			buffer.putInt(DATA_LENGTH_OFFSET, getObfuscationDataLengthFieldValue());
			bufferMgr.releaseBuffer(buffer);
		}
	}
Decrease the size of this DBBuffer object.
@param newSize new size.
@param preserveData if true, existing data is preserved at the original offsets.  If false,
no additional effort will be expended to preserve data.
@throws IOException thrown if IO error occurs
Ghidra/Framework/DB/src/main/java/db/ChainedBuffer.java