Monday, June 1, 2015

FileInputStream

FileInputStream:

This stream is used for reading data from the files. Objects can be created using the
keyword new and there are several types of constructors available.

InputStream f = new FileInputStream("C:/java/hello");

OR

File f = new File("C:/java/hello");
InputStream f = new FileInputStream(f);



        Once you have InputStream object, then there is a list of helper methods which can be
        used to read to stream or to do other operations on the stream.


        public void close() throws IOException{}
        protected void finalize()throws IOException {}
        public int read(int r)throws IOException{}
        public int read(byte[] r) throws IOException{}
        public int available() throws IOException{}


There are other important input streams available, for more detail you can refer to the
following links:

  ByteArrayInputStream
  DataInputStream


No comments:

Post a Comment