TextFileReaderTest.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:kafka-connect-fs 作者:
private static Path createDataFile() throws IOException {
    File txtFile = File.createTempFile("test-", "." + FILE_EXTENSION);
    try (FileWriter writer = new FileWriter(txtFile)) {

        IntStream.range(0, NUM_RECORDS).forEach(index -> {
            String value = String.format("%d_%s", index, UUID.randomUUID());
            try {
                writer.append(value + "\n");
                OFFSETS_BY_INDEX.put(index, Long.valueOf(index++));
            } catch (IOException ioe) {
                throw new RuntimeException(ioe);
            }
        });
    }
    Path path = new Path(new Path(fsUri), txtFile.getName());
    fs.moveFromLocalFile(new Path(txtFile.getAbsolutePath()), path);
    return path;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号