-
大小: 64KB文件類型: .zip金幣: 2下載: 1 次發布日期: 2021-06-25
- 語言: Java
- 標簽: javabase64??-1.3.1??jar??Base64??
資源簡介
Sun公司提供的Base64轉碼/解碼工具,包含jar包和源代碼。

代碼片段和文件信息
/*
?*?Java?base64?-?A?pure?Java?library?for?reading?and?writing?base64
?*???????????????encoded?streams.
?*?
?*?Copyright?(C)?2007-2009?Carlo?Pelliccia?(www.sauronsoftware.it)
?*?
?*?This?program?is?free?software:?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?GNU?Lesser?General?Public?License?version
?*?2.1?as?published?by?the?Free?Software?Foundation.
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*?GNU?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?Lesser?General?Public
?*?License?version?2.1?along?with?this?program.
?*?If?not?see? .
?*/
package?it.sauronsoftware.base64;
import?java.io.ByteArrayInputStream;
import?java.io.ByteArrayOutputStream;
import?java.io.File;
import?java.io.FileInputStream;
import?java.io.FileOutputStream;
import?java.io.IOException;
import?java.io.InputStream;
import?java.io.OutputStream;
import?java.io.UnsupportedEncodingException;
/**
?*?
?*?base64?encoding?and?decoding?utility?methods?both?for?binary?and?textual
?*?informations.
?*?
?*?
?*?@author?Carlo?Pelliccia
?*?@since?1.1
?*?@version?1.3
?*/
public?class?base64?{
/**
?*?
?*?Encodes?a?string.
?*?
?*?
?*?Before?the?string?is?encoded?in?base64?it?is?converted?in?a?binary
?*?sequence?using?the?system?default?charset.
?*?
?*?
?*?@param?str
?*????????????The?source?string.
?*?@return?The?encoded?string.
?*?@throws?RuntimeException
?*?????????????If?an?unexpected?error?occurs.
?*/
public?static?String?encode(String?str)?throws?RuntimeException?{
byte[]?bytes?=?str.getBytes();
byte[]?encoded?=?encode(bytes);
try?{
return?new?String(encoded?“ASCII“);
}?catch?(UnsupportedEncodingException?e)?{
throw?new?RuntimeException(“ASCII?is?not?supported!“?e);
}
}
/**
?*?
?*?Encodes?a?string.
?*?
?*?
?*?Before?the?string?is?encoded?in?base64?it?is?converted?in?a?binary
?*?sequence?using?the?supplied?charset.
?*?
?*?
?*?@param?str
?*????????????The?source?string
?*?@param?charset
?*????????????The?charset?name.
?*?@return?The?encoded?string.
?*?@throws?RuntimeException
?*?????????????If?an?unexpected?error?occurs.
?*?@since?1.2
?*/
public?static?String?encode(String?str?String?charset)
throws?RuntimeException?{
byte[]?bytes;
try?{
bytes?=?str.getBytes(charset);
}?catch?(UnsupportedEncodingException?e)?{
throw?new?RuntimeException(“Unsupported?charset:?“?+?charset?e);
}
byte[]?encoded?=?encode(bytes);
try?{
return?new?String(encoded?“ASCII“);
}?catch?(UnsupportedEncodingException?e)?{
throw?new?RuntimeException(“ASCII?is?not?supported!“?e);
}
}
/**
?*?
?*?Decodes?the?supplied?string.
?*?
?*?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????目錄???????????0??2009-05-02?17:19??javaba
?????文件?????????492??2009-05-02?17:19??javaba
?????文件?????????352??2009-05-02?17:19??javaba
?????文件???????26436??2009-05-02?17:19??javaba
?????文件?????????501??2009-05-02?17:19??javaba
?????文件?????????341??2009-05-02?17:19??javaba
?????文件????????2854??2009-05-02?17:19??javaba
?????文件????????1056??2009-05-02?17:19??javaba
?????文件?????????996??2009-05-02?17:19??javaba
?????文件????????4983??2009-05-02?17:19??javaba
?????文件????????4919??2009-05-02?17:19??javaba
?????文件????????8806??2009-05-02?17:19??javaba
?????文件???????14069??2009-05-02?17:19??javaba
?????文件????????1348??2009-05-02?17:19??javaba
?????文件???????27391??2009-05-02?17:19??javaba
?????文件???????12076??2009-05-02?17:19??javaba
?????文件???????14162??2009-05-02?17:19??javaba
............此處省略18個文件信息
- 上一篇:sqljdbc4R2.jar
- 下一篇:Java技術及SSH框架和Jsp技術的介紹
評論
共有 條評論