Tagged: #file

How to zip file in java

How to create a zip file in Java

In this tutorial, we show how to create a zip file from multiple files in Java. 1- ByteArrayOutputStream & ZipOutputStream Using ByteArrayOutputStream and ZipOutputStream classes provided by the JDK, you...

How to read a plain text file in Java

How to read a plain text file in Java

This tutorial shows several ways for reading plain text files in Java. The techniques we use here are totally JDK built-in and don’t depend on external libraries. 1- BufferedReader The...

Java – Convert File to byte[]

Java – Convert File to byte[]

This tutorial shows several ways to convert a File object to a byte[] array in Java. 1- Traditional way The traditional conversion way is through using read() method of InputStream as...

Java – Convert byte[] to File

Java – Convert byte[] to File

This tutorial shows several ways to convert a byte[] array to File in Java. 1- Traditional way The traditional way of doing the conversion is through using FileOutputStream as the...