Created
May 11, 2012 07:50
-
-
Save aniljava/2658222 to your computer and use it in GitHub Desktop.
Convert Base64 Encoded data to Font OTF/TTF
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.BufferedReader; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.FileReader; | |
import java.nio.ByteBuffer; | |
public class FontFromBase64 { | |
public static void main(String[] args) throws Exception { | |
String infile = "text.txt"; | |
String outfile = "font.otf"; | |
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder(); | |
BufferedReader reader = new BufferedReader(new FileReader(new File(infile))); | |
FileOutputStream out = new FileOutputStream(outfile); | |
String line = ""; | |
while ((line = reader.readLine()) != null) { | |
ByteBuffer buffer = decoder.decodeBufferToByteBuffer(line); | |
out.write(buffer.array()); | |
} | |
out.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment