Search in sources :

Example 1 with Chars

use of com.questdb.std.Chars in project questdb by bluestreak01.

the class FilesTest method testListDir.

@Test
public void testListDir() {
    String temp = temporaryFolder.getRoot().getAbsolutePath();
    ObjList<String> names = new ObjList<>();
    try (Path path = new Path().of(temp).$()) {
        try (Path cp = new Path()) {
            Assert.assertTrue(Files.touch(cp.of(temp).concat("a.txt").$()));
            NativeLPSZ name = new NativeLPSZ();
            long pFind = Files.findFirst(path);
            Assert.assertTrue(pFind != 0);
            try {
                do {
                    names.add(name.of(Files.findName(pFind)).toString());
                } while (Files.findNext(pFind) > 0);
            } finally {
                Files.findClose(pFind);
            }
        }
    }
    names.sort(Chars::compare);
    Assert.assertEquals("[.,..,a.txt]", names.toString());
}
Also used : Path(com.questdb.std.str.Path) ObjList(com.questdb.std.ObjList) NativeLPSZ(com.questdb.std.str.NativeLPSZ) Chars(com.questdb.std.Chars) Test(org.junit.Test)

Aggregations

Chars (com.questdb.std.Chars)1 ObjList (com.questdb.std.ObjList)1 NativeLPSZ (com.questdb.std.str.NativeLPSZ)1 Path (com.questdb.std.str.Path)1 Test (org.junit.Test)1