Count bytes while writing to a file in real-time
Sometimes it is useful to know how many bytes have already been written to an output stream in Java. In this post we will use CountingOutputStream to achieve this goal easily.
Ideas and field notes on engineering, design, and the architecture behind software that lasts. Written for people who care about how things are made.
Sometimes it is useful to know how many bytes have already been written to an output stream in Java. In this post we will use CountingOutputStream to achieve this goal easily.
Most JSON data can be parsed in memory, but there are some edge cases when we have to process big data files - e.g. a database export or a data from a third party provider. For these scenarios the Jackson library provides stream-based read and write mechanisms to handle huge files efficiently.
Most of the time it is beneficial to parse and modify JSON data using an underlying Java object. But, there are some scenarios where parsing the entire data structure is not necessary and thus, low-level read and write methods from the Jackson library might be more efficient. In this post I will evaluate how some of those low-level methods can be used.
This is a quick post that explains how to read a file from the resources folder (Classpath) within a Spring Boot command line application.