示例#1
0
        public static SFOHeader read(FileStream 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);
        }
示例#2
0
        /**
         * Reads an entry of the dataValueTable an return it as String
         *
         * @param fIn
         * @param sfoIndexTableEntry
         * @return String
         * @throws IOException
         */
        public String readEntry(FileStream fIn, SFOIndexTableEntry sfoIndexTableEntry)
        {
            byte[] entryByteArray = new byte[sfoIndexTableEntry.getSizeValueData()];

            fIn.Read(entryByteArray, 0, sfoIndexTableEntry.getSizeValueData());
            valueBytesReaded += sfoIndexTableEntry.getSizeValueData();

            long offsetNextValue = sfoIndexTableEntry.getOffsetDataValueInDataTable() + sfoIndexTableEntry.getSizeValueDataAndPadding();       // korrekt!
            long skipBytes       = (offsetNextValue) - valueBytesReaded;

            fIn.Seek(skipBytes, SeekOrigin.Current);
            valueBytesReaded += Convert.ToInt32(skipBytes);

            return(SFOReaderUtilities.byteArrayToString(entryByteArray, true));
        }