Created
February 6, 2013 13:39
-
-
Save mccxj/4722548 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
public static void main(String[] args) throws Exception { | |
File file = new File("test.txt"); | |
FileInputStream is = new FileInputStream(file); | |
FileOutputStream os = new FileOutputStream("test.7z"); | |
int k; | |
char[] ka = new char[2]; | |
int i=0; | |
while((k = is.read()) != -1) | |
{ | |
ka[i++] = (char)k; | |
if(i==2) | |
{ | |
int s = Integer.parseInt(new String(ka), 16); | |
os.write(s); | |
i = 0; | |
} | |
} | |
//ignore exception handle | |
os.close(); | |
is.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment