- Implementation on all features in `clientSettings`
  - Code optimization
  - More detail exceptions
  - Downloading gifts
This commit is contained in:
JW
2023-08-23 20:55:40 +02:00
parent 74bfe0b9e7
commit d9ef60ccad
46 changed files with 684 additions and 568 deletions

View File

@@ -0,0 +1,38 @@
package io.github.jwdeveloper.tiktok.utils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
public class FilesUtility
{
public static List<Path> getFiles(String input) {
Path path = Paths.get(input);
try (Stream<Path> paths = Files.list(path)) {
return paths.filter(Files::isRegularFile).toList();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static void saveFile(String path, String content)
{
Path filePath = Paths.get(path);
try {
// Write the content to the file
Files.write(filePath, content.getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
}
}