Р System.out.println("路径: " + s.getPath().toString());Р System.out.println("权限: " + s.getPermission().toString());Р System.out.println("大小: " + s.getLen());Р /* 返回的是时间戳,转化为时间日期格式*/Р Long timeStamp = s.getModificationTime();Р SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");Р String date = format.format(timeStamp); Р System.out.println("时间: " + date);Р System.out.println();Р }Р fs.close();Р } Р Р?/**Р * 主函数Р */Р?public static void main(String[] args) {Р Configuration conf = new Configuration();Р conf.set("fs.default.name","hdfs://localhost:9000");Р String remoteDir = "/user/hadoop"; // HDFS路径Р Р try {Р System.out.println("(递归)读取目录下所有文件的信息: " + remoteDir);Р HDFSApi.lsDir(conf, remoteDir);Р System.out.println("读取完成");Р } catch (Exception e) {Р e.printStackTrace();Р }Р?}Р}