DataInputStream ReadUnsignedByte() Example

returns the next byte of this input stream, interpreted as an unsigned 8-bit number


DataInputStreamclass ReadUnsignedByte() method example. This example shows you how to use ReadUnsignedByte() method.This method returns the next byte of this input stream, interpreted as an unsigned 8-bit number

Here is the code:-

/**
 * @Program that returns the next byte of this input stream, interpreted as an
    unsigned 8-bit number
 * ReadUnsignedByte.java 
 * Author:-RoseIndia Team
 * Date:-07-jun-2008
 */
import java.io.*;
public class ReadUnsignedByte {
public static void main(String[] args)throws IOException {
byte lL = 23;
        FileOutputStream fos = new FileOutputStream("Linux.txt");
        DataOutputStream dos = new DataOutputStream(fos);
        dos.writeByte(lL);
        dos.flush();
        dos.close();
        FileInputStream fis = new FileInputStream("Linux.txt");
        DataInputStream dis = new DataInputStream(fis);
       
        int l = dis.readUnsignedByte();
        System.out.println("The next bytes of this input stream is :" + l);
    }

}

Output of the Program
 The next bytes of this input stream is :23

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

HOME | COPYRIGHT | CONTACT US