public virtual void SetBlockSize(PXFileHeader.BlockSize blockSize) { this.blockSize = blockSize; }
/// <summary>read (little endian)</summary> /// <exception cref="Com.Khubla.Pdxreader.Api.PDXReaderException"/> public virtual void Read(LittleEndianDataInputStream littleEndianDataInputStream) { try { /* * The index record length is six greater than the sum of the lengths of the key fields. */ indexRecordLength = littleEndianDataInputStream.ReadUnsignedShort(); headerBlockSize = littleEndianDataInputStream.ReadUnsignedShort(); if (2048 != headerBlockSize) { throw new Exception("headerBlockSize was expected to be 2048, but '" + headerBlockSize + "' was found"); } int fileType = littleEndianDataInputStream.ReadUnsignedByte(); if (1 != fileType) { throw new Exception("PX file type was expected to be 1, but '" + fileType + "' was found" ); } dataBlockSizeCode = littleEndianDataInputStream.ReadUnsignedByte(); if (1 == dataBlockSizeCode) { blockSize = PXFileHeader.BlockSize.oneK; } else { if (2 == dataBlockSizeCode) { blockSize = PXFileHeader.BlockSize.twoK; } else { if (3 == dataBlockSizeCode) { blockSize = PXFileHeader.BlockSize.threeK; } else { if (4 == dataBlockSizeCode) { blockSize = PXFileHeader.BlockSize.fourK; } else { throw new Exception("Unknown block size code '" + dataBlockSizeCode + "'"); } } } } numberRecords = littleEndianDataInputStream.ReadInt(); blocksInUse = littleEndianDataInputStream.ReadUnsignedShort(); totalBlocksInFile = littleEndianDataInputStream.ReadUnsignedShort(); firstDataBlock = littleEndianDataInputStream.ReadUnsignedShort(); if (1 != firstDataBlock) { throw new Exception("firstDataBlock was expected to be 1, but '" + firstDataBlock + "' was found"); } lastDataBlock = littleEndianDataInputStream.ReadUnsignedShort(); indexRootBlock = littleEndianDataInputStream.ReadUnsignedShort(); numberIndexLevels = littleEndianDataInputStream.ReadUnsignedByte(); /* * The number of fields in the index is the same as the number of key fields for the table. */ numberIndexFields = littleEndianDataInputStream.ReadUnsignedByte(); } catch (Exception e) { throw new PDXReaderException("Exception in read", e); } }