private void  CreateCompoundFile()
        {
            CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, segment + ".cfs");

            System.Collections.ArrayList files = new System.Collections.ArrayList(COMPOUND_EXTENSIONS.Length + fieldInfos.Size());

            // Basic files
            for (int i = 0; i < COMPOUND_EXTENSIONS.Length; i++)
            {
                files.Add(segment + "." + COMPOUND_EXTENSIONS[i]);
            }

            // Field norm files
            for (int i = 0; i < fieldInfos.Size(); i++)
            {
                FieldInfo fi = fieldInfos.FieldInfo(i);
                if (fi.isIndexed)
                {
                    files.Add(segment + ".f" + i);
                }
            }

            // Vector files
            if (fieldInfos.HasVectors())
            {
                for (int i = 0; i < VECTOR_EXTENSIONS.Length; i++)
                {
                    files.Add(segment + "." + VECTOR_EXTENSIONS[i]);
                }
            }

            // Now merge all added files
            System.Collections.IEnumerator it = files.GetEnumerator();
            while (it.MoveNext())
            {
                cfsWriter.AddFile((System.String)it.Current);
            }

            // Perform the merge
            cfsWriter.Close();

            // Now delete the source files
            it = files.GetEnumerator();
            while (it.MoveNext())
            {
                directory.DeleteFile((System.String)it.Current);
            }
        }
Example #2
0
		private void  CreateCompoundFile()
		{
			CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, segment + ".cfs");
			
			System.Collections.ArrayList files = new System.Collections.ArrayList(COMPOUND_EXTENSIONS.Length + fieldInfos.Size());
			
			// Basic files
			for (int i = 0; i < COMPOUND_EXTENSIONS.Length; i++)
			{
				files.Add(segment + "." + COMPOUND_EXTENSIONS[i]);
			}
			
			// Field norm files
			for (int i = 0; i < fieldInfos.Size(); i++)
			{
				FieldInfo fi = fieldInfos.FieldInfo(i);
				if (fi.isIndexed)
				{
					files.Add(segment + ".f" + i);
				}
			}
			
			// Vector files
			if (fieldInfos.HasVectors())
			{
				for (int i = 0; i < VECTOR_EXTENSIONS.Length; i++)
				{
					files.Add(segment + "." + VECTOR_EXTENSIONS[i]);
				}
			}
			
			// Now merge all added files
			System.Collections.IEnumerator it = files.GetEnumerator();
			while (it.MoveNext())
			{
				cfsWriter.AddFile((System.String) it.Current);
			}
			
			// Perform the merge
			cfsWriter.Close();
			
			// Now delete the source files
			it = files.GetEnumerator();
			while (it.MoveNext())
			{
				directory.DeleteFile((System.String) it.Current);
			}
		}