public SortedDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, NumericDocValues docToOrd, FST<long> fst, FST<long>.BytesReader @in, FST<long>.Arc<long> firstArc, FST<long>.Arc<long> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long> fstEnum)
 {
     this.OuterInstance = outerInstance;
     this.Entry = entry;
     this.DocToOrd = docToOrd;
     this.Fst = fst;
     this.@in = @in;
     this.FirstArc = firstArc;
     this.ScratchArc = scratchArc;
     this.ScratchInts = scratchInts;
     this.FstEnum = fstEnum;
 }
 public SortedSetDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, BinaryDocValues docToOrds, FST<long> fst, FST<long>.BytesReader @in, FST<long>.Arc<long> firstArc, FST<long>.Arc<long> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long> fstEnum, BytesRef @ref, ByteArrayDataInput input)
 {
     this.OuterInstance = outerInstance;
     this.Entry = entry;
     this.DocToOrds = docToOrds;
     this.Fst = fst;
     this.@in = @in;
     this.FirstArc = firstArc;
     this.ScratchArc = scratchArc;
     this.ScratchInts = scratchInts;
     this.FstEnum = fstEnum;
     this.@ref = @ref;
     this.Input = input;
 }
 public SortedDocValuesAnonymousInnerClassHelper(FSTEntry entry, NumericDocValues docToOrd, FST<long?> fst, FST<long?>.BytesReader @in, FST<long?>.Arc<long?> firstArc, FST<long?>.Arc<long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum<long?> fstEnum)
 {
     this.Entry = entry;
     this.DocToOrd = docToOrd;
     this.Fst = fst;
     this.@in = @in;
     this.FirstArc = firstArc;
     this.ScratchArc = scratchArc;
     this.ScratchInts = scratchInts;
     this.FstEnum = fstEnum;
 }
        private void ReadFields(IndexInput meta, FieldInfos infos)
        {
            int fieldNumber = meta.ReadVInt();
            while (fieldNumber != -1)
            {
                // check should be: infos.fieldInfo(fieldNumber) != null, which incorporates negative check
                // but docvalues updates are currently buggy here (loading extra stuff, etc): LUCENE-5616
                if (fieldNumber < 0)
                {
                    // trickier to validate more: because we re-use for norms, because we use multiple entries
                    // for "composite" types like sortedset, etc.
                    throw new CorruptIndexException("Invalid field number: " + fieldNumber + ", input=" + meta);
                }
                int fieldType = meta.ReadByte();
                if (fieldType == NUMBER)
                {
                    var entry = new NumericEntry {Offset = meta.ReadLong(), Format = (sbyte)meta.ReadByte()};
                    switch (entry.Format)
                    {
                        case DELTA_COMPRESSED:
                        case TABLE_COMPRESSED:
                        case GCD_COMPRESSED:
                        case UNCOMPRESSED:
                            break;

                        default:
                            throw new CorruptIndexException("Unknown format: " + entry.Format + ", input=" + meta);
                    }
                    if (entry.Format != UNCOMPRESSED)
                    {
                        entry.PackedIntsVersion = meta.ReadVInt();
                    }
                    Numerics[fieldNumber] = entry;
                }
                else if (fieldType == BYTES)
                {
                    BinaryEntry entry = new BinaryEntry();
                    entry.Offset = meta.ReadLong();
                    entry.NumBytes = meta.ReadLong();
                    entry.MinLength = meta.ReadVInt();
                    entry.MaxLength = meta.ReadVInt();
                    if (entry.MinLength != entry.MaxLength)
                    {
                        entry.PackedIntsVersion = meta.ReadVInt();
                        entry.BlockSize = meta.ReadVInt();
                    }
                    Binaries[fieldNumber] = entry;
                }
                else if (fieldType == FST)
                {
                    FSTEntry entry = new FSTEntry();
                    entry.Offset = meta.ReadLong();
                    entry.NumOrds = meta.ReadVLong();
                    Fsts[fieldNumber] = entry;
                }
                else
                {
                    throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
                }
                fieldNumber = meta.ReadVInt();
            }
        }
 public SortedDocValuesAnonymousInnerClassHelper(FSTEntry fstEntry,
     NumericDocValues numericDocValues, FST<long?> fst1, FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc1,
     IntsRef intsRef, BytesRefFSTEnum<long?> bytesRefFstEnum)
 {
     entry = fstEntry;
     docToOrd = numericDocValues;
     fst = fst1;
     this.@in = @in;
     firstArc = arc;
     scratchArc = scratchArc1;
     scratchInts = intsRef;
     fstEnum = bytesRefFstEnum;
 }
 public SortedSetDocValuesAnonymousInnerClassHelper(FSTEntry fstEntry, BinaryDocValues binaryDocValues, FST<long?> fst1,
     FST.BytesReader @in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc1, IntsRef intsRef, BytesRefFSTEnum<long?> bytesRefFstEnum,
     BytesRef @ref, ByteArrayDataInput byteArrayDataInput)
 {
     entry = fstEntry;
     docToOrds = binaryDocValues;
     fst = fst1;
     this.@in = @in;
     firstArc = arc;
     scratchArc = scratchArc1;
     scratchInts = intsRef;
     fstEnum = bytesRefFstEnum;
     this.@ref = @ref;
     input = byteArrayDataInput;
 }
