Exemplo n.º 1
0
        /*
         * Scan the given directory for files containing the substrMatch<br>
         * Small case extensions '.dbf' are recognized and returned as '.DBF'
         */
        public static java.util.Vector <Object> getAllFiles(String path, String suffix)
        {
            java.util.Vector <Object> vec = null;
            String[]     fileNameList;
            java.io.File currentDir, f;
            String       fileName, upperSuffix;
            int          i;

            upperSuffix  = suffix.toUpperCase();
            currentDir   = new java.io.File(path);
            fileNameList = currentDir.list();
            if (fileNameList == null)
            {
                java.lang.SystemJ.outJ.println("*** null for " + path);
            }
            else
            {
                vec = new java.util.Vector <Object>(fileNameList.Length);
                for (i = 0; i < fileNameList.Length; i++)
                {
                    f = new java.io.File(fileNameList[i]);
                    if (!f.isDirectory())
                    {
                        fileName = f.getPath().toString().toUpperCase();
                        //           lastModified = new java.util.Date(f.lastModified());
                        if (upperSuffix == null | fileName.endsWith(upperSuffix))
                        {
                            vec.addElement(f);
                        }
                    }
                }
            }
            return(vec);
        }
Exemplo n.º 2
0
        /**
         * If this entry represents a file, and the file is a directory, return
         * an array of TarEntries for this entry's children.
         *
         * @return An array of TarEntry's for this entry's children.
         */
        public TarArchiveEntry[] getDirectoryEntries()
        {
            if (file == null || !file.isDirectory())
            {
                return(new TarArchiveEntry[0]);
            }

            String[]          list   = file.list();
            TarArchiveEntry[] result = new TarArchiveEntry[list.Length];

            for (int i = 0; i < list.Length; ++i)
            {
                result[i] = new TarArchiveEntry(new java.io.File(file, list[i]));
            }

            return(result);
        }