DataInputStream ReadFully() Example

Bytes for this operation are read from the contained input stream.


DataInputStreamclass ReadFully() method example. This example shows you how to use ReadFully() method.This method gives way in which Bytes for this operation are read from the contained inputstream.

Here is the code:-

/**
 * @Program in which Bytes for this operation are read from the contained input 
    stream. 
 * ReadFully.java 
 * Author:-RoseIndia Team
 * Date:-07-jun-2008
 */
import java.io.*;

public class ReadFully {

    public static void main(String[] argsthrows IOException {
        byte[] bB = {1234567};
        FileOutputStream fos = new FileOutputStream("Linux.txt");
        DataOutputStream dos = new DataOutputStream(fos);
        dos.write(bB);
        dos.flush();
        dos.close();
        FileInputStream fis = new FileInputStream("Linux.txt");
        DataInputStream dis = new DataInputStream(fis);
        dis.readFully(bB);
        for (int i = 0; i < bB.length; i++) {
            System.out.println(bB[i]);
        }
    }
}

Output of the Program
 1
2
3
4
5
6
7

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US