getAbsoluteFile() private method

private getAbsoluteFile ( ) : global::java.io.File
return global::java.io.File
Esempio n. 1
0
        public static bool ToFile(string filePath, Table table, TableContainType tableContainType)
        {
            FileInfo _csvfilesave = new FileInfo(filePath);

            if (!Directory.Exists(_csvfilesave.DirectoryName))
            {
                Directory.CreateDirectory(_csvfilesave.DirectoryName);
            }

            java.io.File outputFile = new java.io.File(filePath);

            BufferedWriter bufferedWriter = null;

            try
            {
                var fileWriter = new OutputStreamWriter(new FileOutputStream(outputFile.getAbsoluteFile()), "UTF-8");
                bufferedWriter = new BufferedWriter(fileWriter);

                outputFile.createNewFile();

                technology.tabula.writers.Writer writer = null;
                switch (tableContainType)
                {
                case TableContainType.CSV:
                    writer = new CSVWriter();
                    break;

                case TableContainType.Json:
                    writer = new JSONWriter();
                    break;

                case TableContainType.TSV:
                    writer = new TSVWriter();
                    break;

                default:
                    writer = new JSONWriter();
                    break;
                }

                writer.write(bufferedWriter, table);
            }
            catch
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
 public static File findFileOnClassPath(string name)
 {
   StringTokenizer stringTokenizer = new StringTokenizer(System.getProperty("java.class.path"), System.getProperty("path.separator"));
   while (stringTokenizer.hasMoreTokens())
   {
     File file1 = new File(stringTokenizer.nextToken());
     File absoluteFile = file1.getAbsoluteFile();
     if (absoluteFile.isFile())
     {
       File.__\u003Cclinit\u003E();
       File file2 = new File(absoluteFile.getParent(), name);
       if (file2.exists())
         return file2;
     }
     else
     {
       File file2 = new File(file1, name);
       if (file2.exists())
         return file2;
     }
   }
   return (File) null;
 }