Exemple #7
0
        private void ReadFields(IndexInput meta, FieldInfos infos)
        {
            int fieldNumber = meta.ReadVInt32();

            while (fieldNumber != -1)
            {
                // check should be: infos.fieldInfo(fieldNumber) != null, which incorporates negative check
                // but docvalues updates are currently buggy here (loading extra stuff, etc): LUCENE-5616
                if (fieldNumber < 0)
                {
                    // trickier to validate more: because we re-use for norms, because we use multiple entries
                    // for "composite" types like sortedset, etc.
                    throw new CorruptIndexException("Invalid field number: " + fieldNumber + ", input=" + meta);
                }
                int fieldType = meta.ReadByte();
                if (fieldType == NUMBER)
                {
                    var entry = new NumericEntry();
                    entry.Offset = meta.ReadInt64();
                    entry.Format = (sbyte)meta.ReadByte();
                    switch (entry.Format)
                    {
                    case DELTA_COMPRESSED:
                    case TABLE_COMPRESSED:
                    case GCD_COMPRESSED:
                    case UNCOMPRESSED:
                        break;

                    default:
                        throw new CorruptIndexException("Unknown format: " + entry.Format + ", input=" + meta);
                    }
                    if (entry.Format != UNCOMPRESSED)
                    {
                        entry.PackedInt32sVersion = meta.ReadVInt32();
                    }
                    numerics[fieldNumber] = entry;
                }
                else if (fieldType == BYTES)
                {
                    BinaryEntry entry = new BinaryEntry();
                    entry.Offset    = meta.ReadInt64();
                    entry.NumBytes  = meta.ReadInt64();
                    entry.MinLength = meta.ReadVInt32();
                    entry.MaxLength = meta.ReadVInt32();
                    if (entry.MinLength != entry.MaxLength)
                    {
                        entry.PackedInt32sVersion = meta.ReadVInt32();
                        entry.BlockSize           = meta.ReadVInt32();
                    }
                    binaries[fieldNumber] = entry;
                }
                else if (fieldType == FST)
                {
                    FSTEntry entry = new FSTEntry();
                    entry.Offset      = meta.ReadInt64();
                    entry.NumOrds     = meta.ReadVInt64();
                    fsts[fieldNumber] = entry;
                }
                else
                {
                    throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
                }
                fieldNumber = meta.ReadVInt32();
            }
        }
 private void ReadFields(IndexInput meta, FieldInfos infos)
 {
     int fieldNumber = meta.ReadVInt();
     while (fieldNumber != -1)
     {
         int fieldType = meta.ReadByte();
         if (fieldType == NUMBER)
         {
             var entry = new NumericEntry {offset = meta.ReadLong(), missingOffset = meta.ReadLong()};
             if (entry.missingOffset != -1)
             {
                 entry.missingBytes = meta.ReadLong();
             }
             else
             {
                 entry.missingBytes = 0;
             }
             entry.format = meta.ReadByte();
             switch (entry.format)
             {
                 case DELTA_COMPRESSED:
                 case TABLE_COMPRESSED:
                 case GCD_COMPRESSED:
                 case UNCOMPRESSED:
                     break;
                 default:
                     throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
             }
             if (entry.format != UNCOMPRESSED)
             {
                 entry.packedIntsVersion = meta.ReadVInt();
             }
             numerics[fieldNumber] = entry;
         }
         else if (fieldType == BYTES)
         {
             var entry = new BinaryEntry
             {
                 offset = meta.ReadLong(),
                 numBytes = meta.ReadLong(),
                 missingOffset = meta.ReadLong()
             };
             if (entry.missingOffset != -1)
             {
                 entry.missingBytes = meta.ReadLong();
             }
             else
             {
                 entry.missingBytes = 0;
             }
             entry.minLength = meta.ReadVInt();
             entry.maxLength = meta.ReadVInt();
             if (entry.minLength != entry.maxLength)
             {
                 entry.packedIntsVersion = meta.ReadVInt();
                 entry.blockSize = meta.ReadVInt();
             }
             binaries[fieldNumber] = entry;
         }
         else if (fieldType == FST)
         {
             var entry = new FSTEntry {offset = meta.ReadLong(), numOrds = meta.ReadVLong()};
             fsts[fieldNumber] = entry;
         }
         else
         {
             throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
         }
         fieldNumber = meta.ReadVInt();
     }
 }
 public SortedSetDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, BinaryDocValues docToOrds, FST <long?> fst, FST <long?> .BytesReader @in, FST <long?> .Arc <long?> firstArc, FST <long?> .Arc <long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum <long?> fstEnum, BytesRef @ref, ByteArrayDataInput input)
 {
     this.OuterInstance = outerInstance;
     this.Entry         = entry;
     this.DocToOrds     = docToOrds;
     this.Fst           = fst;
     this.@in           = @in;
     this.FirstArc      = firstArc;
     this.ScratchArc    = scratchArc;
     this.ScratchInts   = scratchInts;
     this.FstEnum       = fstEnum;
     this.@ref          = @ref;
     this.Input         = input;
 }
 public SortedDocValuesAnonymousInnerClassHelper(Lucene42DocValuesProducer outerInstance, FSTEntry entry, NumericDocValues docToOrd, FST <long?> fst, FST <long?> .BytesReader @in, FST <long?> .Arc <long?> firstArc, FST <long?> .Arc <long?> scratchArc, IntsRef scratchInts, BytesRefFSTEnum <long?> fstEnum)
 {
     this.OuterInstance = outerInstance;
     this.Entry         = entry;
     this.DocToOrd      = docToOrd;
     this.Fst           = fst;
     this.@in           = @in;
     this.FirstArc      = firstArc;
     this.ScratchArc    = scratchArc;
     this.ScratchInts   = scratchInts;
     this.FstEnum       = fstEnum;
 }
