1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-12 14:01:08 +01:00

Create smack.util.stringencoder for Base64, Base32,…

Use Android's Base64 implementation when on Android, otherwise, when on
Java7, use the existing one.
This commit is contained in:
Florian Schmaus 2014-09-04 11:04:51 +02:00
parent 90c0064394
commit 5d4aa76d19
32 changed files with 491 additions and 231 deletions

View file

@ -35,7 +35,7 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
@ -708,7 +708,7 @@ public class InBandBytestreamSession implements BytestreamSession {
}
// create data packet
String enc = StringUtils.encodeBase64(buffer, 0, bufferPointer, false);
String enc = Base64.encodeToString(buffer, 0, bufferPointer);
DataPacketExtension data = new DataPacketExtension(byteStreamRequest.getSessionID(),
this.seq, enc);

View file

@ -17,8 +17,8 @@
package org.jivesoftware.smackx.bytestreams.ibb.packet;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smack.util.stringencoder.Base64;
/**
* Represents a chunk of data of an In-Band Bytestream within an IQ stanza or a
@ -121,7 +121,7 @@ public class DataPacketExtension implements PacketExtension {
}
// decodeBase64 will return null if bad characters are included
this.decodedData = StringUtils.decodeBase64(data);
this.decodedData = Base64.decode(data);
return this.decodedData;
}