本文整理了Java中net.iharder.Base64.decode()
方法的一些代码示例,展示了Base64.decode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.decode()
方法的具体详情如下:
包路径:net.iharder.Base64
类名称:Base64
方法名:decode
[英]Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
[中]对Base64符号中的数据进行解码,自动检测gzip压缩数据并对其进行解压缩。
代码示例来源:origin: igniterealtime/Smack
@Override
public byte[] decode(String string) {
try {
return Base64.decode(string);
}
catch (IllegalArgumentException e) {
// Expected by e.g. the unit test.
// " Base64-encoded string must have at least four characters, but length specified was 1",
// should not cause an exception, but instead null should be returned. Maybe
// this should be changed in a later Smack release, so that the actual exception
// is handled.
return null;
}
catch (IOException e) {
throw new IllegalStateException(e);
}
}
代码示例来源:origin: igniterealtime/Smack
@Override
public byte[] decode(byte[] input, int offset, int len) {
try {
return Base64.decode(input, offset, len, 0);
}
catch (IllegalArgumentException e) {
// Expected by e.g. the unit test.
// " Base64-encoded string must have at least four characters, but length specified was 1",
// should not cause an exception, but instead null should be returned. Maybe
// this should be changed in a later Smack release, so that the actual exception
// is handled.
return null;
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
代码示例来源:origin: kaaproject/kaa
@Override
public EndpointNotificationDto sendUnicastNotification(NotificationDto notification,
String clientKeyHash,
byte[] body)
throws KaaAdminServiceException {
checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER);
try {
checkExpiredDate(notification);
notification.setBody(body);
checkApplicationId(notification.getApplicationId());
TopicDto topic = controlService.getTopic(notification.getTopicId());
Utils.checkNotNull(topic);
checkApplicationId(topic.getApplicationId());
EndpointNotificationDto unicastNotification = new EndpointNotificationDto();
unicastNotification.setEndpointKeyHash(
Base64.decode(clientKeyHash.getBytes(Charsets.UTF_8)));
unicastNotification.setNotificationDto(notification);
return controlService.editUnicastNotification(unicastNotification);
} catch (Exception ex) {
throw Utils.handleException(ex);
}
}
代码示例来源:origin: briandilley/jsonrpc4j
decodedParams = new String(Base64.decode(params), StandardCharsets.UTF_8);
} else {
switch (params.charAt(0)) {
代码示例来源:origin: pwm-project/pwm
public static byte[] base64Decode( final String input, final StringUtil.Base64Options... options )
throws IOException
{
final int b64UtilOptions = Base64Options.asBase64UtilOptions( options );
return Base64.decode( input, b64UtilOptions );
}
代码示例来源:origin: pwm-project/pwm
public static byte[] base64Decode( final String input )
throws IOException
{
return Base64.decode( input );
}
代码示例来源:origin: Nextdoor/bender
/**
* Decodes data from Base64 notation, automatically
* detecting gzip-compressed data and decompressing it.
*
* @param s the string to decode
* @return the decoded data
* @throws java.io.IOException If there is a problem
* @since 1.4
*/
public static byte[] decode( String s ) throws java.io.IOException {
return decode( s, NO_OPTIONS );
}
代码示例来源:origin: fgp/AirReceiver
/**
* Decodes Base64 data that is correctly padded with "="
*
* @param str base64 data
* @return bytes
* @throws IOException if the data is invalid
*/
public static byte[] decodePadded(final String str)
throws IOException
{
return net.iharder.Base64.decode(str);
}
代码示例来源:origin: pelotoncycle/weberknecht
/**
* Decodes data from Base64 notation, automatically
* detecting gzip-compressed data and decompressing it.
*
* @param s the string to decode
* @return the decoded data
* @throws java.io.IOException If there is a problem
* @since 1.4
*/
public static byte[] decode( String s ) throws java.io.IOException {
return decode( s, NO_OPTIONS );
}
代码示例来源:origin: NGDATA/lilyproject
public static byte[] valueFromString(String value) {
try {
return Base64.decode(value, Base64.URL_SAFE);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: Nextdoor/bender
/**
* Low-level access to decoding ASCII characters in
* the form of a byte array. <strong>Ignores GUNZIP option, if
* it's set.</strong> This is not generally a recommended method,
* although it is used internally as part of the decoding process.
* Special case: if len = 0, an empty array is returned. Still,
* if you need more speed and reduced memory footprint (and aren't
* gzipping), consider this method.
*
* @param source The Base64 encoded data
* @return decoded data
* @since 2.3.1
*/
public static byte[] decode( byte[] source )
throws java.io.IOException {
byte[] decoded = null;
// try {
decoded = decode( source, 0, source.length, Base64.NO_OPTIONS );
// } catch( java.io.IOException ex ) {
// assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
// }
return decoded;
}
代码示例来源:origin: fgp/AirReceiver
/**
* Decodes Base64 data that is not padded with "="
*
* @param str base64 data
* @return bytes
* @throws IOException if the data is invalid
*/
public static byte[] decodeUnpadded(String base64)
throws IOException
{
while (base64.length() % 4 != 0)
base64 = base64.concat("=");
return net.iharder.Base64.decode(base64);
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
@Nonnull
public static byte[] base64decode(@Nonnull final String text) throws IOException {
return Base64.decode(text);
}
代码示例来源:origin: com.xeiam.xchange/xchange-kraken
public static KrakenDigest createInstance(String secretKeyBase64) {
try {
if (secretKeyBase64 != null)
return new KrakenDigest(Base64.decode(secretKeyBase64.getBytes()));
} catch (IOException e) {
throw new IllegalArgumentException("Could not decode Base 64 string", e);
}
return null;
}
代码示例来源:origin: NGDATA/hbase-indexer
private byte[] getByteArrayProperty(ObjectNode node, String property) {
try {
String string = JsonUtil.getString(node, property, null);
if (string == null)
return null;
return Base64.decode(string);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.ngdata/hbase-indexer-model
private byte[] getByteArrayProperty(ObjectNode node, String property) {
try {
String string = JsonUtil.getString(node, property, null);
if (string == null)
return null;
return Base64.decode(string);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.xeiam.xchange/xchange-anx
public static ANXV2Digest createInstance(String secretKeyBase64) {
try {
if (secretKeyBase64 != null)
return new ANXV2Digest(Base64.decode(secretKeyBase64.getBytes()));
} catch (IOException e) {
throw new IllegalArgumentException("Could not decode Base 64 string", e);
}
return null;
}
代码示例来源:origin: io.syndesis.common/common-util
/**
* Used to extract the time information that is encoded to each
* generated key.
*/
public static long getKeyTimeMillis(String key) throws IOException {
byte[] decoded = Base64.decode(stripPreAndSuffix(key), Base64.ORDERED);
if (decoded.length != 15) {
throw new IOException("Invalid key: size is incorrect.");
}
ByteBuffer buffer = ByteBuffer.allocate(8);
buffer.position(2);
buffer.put(decoded, 0 ,6);
buffer.flip();
return buffer.getLong();
}
代码示例来源:origin: jruesga/rview
@Override
public byte[] decodeBase64(byte[] data) {
try {
return Base64.decode(data);
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
}
代码示例来源:origin: com.xeiam.xchange/xchange-coinbaseex
public static CoinbaseExDigest createInstance(String secretKey) {
try {
return secretKey == null ? null : new CoinbaseExDigest(Base64.decode(secretKey));
} catch (IOException e) {
throw new ExchangeException("Cannot decode secret key");
}
}
内容来源于网络,如有侵权,请联系作者删除!