List of usage examples for org.apache.commons.codec.binary Base64Codec decodeBase64
public static byte[] decodeBase64(byte[] base64Data)
From source file:com.googlecode.android_scripting.facade.BluetoothFacade.java
@Rpc(description = "Send bytes over the currently open Bluetooth connection.") public void bluetoothWriteBinary( @RpcParameter(name = "base64", description = "A base64 encoded String of the bytes to be sent.") String base64, @RpcParameter(name = "connID", description = "Connection id") @RpcDefault("") @RpcOptional String connID) throws IOException { BluetoothConnection conn = getConnection(connID); try {// www . j a va 2 s .co m conn.write(Base64Codec.decodeBase64(base64)); } catch (IOException e) { connections.remove(conn.getUUID()); throw e; } }
From source file:com.googlecode.android_scripting.trigger.TriggerRepository.java
/** Deserializes the {@link Multimap} of {@link Trigger}s from a base 64 encoded string. */ @SuppressWarnings("unchecked") private Multimap<String, Trigger> deserializeTriggersFromString(String triggers) { if (triggers == null) { return ArrayListMultimap.<String, Trigger>create(); }/*from ww w . ja va 2 s . co m*/ try { final ByteArrayInputStream inputStream = new ByteArrayInputStream( Base64Codec.decodeBase64(triggers.getBytes())); final ObjectInputStream objectInputStream = new ObjectInputStream(inputStream); return (Multimap<String, Trigger>) objectInputStream.readObject(); } catch (Exception e) { Log.e(e); } return ArrayListMultimap.<String, Trigger>create(); }
From source file:com.googlecode.android_scripting.facade.bluetooth.BluetoothSocketConnFacade.java
/** * Send bytes over the currently open Bluetooth connection * * @param base64 the based64-encoded string to write * @param connID the connection ID//from w w w . ja v a2 s . c o m * @throws Exception */ @Rpc(description = "Send bytes over the currently open Bluetooth connection.") public void bluetoothSocketConnWriteBinary( @RpcParameter(name = "base64", description = "A base64 encoded String of the bytes to be sent.") String base64, @RpcParameter(name = "connID", description = "Connection id") @RpcDefault("") @RpcOptional String connID) throws IOException { BluetoothConnection conn = getConnection(connID); try { conn.write(Base64Codec.decodeBase64(base64)); } catch (IOException e) { mConnections.remove(conn.getUUID()); throw e; } }
From source file:com.googlecode.android_scripting.facade.USBHostSerialFacade.java
/** * usbserialWriteBinary: {{{1/*from w ww . j av a2s .co m*/ */ @Rpc(description = "Send bytes over the currently open USB Serial connection.") public void usbserialWriteBinary( @RpcParameter(name = "base64", description = "A base64 encoded String of the bytes to be sent.") String base64, @RpcParameter(name = "connID", description = "Connection id") @RpcDefault("") @RpcOptional String connID) throws IOException { UsbSerialConnection conn = getConnection(connID); try { conn.write(Base64Codec.decodeBase64(base64)); } catch (IOException e) { removeConnection(conn); throw e; } }