Create Temp Files Using Java NIO and more

jSparrow 3.21.0 & jSparrow Maven Plugin 2.18.0 released

The autumn jSparrow release brings improvements in performance, security, and I/O operations.

Use Offset Based String Methods

This rule avoids creating intermediate String instances by making use of the overloaded offset based methods in the String API.

is refactored to:

Create Temp Files Using Java NIO

A suitable alternative for creating temporary files in security-sensitive applications is to use Files.createTempFile(String, String, FileAttribute<?>…). This rule replaces the temporary file creation using java.io.File by the alternative methods defined in java.nio.file.Files.

is refactored to:

Use Files.newBufferedReader

Java 7 introduced the java.nio.file.Files class that contains convenience methods for operating on files. This rule makes use of the Files.newBufferedReader method for

initializing BufferedReader objects to read text files in an efficient non- blocking manner.

is refactored to:

Use Predefined Standard Charset

The invocations of Charset.forName(String) are replaced by the constants defined in StandardCharsets.

is refactored to:

jSparrow provides now a total of 85 automatic refactoring rules. Find out more information in the Release Notes for jSparrow

Eclipse and jSparrow Maven!

” ‘That hardly ever happens’ is another way of saying ‘it happens’.” 

Douglas Crockford

Happy Coding!