本文整理了Java中org.apache.axis.encoding.Base64
类的一些代码示例,展示了Base64
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64
类的具体详情如下:
包路径:org.apache.axis.encoding.Base64
类名称:Base64
暂无
代码示例来源:origin: com.github.1991wangliang/lorne_core
public static byte[] decode(String str){
return Base64.decode(str);
}
代码示例来源:origin: axis/axis
/**
* Returns base64 representation of specified byte array.
*/
public static String encode(byte[] data) {
return encode(data, 0, data.length);
}
代码示例来源:origin: axis/axis
/**
*
*/
public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
char[] ibuf = new char[4];
int ibufcount = 0;
byte[] obuf = new byte[3];
for (int i = off; i < off+len; i ++) {
char ch = data[i];
if (ch == S_BASE64PAD
|| ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
ibuf[ibufcount++] = ch;
if (ibufcount == ibuf.length) {
ibufcount = 0;
int obufcount = decode0(ibuf, obuf, 0);
ostream.write(obuf, 0, obufcount);
}
}
}
}
代码示例来源:origin: org.apache.axis/axis
/**
* Returns base64 representation of specified byte array.
*/
public static String encode(byte[] data) {
return encode(data, 0, data.length);
}
代码示例来源:origin: axis/axis
/**
* Convert the string that has been accumulated into an Object. Subclasses
* may override this. Note that if the javaType is a primitive, the returned
* object is a wrapper class.
* @param source the serialized value to be deserialized
* @throws Exception any exception thrown by this method will be wrapped
*/
public Object makeValue(String source) throws Exception {
byte [] value = Base64.decode(source);
if (value == null) {
if (javaType == Byte[].class) {
return new Byte[0];
} else {
return new byte[0];
}
}
if (javaType == Byte[].class) {
Byte[] data = new Byte[ value.length ];
for (int i=0; i<data.length; i++) {
byte b = value[i];
data[i] = new Byte(b);
}
return data;
}
return value;
}
}
代码示例来源:origin: org.apache.axis/axis
/**
*
*/
public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
char[] ibuf = new char[4];
int ibufcount = 0;
byte[] obuf = new byte[3];
for (int i = off; i < off+len; i ++) {
char ch = data[i];
if (ch == S_BASE64PAD
|| ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
ibuf[ibufcount++] = ch;
if (ibufcount == ibuf.length) {
ibufcount = 0;
int obufcount = decode0(ibuf, obuf, 0);
ostream.write(obuf, 0, obufcount);
}
}
}
}
代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis
/**
* Returns base64 representation of specified byte array.
*/
public static String encode(byte[] data) {
return encode(data, 0, data.length);
}
代码示例来源:origin: org.apache.axis/axis
/**
* Convert the string that has been accumulated into an Object. Subclasses
* may override this. Note that if the javaType is a primitive, the returned
* object is a wrapper class.
* @param source the serialized value to be deserialized
* @throws Exception any exception thrown by this method will be wrapped
*/
public Object makeValue(String source) throws Exception {
byte [] value = Base64.decode(source);
if (value == null) {
if (javaType == Byte[].class) {
return new Byte[0];
} else {
return new byte[0];
}
}
if (javaType == Byte[].class) {
Byte[] data = new Byte[ value.length ];
for (int i=0; i<data.length; i++) {
byte b = value[i];
data[i] = new Byte(b);
}
return data;
}
return value;
}
}
代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis
/**
*
*/
public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
char[] ibuf = new char[4];
int ibufcount = 0;
byte[] obuf = new byte[3];
for (int i = off; i < off+len; i ++) {
char ch = data[i];
if (ch == S_BASE64PAD
|| ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
ibuf[ibufcount++] = ch;
if (ibufcount == ibuf.length) {
ibufcount = 0;
int obufcount = decode0(ibuf, obuf, 0);
ostream.write(obuf, 0, obufcount);
}
}
}
}
代码示例来源:origin: com.github.1991wangliang/lorne_core
public static String encode(byte[] bs){
return Base64.encode(bs);
}
代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis
/**
* Convert the string that has been accumulated into an Object. Subclasses
* may override this. Note that if the javaType is a primitive, the returned
* object is a wrapper class.
* @param source the serialized value to be deserialized
* @throws Exception any exception thrown by this method will be wrapped
*/
public Object makeValue(String source) throws Exception {
byte [] value = Base64.decode(source);
if (value == null) {
if (javaType == Byte[].class) {
return new Byte[0];
} else {
return new byte[0];
}
}
if (javaType == Byte[].class) {
Byte[] data = new Byte[ value.length ];
for (int i=0; i<data.length; i++) {
byte b = value[i];
data[i] = new Byte(b);
}
return data;
}
return value;
}
}
代码示例来源:origin: org.apache.axis/axis
/**
*
*/
public static byte[] decode(char[] data, int off, int len) {
char[] ibuf = new char[4];
int ibufcount = 0;
byte[] obuf = new byte[len/4*3+3];
int obufcount = 0;
for (int i = off; i < off+len; i ++) {
char ch = data[i];
if (ch == S_BASE64PAD
|| ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
ibuf[ibufcount++] = ch;
if (ibufcount == ibuf.length) {
ibufcount = 0;
obufcount += decode0(ibuf, obuf, obufcount);
}
}
}
if (obufcount == obuf.length)
return obuf;
byte[] ret = new byte[obufcount];
System.arraycopy(obuf, 0, ret, 0, obufcount);
return ret;
}
代码示例来源:origin: org.apache.axis/axis
public String getValueAsString(Object value, SerializationContext context) {
byte[] data = null;
if (javaType == byte[].class) {
data = (byte[]) value;
} else {
data = new byte[ ((Byte[]) value).length ];
for (int i=0; i<data.length; i++) {
Byte b = ((Byte[]) value)[i];
if (b != null)
data[i] = b.byteValue();
}
}
return Base64.encode(data, 0, data.length);
}
代码示例来源:origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin
public boolean addBase64EncodedAttachmentsToIssue(final String token, final String issueKey, final String[] fileNames, final String[] base64EncodedAttachmentData)
throws RemoteException
{
User user = tokenManager.retrieveUser(token);
byte[][] dataBytes = null;
if (base64EncodedAttachmentData != null)
{
dataBytes = new byte[base64EncodedAttachmentData.length][];
for (int i = 0; i < base64EncodedAttachmentData.length; i++)
{
dataBytes[i] = Base64.decode(base64EncodedAttachmentData[i]);
}
}
return issueService.addAttachmentsToIssue(user, issueKey, fileNames, dataBytes);
}
代码示例来源:origin: axis/axis
/**
*
*/
public static byte[] decode(char[] data, int off, int len) {
char[] ibuf = new char[4];
int ibufcount = 0;
byte[] obuf = new byte[len/4*3+3];
int obufcount = 0;
for (int i = off; i < off+len; i ++) {
char ch = data[i];
if (ch == S_BASE64PAD
|| ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
ibuf[ibufcount++] = ch;
if (ibufcount == ibuf.length) {
ibufcount = 0;
obufcount += decode0(ibuf, obuf, obufcount);
}
}
}
if (obufcount == obuf.length)
return obuf;
byte[] ret = new byte[obufcount];
System.arraycopy(obuf, 0, ret, 0, obufcount);
return ret;
}
代码示例来源:origin: axis/axis
public String getValueAsString(Object value, SerializationContext context) {
byte[] data = null;
if (javaType == byte[].class) {
data = (byte[]) value;
} else {
data = new byte[ ((Byte[]) value).length ];
for (int i=0; i<data.length; i++) {
Byte b = ((Byte[]) value)[i];
if (b != null)
data[i] = b.byteValue();
}
}
return Base64.encode(data, 0, data.length);
}
代码示例来源:origin: axis/axis
int i ;
tmp = new String( Base64.decode( tmp.substring(6) ) );
i = tmp.indexOf( ':' );
if ( i == -1 ) user = tmp ;
代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis
/**
*
*/
public static byte[] decode(char[] data, int off, int len) {
char[] ibuf = new char[4];
int ibufcount = 0;
byte[] obuf = new byte[len/4*3+3];
int obufcount = 0;
for (int i = off; i < off+len; i ++) {
char ch = data[i];
if (ch == S_BASE64PAD
|| ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
ibuf[ibufcount++] = ch;
if (ibufcount == ibuf.length) {
ibufcount = 0;
obufcount += decode0(ibuf, obuf, obufcount);
}
}
}
if (obufcount == obuf.length)
return obuf;
byte[] ret = new byte[obufcount];
System.arraycopy(obuf, 0, ret, 0, obufcount);
return ret;
}
代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis
public String getValueAsString(Object value, SerializationContext context) {
byte[] data = null;
if (javaType == byte[].class) {
data = (byte[]) value;
} else {
data = new byte[ ((Byte[]) value).length ];
for (int i=0; i<data.length; i++) {
Byte b = ((Byte[]) value)[i];
if (b != null)
data[i] = b.byteValue();
}
}
return Base64.encode(data, 0, data.length);
}
代码示例来源:origin: org.apache.axis/axis
int i ;
tmp = new String( Base64.decode( tmp.substring(6) ) );
i = tmp.indexOf( ':' );
if ( i == -1 ) user = tmp ;
内容来源于网络,如有侵权,请联系作者删除!