1 22 23 package org.continuent.sequoia.common.sql.filters; 24 25 import org.continuent.sequoia.common.stream.encoding.Base64; 26 import org.continuent.sequoia.common.stream.encoding.ZipEncoding; 27 import org.continuent.sequoia.common.xml.DatabasesXmlTags; 28 29 37 public class Base64ZipFilter extends AbstractBlobFilter 38 { 39 40 43 public String encode(byte[] data) 44 { 45 try 46 { 47 return Base64.encode(ZipEncoding.encode(data)); 48 } 49 catch (Exception e) 50 { 51 e.printStackTrace(); 52 return ""; 53 } 54 } 55 56 59 public byte[] decode(String data) 60 { 61 try 62 { 63 return ZipEncoding.decode(Base64.decode(data)); 64 } 65 catch (Exception e) 66 { 67 e.printStackTrace(); 68 return null; 69 } 70 } 71 72 75 public String getXml() 76 { 77 return DatabasesXmlTags.VAL_base64; 78 } 79 80 } | Popular Tags |