A replica of the wc tool, implemented in Java 17, designed to output the number of lines, words, characters, and bytes for each input file. If multiple files are specified, it also provides a total count of lines, words, characters, and bytes. A word is defined as a non-zero-length sequence of printable characters separated by whitespace.
- Object-Oriented Programming Principles;
- Collections Framework — Array, ArraysList and HashMap;
- Lambda functions, Streams and Method references along with serialization into a JSON;
- Design patterns from the GoF: Singleton and Builder along with Dependency Injection and Inversion of Control;
- Spring Boot with CommandLineRunner interface and Lombok, Jackson and Apache Commons CLI dependencies;
- GraalVM for conversion from .jar into a binary file;
- Logging and banner were disabled (spring.main.banner-mode=OFF, logging.level.root=WARN) on Spring Boot along with Tomcat Server (spring.main.web-application-type=NONE);
- Asynchronous with Concurrency processing implemented with CompletableStage/CompletableFuture API to handle multiple files as input much easier and faster;
- IO and NIO libraries for input/output processing;
Note
Challenge is 💯 completed!
✅ In the target directory in this repo you can find everything you need to run the app, the .jar and binary file made with GraalVM.
✅ Use it with short options and files as input.
✅ Use it with short/long options with files or standard input.
✅ What happens when proper input is not provided (wrong options, files, etc).
👉 If you want to see the code and make additions, you can clone this repo and try it. In case you want a binary file as a final product, then you need to install SDKMAN from sdkman.io and then with sdk GraalVM (22.3.r17-nik). Please know that for this project I'm using Java 17 Corretto from Amazon. Before you start to build the binary file with Maven, make sure that Runtime Environment is set to GraalVM as you can see bellow:
[root@republic]# java --version
openjdk 17.0.5 2022-10-18 LTS
OpenJDK Runtime Environment GraalVM 22.3.0 (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM GraalVM 22.3.0 (build 17.0.5+8-LTS, mixed mode, sharing)
[root@republic]#
For any inquiries, please contact me www.linkedin.com/in/valentin-soare