File header for common files (with Java test Class)

Source: Internet
Author: User
Tags rar

1. MIDI (mid), file header: 4d546864 2.  JPEG (jpg), file header: Ffd8ff 3.  PNG (PNG), file header: 89504E47 4.  GIF (GIF), file header: 47494638 5.  TIFF (TIF), file header: 49492a00 6.  Windows Bitmap (BMP), file header: 424D 7.  CAD (DWG), file header: 41433130 8.  Adobe Photoshop (PSD), file header: 38425053 9. Rich Text Format (RTF), file header: 7b5c727466 10. XML (XML), file header: 3c3f786d6c 11. HTML (HTML), file header: 68746d6c3e 12. Email [Thorough only] (EML), file header: 44656c69766572792d646174653a 13. Outlook Express (DBX), file header: cfad12fec5fd746f 14. Outlook (PST), file header: 2142444E 15. MS Word/excel (xls.or.doc), file header: d0cf11e0 16. MS Access (MDB), file header: 5374616e64617264204a 17. WordPerfect (WPD), file header: FF575043 18. Postscript (eps.or.ps), file header: 252150532d41646f6265 19. Adobe Acrobat (pdf), file header: 255044462d312e 20. Quicken (QDF), file header: ac9ebd8f 21. Windows Password (PWL), file header: E3828596 22. Zip Archive (Zip), file header: 504b0304 23. rar Archive (RAR), file header: 52617221 24. Wave (WAV), file header: 57415645 25. Avi (AVI), file header: 41564920 26. Real Audio (RAM), file header: 2E7261FD 27. Real Media (RM), file header: 2e524d46 28. MPEG (MPG), file header: 000001BA 29. MPEG (MPG), file header: 000001b3 30. Quicktime (mov), file header: 6d6f6f76 31.    Windows Media (ASF), file header: 3026b2758e66cf11

  

Package Com.lr.downlaod;import Java.io.fileinputstream;public class Testdownload {public static String Bytestohexstring (byte[] src) {StringBuilder StringBuilder = new StringBuilder (); if (src = = NULL | | src.length <= 0) {RE Turn null;} for (int i = 0; i < src.length; i++) {int v = src[i] & 0xFF; String HV = integer.tohexstring (v), if (Hv.length () < 2) {stringbuilder.append (0);} Stringbuilder.append (HV);} return stringbuilder.tostring ();} public static void Main (string[] args) throws Exception {FileInputStream is = new FileInputStream ("g://lr//005.jpg"); [] B = new Byte[3];is.read (b, 0, b.length); System.out.println (bytestohexstring (b));}}

  

File header for common files (with Java test Class)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.