public static void main(String[] args) {
        InputStream r=null;
        OutputStream os = null;

		File file = new File("F://c.txt");
		try{
			r = new FileInputStream(file);
           // BOMInputStream bis = new BOMInputStream(r,false);
            os = new FileOutputStream("f://b.txt");
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
			byte[] b = new byte[1];
			int len;
            byte by=(byte)0xbf;
            byte ef=(byte)0xef;
            byte bb=(byte)0xbb;
            while((len=r.read(b,0,1))>0){
                if(by!=b[0] && bb!=b[0] && ef!=b[0]) {
                    bos.write(b,0,len);
                   bos.flush();
                    //os.write(b,0,len);
                   // os.flush();
                }
			}
            //byte[] result=bos.toByteArray();
            String str = bos.toString();
            Pattern p = Pattern.compile("0xbf");
            Matcher m = p.matcher(str);


            System.out.println(m.group(1));
            ByteArrayInputStream bis = new ByteArrayInputStream(str.getBytes());
            FileInputStream f = new FileInputStream("f://b.txt");
            bos.close();
			org.jsoup.nodes.Document doc = Jsoup.parse(bis, "utf-8", "");
			Elements headELEs = doc.getElementsByTag("head");
			org.jsoup.nodes.Element headELE = headELEs.first();
			System.out.println(headELE);
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try {
                os.close();
				r.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}