public static int peekFileType(String fileName) throws IOException {
  DataInputStream dis=null;
  dis=new DataInputStream(new BufferedInputStream(new FileInputStream(fileName)));
  try {
    MaryHeader hdr=new MaryHeader(dis);
    int type=hdr.getType();
    return type;
  }
 catch (  MaryConfigurationException e) {
    return -1;
  }
 finally {
    dis.close();
  }
}

public static int peekFileType ( String fileName ) throws IOException { DataInputStream dis = null ; dis = new DataInputStream ( new BufferedInputStream ( new FileInputStream ( fileName ) ) ) ; try { MaryHeader hdr = new MaryHeader ( dis ) ; int type = hdr . getType ( ) ; return type ; } catch ( MaryConfigurationException e ) { return - 1 ; } finally { dis . close ( ) ; } }
for the given file , look inside and determine the file type .
