Created
March 10, 2021 17:28
-
-
Save Mai-Lapyst/fe16a1ca9dd28ec240f20fc2813cef1c to your computer and use it in GitHub Desktop.
simple cat like java application; used to test graalvm --static builds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.nio.*; | |
import java.nio.charset.*; | |
import java.nio.file.*; | |
public class SimpleCat { | |
public static void main(String[] args) { | |
Path file = FileSystems.getDefault().getPath(args[0]); | |
Charset charset = Charset.forName("US-ASCII"); | |
try (BufferedReader reader = Files.newBufferedReader(file, charset)) { | |
String line = null; | |
while ((line = reader.readLine()) != null) { | |
System.out.println(line); | |
} | |
} catch (IOException x) { | |
System.err.format("IOException: %s%n", x); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment