DataInputStream: readUnsignedShort() : DataInputStream « java.io « Java by API






DataInputStream: readUnsignedShort()

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

public class Main {
  public static void main(String[] args) throws IOException {
    DataInputStream in = new DataInputStream(new FileInputStream("Main.class"));

    int start = in.readInt();
    if (start != 0xcafebabe) {
      System.out.println("not valid");
    }
    in.close();
    System.out.println(in.readUnsignedShort()+"/"+in.readUnsignedShort());
    
  }
}

   
  








Related examples in the same category

1.new DataInputStream(FileInputStream fileInputStream)
2.new DataInputStream(new BufferedInputStream(new FileInputStream("temp.tmp")))
3.DataInputStream: readBoolean()
4.DataInputStream: readByte()
5.DataInputStream: readChar()
6.DataInputStream: readDouble()
7.DataInputStream: readFloat()
8.DataInputStream: readInt()
9.DataInputStream: readLong()
10.DataInputStream: readShort()
11.DataInputStream: readUTF()