Exemplo n.º 1
0
        protected internal virtual ICollection <string> BuildSplitMap(string path)
        {
            path = DataFilePaths.Convert(path);
            ICollection <string> fileSet = Generics.NewHashSet();
            LineNumberReader     reader  = null;

            try
            {
                reader = new LineNumberReader(new FileReader(path));
                while (reader.Ready())
                {
                    string line = reader.ReadLine();
                    fileSet.Add(line.Trim());
                }
                reader.Close();
            }
            catch (FileNotFoundException)
            {
                System.Console.Error.Printf("%s: Could not open split file %s\n", this.GetType().FullName, path);
            }
            catch (IOException)
            {
                System.Console.Error.Printf("%s: Error reading split file %s (line %d)\n", this.GetType().FullName, path, reader.GetLineNumber());
            }
            return(fileSet);
        }
Exemplo n.º 2
0
        private ICollection <string> MakeSplitSet(string splitFileName)
        {
            splitFileName = DataFilePaths.Convert(splitFileName);
            ICollection <string> splitSet = Generics.NewHashSet();
            LineNumberReader     reader   = null;

            try
            {
                reader = new LineNumberReader(new FileReader(splitFileName));
                for (string line; (line = reader.ReadLine()) != null;)
                {
                    splitSet.Add(line.Trim());
                }
                reader.Close();
            }
            catch (FileNotFoundException e)
            {
                Sharpen.Runtime.PrintStackTrace(e);
            }
            catch (IOException e)
            {
                System.Console.Error.Printf("%s: Error reading %s (line %d)%n", this.GetType().FullName, splitFileName, reader.GetLineNumber());
                Sharpen.Runtime.PrintStackTrace(e);
            }
            return(splitSet);
        }