Exemple #11
0
        public VirtualFilesystemDirectory LoadISO(EndianBinaryReader reader)
        {
            // This will hold the file system entries that we grab from the ISO.
            List <FSTEntry> FSTTest = new List <FSTEntry>();

            int FSTOffset = reader.ReadInt32At(0x424);

            reader.BaseStream.Position = FSTOffset;

            int numEntries        = reader.ReadInt32At(reader.BaseStream.Position + 8);
            int stringTableOffset = numEntries * 0xC; // Each FST entry is 12/0xC bytes long

            for (int i = 0; i < numEntries; i++)
            {
                FSTEntry fst = new FSTEntry();

                fst.Type = (FSTNodeType)reader.ReadByte();
                reader.SkipByte();                                                         // Padding

                int    curPos       = (int)reader.BaseStream.Position;                     // Save the current stream position
                ushort stringOffset = (ushort)reader.ReadInt16();                          // Get the offset to the entry's name

                reader.BaseStream.Position = stringOffset + stringTableOffset + FSTOffset; // Seek to entry's name

                string name = reader.ReadStringUntil('\0');
                fst.RelativeFileName = name;

                reader.BaseStream.Position = curPos + 2; // Return to where we were so that we can read additional data for this entry

                fst.FileOffsetParentDir  = reader.ReadInt32();
                fst.FileSizeNextDirIndex = reader.ReadInt32();

                FSTTest.Add(fst);
            }

            // Root of the ISO. The function will return this.
            VirtualFilesystemDirectory rootDir = new VirtualFilesystemDirectory("root");
            // Holds system data. DOL, apploader, etc. Named to provide compatibility with GCRebuilder
            VirtualFilesystemDirectory sysData = new VirtualFilesystemDirectory("&&systemdata");

            // Header data for the ISO
            byte[] headerData = reader.ReadBytesAt(0, 0x2440);
            sysData.Children.Add(new VirtualFilesystemFile("iso", ".hdr", new VirtualFileContents(headerData)));

            int headerOffset = reader.ReadInt32At(0x420);

            // Executable data
            byte[] dolData = reader.ReadBytesAt(headerOffset, FSTOffset - headerOffset);
            sysData.Children.Add(new VirtualFilesystemFile("Start", ".dol", new VirtualFileContents(dolData)));

            // Apploader
            byte[] appLoaderData = reader.ReadBytesAt(0x2440, headerOffset - 0x2440);
            sysData.Children.Add(new VirtualFilesystemFile("AppLoader", ".ldr", new VirtualFileContents(appLoaderData)));

            // Table of contents (FST)
            byte[] fstData = reader.ReadBytesAt(FSTOffset, reader.ReadInt32At(0x428));
            sysData.Children.Add(new VirtualFilesystemFile("Game", ".toc", new VirtualFileContents(fstData)));

            rootDir.Children.Add(sysData);

            int count = 1;

            while (count < numEntries)
            {
                if (FSTTest[count].Type == FSTNodeType.Directory)
                {
                    VirtualFilesystemDirectory dir = new VirtualFilesystemDirectory(FSTTest[count].RelativeFileName);
                    FSTEntry curEnt = FSTTest[count];

                    while (count < curEnt.FileSizeNextDirIndex - 1)
                    {
                        count = GetDirStructureRecursive(count + 1, FSTTest, FSTTest[count + 1], dir, reader);
                    }

                    rootDir.Children.Add(dir);
                }
                else
                {
                    VirtualFilesystemFile file = GetFileData(FSTTest[count], reader);
                    rootDir.Children.Add(file);
                }

                count += 1;
            }

            return(rootDir);
        }
