import java.io.*;
import sun.misc.*;
public class base64
{
public static void main(String []args)
{
try
{
FileInputStream fileForInput = new FileInputStream("d://mini.swf");
String content = new String();
byte[] bytes = new byte[fileForInput.available()];
fileForInput.read(bytes);
content = new BASE64Encoder().encode(bytes);
System.out.println(content);
fileForInput.close();
String str = content;//编码内容
byte[] result =new sun.misc.BASE64Decoder().decodeBuffer(str.trim());
RandomAccessFile inOut = new RandomAccessFile("d://my.swf","rw");
inOut.write(result);
inOut.close();
}
catch(Exception ex)
{
System.out.println("wrong");
}
}
}
import sun.misc.*;
public class base64
{
public static void main(String []args)
{
try
{
FileInputStream fileForInput = new FileInputStream("d://mini.swf");
String content = new String();
byte[] bytes = new byte[fileForInput.available()];
fileForInput.read(bytes);
content = new BASE64Encoder().encode(bytes);
System.out.println(content);
fileForInput.close();
String str = content;//编码内容
byte[] result =new sun.misc.BASE64Decoder().decodeBuffer(str.trim());
RandomAccessFile inOut = new RandomAccessFile("d://my.swf","rw");
inOut.write(result);
inOut.close();
}
catch(Exception ex)
{
System.out.println("wrong");
}
}
}