/** * Reads one entry of the indexTable and return it's values in a SFOIndexTableEntry-object * @param fIn * @return SFOIndexTableEntry * @throws IOException */ public static SFOIndexTableEntry ReadEntry(Stream fIn) { SFOIndexTableEntry sfoIndexTableEntry = new SFOIndexTableEntry(); byte[] tempByteArray1 = new byte[1]; byte[] tempByteArray2 = new byte[2]; byte[] tempByteArray4 = new byte[4]; // read offsetKeyNameInKeyTable fIn.Read(tempByteArray2, 0, 2); sfoIndexTableEntry.SetOffsetKeyNameInKeyTable(tempByteArray2); // read dataAlignmentRequirements fIn.Read(tempByteArray1, 0, 1); sfoIndexTableEntry.SetDataAlignmentRequirements(tempByteArray1[0]); // read dataTypeValue fIn.Read(tempByteArray1, 0, 1); sfoIndexTableEntry.SetDataTypeValue(tempByteArray1[0]); // read sizeValueData fIn.Read(tempByteArray4, 0, 4); sfoIndexTableEntry.SetSizeValueData(SFOReaderUtilities.ByteArrayReverseToInt(tempByteArray4)); // read sizeValueDataAndPadding fIn.Read(tempByteArray4, 0, 4); sfoIndexTableEntry.SetSizeValueDataAndPadding(SFOReaderUtilities.ByteArrayReverseToInt(tempByteArray4)); // read offsetDataValueInDataTable fIn.Read(tempByteArray4, 0, 4); sfoIndexTableEntry.SetOffsetDataValueInDataTable(SFOReaderUtilities.ByteArrayReverseToInt(tempByteArray4)); return(sfoIndexTableEntry); }
public static SFOHeader Read(Stream fIn) { SFOHeader sfoHeader = new SFOHeader(); byte[] tempByteArray = new byte[4]; // read FileType fIn.Read(tempByteArray, 0, 4); sfoHeader.SetFileType(SFOReaderUtilities.ByteArrayToString(tempByteArray)); // read sfoVerion fIn.Read(tempByteArray, 0, 4); sfoHeader.SetSfoVersion(SFOReaderUtilities.ByteArrayToString(tempByteArray)); // read offsetKeyTable fIn.Read(tempByteArray, 0, 4); sfoHeader.SetOffsetKeyTable(SFOReaderUtilities.ByteArrayReverseToInt(tempByteArray)); // read offsetValueTable fIn.Read(tempByteArray, 0, 4); sfoHeader.SetOffsetValueTable(SFOReaderUtilities.ByteArrayReverseToInt(tempByteArray)); // read numberDataItem fIn.Read(tempByteArray, 0, 4); sfoHeader.SetNumberDataItems(SFOReaderUtilities.ByteArrayReverseToInt(tempByteArray)); return(sfoHeader); }