File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
src/examples/java/software/amazon/nio/spi/examples Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 22
33import java .io .IOException ;
44import java .net .URI ;
5+ import java .nio .file .Files ;
56import java .nio .file .Path ;
67import java .nio .file .Paths ;
8+ import java .util .stream .Stream ;
79
810public class ListPrefix {
911 public static void main (String [] args ) throws IOException {
@@ -12,15 +14,10 @@ public static void main(String[] args) throws IOException {
1214 System .exit (1 );
1315 }
1416
15- String prefix = args [0 ];
16-
17- Path s3Path = Paths .get (URI .create (prefix ));
18-
19- assert s3Path .getClass ().getName ().contains ("S3Path" );
20-
21- s3Path .getFileSystem ().provider ()
22- .newDirectoryStream (s3Path , item -> true )
23- .forEach (path -> System .out .println (path .getFileName ()));
17+ Path s3Path = Paths .get (URI .create (args [0 ]));
2418
19+ try (Stream <Path > listed = Files .list (s3Path )) {
20+ listed .forEach (System .out ::println );
21+ }
2522 }
2623}
You can’t perform that action at this time.
0 commit comments