Byte Streams in Java

In java programming, to perform input and output of 8-bit, Byte stream is used. Most common byte streams classes are, FileInputStream and FileOutputStream. FileInputStream : FileInputStream is used for reads one byte at a time . FileOutputStream : FileOutputStream is used for writes one byte at a time Writing Bytes Example: Write a program, to write a bytes to … Read more

Concatenate & Buffer File in Java

Here we will concatenating and store buffering files in java using BufferedInputClass and BufferedOutputClass. Concatenate: It is possible to concatenate two or more files and save in a different file. In java, by using SequenceInputStream class we can concatenate two or more files. Buffer Files: In java, we can create a buffer to store temporary … Read more

DataInputStream and DataOutputStream for primitive data

In java, a basic input-output stream provides a method for reading & writing bytes or characters in a file. If we want to read-write primitive data types (such as int, float, etc.) then we can use filter classes to filter data in the original stream. DataInputStream & DataOutputStream are two filter classes used for creating … Read more

Displaying directory contents in Java

For listing a directory content in java we use File class and use isDirectory() method to check whether it is directory or not. if directory then we use listFiles().

Reading a file using FileInputStream

Reading a file using FileInputStream To read a file using FileInputStream in Java, follow these steps: Import the necessary packages:

2. Create a FileInputStream object for the file you want to read:

3. Create a buffer array to store the data you read from the file:

4. Use the read method of … Read more

Displaying file properties

PHP File Handing

File handling is need for any web application so FILE HANDLING is an important part of PHP language. Some task to be done file needs to be processed. PHP have many function handling any kind of normal files. (Liketxt, docx, csv, jpg etc) Handle a file need to know below topics i. File create ii. … Read more

Character Stream I/O in Java

In a java programming, like a Byte stream Character stream is also used for input-output for 16 bit. But Byte streams are used to perform input and output of 8-bit. Most common Character streams classes are, FileReader and FileWriter.  FileReader- FileReader uses for reads two bytes at a time.  FileWriter– FileWriter uses for writes two bytes at a … Read more

Reading a text file

For reading a file we have to create a FileReader object. Then we create BufferedReader object of FileReader. If file not found FileReader constructor throws FileNotFoundException. If br.readLine() is not able to read source file it throws IOException.

Checking whether a file or directory in Java

Checking whether the File object exists if exists then check whether it is file of directory to check file existance exists() method of File class is used if it returns true means file or directory exists, at this point we are not confirm existing File object is file or directory. To check file object isDirectory() … Read more