'binary file'에 해당되는 글 1건

  1. 2010.07.13 base64 binary data 2 create file


 
  byte[] orgContents = Base64.decodeSun(contents); 
   OutputStream outStream = new FileOutputStream(saveTemp);
   outStream.write(orgContents);
   outStream.close();


 public final static byte[] decodeSun(String str) {
  byte[] b64dec = null;
  try {
   sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
   b64dec = decoder.decodeBuffer(str);
  } catch (IOException ex) { }
        return b64dec;
 }




여기에서 contents는 binary로 구성된 String 입니다.
해당 String을 base64 Decode를 돌려서 정상화 시키고 받아낸 byte 로된 데이터를
FileOutputStream으로 실제 파일로 생성을 합니다.
1 

글 보관함

카운터

Total : / Today : / Yesterday :
get rsstistory!