Java tutorial
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { private static String ecodeTag = "ecode"; public static boolean isEncode(File f) { try { FileInputStream input = new FileInputStream(f); // input = new BufferedInputStream(input); byte[] ecodeBytes = new byte[ecodeTag.getBytes().length]; input.read(ecodeBytes); input.close(); return new String(ecodeBytes).equals(ecodeTag); } catch (IOException e) { e.printStackTrace(); } return false; } }