answersLogoWhite

0

What are uses of FileInputStream and FileOutputSteam?

Updated: 8/20/2019
User Avatar

Wiki User

βˆ™ 10y ago

Best Answer

FileInputStream and FileOutputStream are useful for writing to and reading from files in Java. The streams can be passed to any method that requires an InputStream or OutputStream, respectively.

User Avatar

Wiki User

βˆ™ 10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are uses of FileInputStream and FileOutputSteam?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the uses of File Input Stream and File Output Stream in java programming?

These streams are classified as mode streams as they read and write data from disk files. the classes associated with these streams have constructos that allows us to specify the path of the file to which they are connected. The FileInputStream class allows us to read input from a file in the form of a stream. The FileOutputStream class allows us to write output to a file stream. Example, FileInputStream inputfile = new FileInputStream ("Empolyee.dat"); FileOutputStream outputfile = new FileOutputStream ("binus.dat");


What is the difference between File Reader and FileInputStream in java?

FileReader used to read the character stream in the file.i.e a file that contanis only the character means FileReader is the choice to read the file.On the other hand if the file contains image,byte like raw data format means FileInputStream is the choice to read the data in the file,.


Fetching data from excel sheet from Java?

The Apache POI project is a Java API to read and write Microsoft Documents.The API allows you can read and write MS Excel files using Java.


To read data which is superior 1. input stream 2. file reader?

First of all, these two classes are on different levels of abstraction. An InputStream is used for reading any stream of bytes, while a FileReader is used to read characters from a file. If you want to ask between a FileInputStream and a FileReader, then we need to look at what type of data you are reading. If you're reading plain-text file, for example, you want to use a FileReader because it was designed to read in characters. For other types of data, the FileInputStream would be better, as it is used to read in generic streams of bytes from a file.


Java program that reads a file and display the file on the screen with a line number before each line?

import java.io.*; class Files { public static void main(String a[])throws IOException { int i,line=0,c=0,len; char k; boolean m; File f=new File("info.txt"); FileInputStream f1=new FileInputStream("info.txt"); len=f1.available(); for(i=0;i<=len;i++) { k=(char)f1.read(); c++; System.out.print(k); if(k='/n') { line++; System.out.println(+line); } } System.out.print("number of characters="+c); } }


Java program to read and compress a file?

I dont know you are looking for write new program to compress the data.. I am providing code to zip the file in Java.ZipOutputStream zipOutStream = new ZipOutputStream( new BufferedOutputStream( new FileOutputStream( ZipFileName )) );BufferedInputStream bufferInStram = new BufferedInputStream( new FileInputStream(FileToXip), 2000 );ZipEntry entry = new ZipEntry( excelFileName );zipOutStream.putNextEntry( entry );


Is USES a verb?

It may be:He uses a hammer to build a birdhouse. (uses = verb)A hammer has many uses. (uses = plural noun)


What motor oil goes in a Jeep Laredo 2001?

4.0L uses 10w304.7L uses 5w304.0L uses 10w304.7L uses 5w30


What countries uses dinar as currency?

Algeria uses the Algerian Dinar Bahrain uses the Bahrain DinarIraq uses the Iraqi DinarJordan uses the Jordanian DinarKuwait uses the Kuwaiti Dinar


How do you store and retrieve images from ms-access or MySQL database using JSP source code required?

Here's the code for inserting image into ms-access database <%@page import="java.io.FileInputStream"%><%@page import="java.io.IOException"%><%@page import="java.io.InputStream"%><%@page import="java.io.File"%><%@page import="javax.servlet.*"%><%@page import="javax.servlet.ServletException" %><%@page language="java" import="java.sql.*"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body><% FileInputStream fIn=null; Connection conn = null; PreparedStatement ps=null; String filename=request.getParameter("fileName"); File f=new File(filename); String filepath=f.getAbsolutePath(); try { // First, open a file for input. fIn = new FileInputStream(filepath); //InputStream is=new FileInputStream(filepath); /*..................Loading Driver.............*/ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); /*----------Establishing Connection-----------*/ conn=DriverManager.getConnection("jdbc:odbc:mydatabase"); ps=conn.prepareStatement("insert into fileupload values(?)"); ps.setBinaryStream(1,fIn,(int)f.length()); ps.executeUpdate(); conn.close(); out.println("file submitted sucessfully"); } catch(Exception e) { out.println(e); } %> </body></html>


How do you value their uses?

The uses of what?


Does Japan use euro?

No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.No country in Asia uses the Euro.