internal void Persist() { if (_ids.Count * 4 > _context.DataBlockSize) { throw new NotImplementedException("Large numbers of user / group id's"); } for (int i = 0; i < _ids.Count; ++i) { Utilities.WriteBytesLittleEndian(_ids[i], _context.IoBuffer, i * 4); } // Persist the table that references the block containing the id's long blockPos = _context.RawStream.Position + 8; byte[] tableBuffer = new byte[8]; Utilities.WriteBytesLittleEndian(blockPos, tableBuffer, 0); _context.RawStream.Write(tableBuffer, 0, 8); // Persist the actual Id's MetablockWriter writer = new MetablockWriter(); writer.Write(_context.IoBuffer, 0, _ids.Count * 4); writer.Persist(_context.RawStream); }
internal void Persist() { if (_fragmentBlocks.Count > 0) { if (_fragmentBlocks.Count * FragmentRecord.RecordSize > _context.DataBlockSize) { throw new NotImplementedException("Large numbers of fragments"); } // Persist the table that references the block containing the fragment records long blockPos = _context.RawStream.Position + 8; byte[] tableBuffer = new byte[8]; Utilities.WriteBytesLittleEndian(blockPos, tableBuffer, 0); _context.RawStream.Write(tableBuffer, 0, 8); int recordSize = FragmentRecord.RecordSize; byte[] buffer = new byte[_fragmentBlocks.Count * recordSize]; for (int i = 0; i < _fragmentBlocks.Count; ++i) { _fragmentBlocks[i].WriteTo(buffer, i * recordSize); } MetablockWriter writer = new MetablockWriter(); writer.Write(buffer, 0, buffer.Length); writer.Persist(_context.RawStream); } }