| | |
| | | mf.setPath(f.getPath().substring(subPath.length())); |
| | | |
| | | if (isShp) { |
| | | mf.setTab(fileName); |
| | | List<String> shpFiles = getShpFiles(f.getPath()); |
| | | mf.setTab(fileName); |
| | | mf.setSizes(getFilesSize(shpFiles)); |
| | | mf.setGuid(getFilesMd5(shpFiles)); |
| | | } else { |
| | | mf.setSizes(FileHelper.sizeToMb(f.length())); |
| | |
| | | * 获取GDB文件集合 |
| | | */ |
| | | private List<String> getGdbFiles(String path) { |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | File[] files = new File(path).listFiles(); |
| | | if (null == files || files.length == 0) { |
| | | return null; |
| | | return list; |
| | | } |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | for (File f : files) { |
| | | list.add(f.getPath()); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取多文件的大小 |
| | | */ |
| | | private double getFilesSize(List<String> files) { |
| | | long size = 0L; |
| | | for (String file : files) { |
| | | File f = new File(file); |
| | | if (f.exists() && !f.isDirectory()) { |
| | | size += f.length(); |
| | | } |
| | | } |
| | | |
| | | return FileHelper.sizeToMb(size); |
| | | } |
| | | |
| | | /** |
| | | * 获取GDB文件映射 |
| | | */ |
| | | private List<MetaFileEntity> getGdbMappers(File f, MetaFileEntity meta, String subPath) { |
| | |
| | | |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | String extName = FileHelper.getExtension(fileName); |
| | | |
| | | List<String> gdbFiles = getGdbFiles(f.getPath()); |
| | | String md5 = getFilesMd5(gdbFiles); |
| | | double sizes = getFilesSize(gdbFiles); |
| | | |
| | | List<MetaFileEntity> list = new ArrayList<>(); |
| | | for (String tab : tabs) { |
| | |
| | | mf.setSizes(FileHelper.sizeToMb(f.length())); |
| | | mf.setPath(f.getPath().substring(subPath.length())); |
| | | mf.setTab(tab); |
| | | mf.setSizes(sizes); |
| | | mf.setGuid(md5); |
| | | list.add(mf); |
| | | } |
| | | |
| | | return null; |
| | | return list; |
| | | } |
| | | |
| | | /** |