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());
    
  }
}
Home 
  Java Book 
    File Stream  

DataInputStream:
  1. DataInputStream
  2. new DataInputStream(FileInputStream fileInputStream)
  3. new DataInputStream(new BufferedInputStream(new FileInputStream("temp.tmp")))
  4. DataInputStream: readUnsignedShort()
  5. DataInputStream: readUTF()