How to find files with the file extension in Java
This article shows how to Java 8 Files.walk to walk a file tree and stream operation filter to find files that match a specific file extension from a folder and…
Favourite tutorials for developers
This article shows how to Java 8 Files.walk to walk a file tree and stream operation filter to find files that match a specific file extension from a folder and…
In Java, we can use the NIO Files.delete(Path) and Files.deleteIfExists(Path) to delete a file. The Files.delete(Path) deletes a file, returns nothing, or throws an exception if it fails. If the…
This article shows how to use the following Java APIs to append text to the end of a file. (1) Files.write – Append a single line to a file, Java…
In Java, we can use Files.write to create and write to a file. The Files.write also accepts an Iterable interface; it means this API can write a List to a…
In Java, we can use BufferedWriter to write content into a file, safety with try-resources in Java 7+. If possible, uses Files.write instead, one line, simple and nice. For Append…
In Java, we use FileInputStream to read bytes from a file, such as an image file or binary file. The FileInputStream.read() reads a byte at a time, and it will…
In Java, FileOutputStream is a bytes stream class that’s used to handle raw binary data. To write the data to file, you have to convert the data into bytes and…
Here is another example to show how to read a file in Java with BufferedInputStream and DataInputStream classes. The readLine() from the type DataInputStream is deprecated. Sun officially announced this…
In Java, file permissions are very OS specific: *nix , NTFS (windows) and FAT/FAT32, all have different kind of file permissions. Java comes with some generic file permission to deal…
In non static method, we use getClass() of the object or instance. In static method, the getClass() method will be failed, and prompts Cannot make a static reference to the…