Exemple #12
0
 public FileEntry(FSTEntry entry)
 {
     FstEntry = entry;
 }
Exemple #13
0
        private void ReadFields(IndexInput meta, FieldInfos infos)
        {
            int fieldNumber = meta.ReadVInt32();

            while (fieldNumber != -1)
            {
                int fieldType = meta.ReadByte();
                if (fieldType == NUMBER)
                {
                    var entry = new NumericEntry {
                        offset = meta.ReadInt64(), missingOffset = meta.ReadInt64()
                    };
                    if (entry.missingOffset != -1)
                    {
                        entry.missingBytes = meta.ReadInt64();
                    }
                    else
                    {
                        entry.missingBytes = 0;
                    }
                    entry.format = meta.ReadByte();
                    switch (entry.format)
                    {
                    case DELTA_COMPRESSED:
                    case TABLE_COMPRESSED:
                    case GCD_COMPRESSED:
                    case UNCOMPRESSED:
                        break;

                    default:
                        throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
                    }
                    if (entry.format != UNCOMPRESSED)
                    {
                        entry.packedIntsVersion = meta.ReadVInt32();
                    }
                    numerics[fieldNumber] = entry;
                }
                else if (fieldType == BYTES)
                {
                    var entry = new BinaryEntry
                    {
                        offset        = meta.ReadInt64(),
                        numBytes      = meta.ReadInt64(),
                        missingOffset = meta.ReadInt64()
                    };
                    if (entry.missingOffset != -1)
                    {
                        entry.missingBytes = meta.ReadInt64();
                    }
                    else
                    {
                        entry.missingBytes = 0;
                    }
                    entry.minLength = meta.ReadVInt32();
                    entry.maxLength = meta.ReadVInt32();
                    if (entry.minLength != entry.maxLength)
                    {
                        entry.packedIntsVersion = meta.ReadVInt32();
                        entry.blockSize         = meta.ReadVInt32();
                    }
                    binaries[fieldNumber] = entry;
                }
                else if (fieldType == FST)
                {
                    var entry = new FSTEntry {
                        offset = meta.ReadInt64(), numOrds = meta.ReadVInt64()
                    };
                    fsts[fieldNumber] = entry;
                }
                else
                {
                    throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta);
                }
                fieldNumber = meta.ReadVInt32();
            }
        }