private PersistentHeapUsedSpace GetSpaceAt(int token) { int sizeIndex = token - PersistentHeapSpace.GetUserSizeSize(); byte[] sizeBytes = _file.GetAmount(sizeIndex, PersistentHeapSpace.GetUserSizeSize()); int userSize = PersistentHeapSpace.GetUserSize(sizeBytes); int fullLength = userSize + PersistentHeapSpace.GetUserSizeSize(); int endIndex = sizeIndex + fullLength - 1; byte[] data = _file.GetRange(sizeIndex + PersistentHeapSpace.GetUserSizeSize(), endIndex); //let PersistentHeapUsedSpace be default PersistentHeapUsedSpace usedSpace = new PersistentHeapUsedSpace(sizeIndex, endIndex, data); return(usedSpace); }
private static void GetRangeTestAssert(byte[] bytes, int startIndex, FileWithHeader fwh) { fwh.Put(startIndex, bytes); byte[] actual = fwh.GetRange(startIndex, startIndex + bytes.Length - 1); TestHelper.AssertByteArraysAreSame(bytes, actual); }