Created
May 6, 2020 07:13
-
-
Save horitaku1124/c6442a7310dacbc77f1dbc043c2902fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
/** | |
* http://www.file-recovery.com/mp4-signature-format.htm | |
*/ | |
public class IsoFileReader { | |
public static void main(String[] args) throws IOException { | |
File file = new File("test1.mp4"); | |
try(RandomAccessFile reader = new RandomAccessFile(file, "r")) { | |
int position = reader.readInt(); | |
System.out.println(position); | |
{ | |
byte[] mark = new byte[8]; | |
int len = reader.read(mark); | |
String str = new String(mark, 0, len); | |
System.out.println(str); | |
} | |
reader.skipBytes(4); | |
{ | |
byte[] mark = new byte[8]; | |
int len = reader.read(mark); | |
String str = new String(mark, 0, len); | |
System.out.println(str); | |
} | |
reader.seek(0); | |
reader.skipBytes(position); | |
System.out.println(reader.readInt()); | |
{ | |
byte[] mark = new byte[4]; | |
int len = reader.read(mark); | |
String str = new String(mark, 0, len); | |
System.out.println(str); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment