Java program to implement file input stream class to read binary data from image file.

import java.io.FileInputStream;
import java.io.IOException;

public class ReadImageFile {
    public static void main(String[] args) {
        String imagePath = "yourImageFile.jpg"; // Replace with the actual image file path and name

        try (FileInputStream fileInputStream = new FileInputStream(imagePath)) {
            int byteRead;
            while ((byteRead = fileInputStream.read()) != -1) {
                System.out.print((char) byteRead);
            }
        } catch (IOException e) {
            System.err.println("Error reading the image file: " + e.getMessage());
        }
    }
}

Comments

Popular posts from this blog

What is a Web Browser? वेब ब्राउज़र क्या है?

Java's Support System जावा का सहयोगी तंत्र

The Internet and Java इंटरनेट और जावा का सम्बन्ध