为什么在获取服务器目录时file.isDirectory()就不往下走了,直接就走完了,但是我访问
本地的却可以,求大神解答 public String readfile(String filepath, String hostFlow,String bizFlowNo){ File file = new File(filepath); if (!file.isDirectory()) { } else if (file.isDirectory()) { String[] filelist = file.list(); for (int i = 0; i < filelist.length; i++) { File readfile = new File(filepath + "\\" + filelist[i]); if (!readfile.isDirectory()) { String name = readfile.getName(); String[] namepathch = name.split(UNDERLINE); if (namepathch.length > 4){ namepathch = Arrays.copyOfRange(namepathch, 0, 5); StringBuffer split = new StringBuffer(); for (String temp : namepathch) { split.append(temp); split.append(UNDERLINE); } String substring = split.substring(0, split.length() - 1); if (substring.equals(hostFlow) ){ return readfile.getAbsolutePath(); }else{ StringBuffer stringBuffer = new StringBuffer(); String[] pathName = hostFlow.split(UNDERLINE); Arrays.fill(pathName,2,3,bizFlowNo); for(String s : pathName){ stringBuffer.append(s); stringBuffer.append(UNDERLINE); } String serialNumbe = stringBuffer.substring(0, stringBuffer.length() - 1); if (substring.equals(serialNumbe)){ return readfile.getAbsolutePath(); } } } } } } return null; }