Blog Archives

Reloading configuration files in Java without stopping the server

Q1. Why & when do you want to use properties files for the project configuration as opposed to Java constants? A1. It is a best practice to externalize application related properties that are likely to change. If you hard code the properties that are likely to change, then you need

Read more ›

Posted in IO

Read a text file from Java classpath

File to read: src/main/resources/examples/request.xml

1. Using Java API without any libraries

You can also use the “ClassLoader”

2. Using Java 7 NIO

3. Using Apache commons-io library

4. Using Spring library

5. Using Java 8 API

Posted in IO

06: ♥ Java 8 way of File reading and functionally processing the data

Output:

#1 double colon notation :: The new double colon (::) operator that Java 8 has to convert a normal method into lambda expression. So, Instead of:

You can do:

#2 Why is stream::iterator used? “lines::iterator” where iterator() is an instance method on “BaseStream<T,Stream<T>>” from which

Read more ›

Posted in IO, Java 8
Tags:

♥ Reading a text file in Java with the Scanner

As a Java developer it is a very common task to read file contents to a String object. It is also very common in pre-interview written tests read the contents of a file and apply regex to split string, etc. 4 things to watch-out for in File processing 1) Files

Read more ›

Posted in IO

Processing large files efficiently in Java – part 2

Processing large files efficiently in Java – part 1 covered different ways to read a large file. This post extends that to include some processing logic in addition to reading a file using Java 8 stream. This can be applied to files that can be split. For example, CSV files.

Read more ›

Posted in IO, Performance

Processing large files efficiently in Java – part 1

Q1. What are the key considerations in processing large files? A1. Before jumping into coding, get the requirements. #1. Processing a file involves reading from the disk, processing (e.g. parsing an XML and transforming), and writing back to the disk. It is also a trade off in terms of what

Read more ›

Posted in IO, Memory Management, Performance
Tags:

♦ 15 Java old I/O and NIO (i.e. New I/O) interview Q&As

Q1. What is the purpose of Java I/O System? A1. The purpose is to provide an abstraction for all types of I/O like memory, file, directory, network, and pipe. Pipes in Java IO provides the ability for two threads running in the same JVM to communicate with each other. A…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Training, 90-Day-Java-JEE-Career-Training, 180-Day-Java-JEE-Career-Training, 365-Day-Java-JEE-Career-Training, 60-Day-Java-JEE-Career-Training and 2-Year-Java-JEE-Career-Training

Evaluate the quality of the contents to see if they will add value to you?

Click Here and check the contents with Try OR look for post titles with ♥

Log In | Register
Posted in IO, member-paid
1180+ members Prepare to succeed? | Reviews | Career PDFs | Self-taught Java developer?

800+ Interview Q&As ♥Free | ♦FAQ (Mouse Hover For Full Text)

open all | close all

200+ Java FAQs – Quick Prep

open all | close all

16 Java Key Areas to be a top-notch

open all | close all

80+ Java Tutorials – Step by step

open all | close all

100+ Java Coding Exercises

open all | close all

How good are your "Career Skills"?

open all | close all