Converts the given Base64 string back into a Scan instance.

@param base64
The scan details.
@return The newly created Scan instance.
@throws IOException
When reading the scan instance fails.
486369
public static Scan convertStringToScan(String base64) throws IOException {
		ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(base64));
		DataInputStream dis = new DataInputStream(bis);
		Scan scan = new Scan();
		scan.readFields(dis);
		return scan;
	}
1101705
private byte[] decodeBase64(String text) {
        Objects.requireNonNull(text, Required.PLAIN_TEXT.toString());
        return org.apache.commons.codec.binary.Base64.decodeBase64(text);
    }
850491
@Pure
	@Inline(value = "new String(Base64Coder.decode($1))", imported = {Base64Coder.class})
	public static String decodeString(String string) {
		return new String(decode(string));
	}
411978
public static String encodeBase64(final String data) {
        return Base64.encodeBase64String(data.getBytes(StandardCharsets.UTF_8));
    }
1048517
public static String base64Encode(String plainTextString) {
        String encoded = new String(Base64.getEncoder().encode(plainTextString.getBytes()));
        return encoded;
    }
965341
public final byte[] decodeString(String base64String) {
        logger.entry();
        byte[] decodedBytes = Base64Utils.decode(base64String);
        logger.exit();
        return decodedBytes;
    }
294729
public static BufferedImage toImage(String base64) throws IORuntimeException {
		byte[] decode = Base64.decode(base64, CharsetUtil.CHARSET_UTF_8);
		return toImage(decode);
	}
1029778
public static BufferedImage base64StrToImg(String imgStr) {
        Base64.Decoder decoder = Base64.getDecoder();
        byte[] bytes = decoder.decode(imgStr);
        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] < 0) {
                bytes[i] += 256;
            }
        }
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        BufferedImage image = null;
        try {
            image = ImageIO.read(bais);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            CommonUtils.closeIOStream(bais, null);
        }
        return image;
    }
1279248
public static String toBase64(final PublicKey publicKey)
	{
		final byte[] encoded = publicKey.getEncoded();
		return Base64.encodeBase64String(encoded);
	}
37710
public static byte[] decodeBase64(String base64) {
    if (base64 == null)
      throw new NullPointerException("Parameter 'base64' cannot be null.");

    String fixedBase64 = padBase64(base64);
    return Base64.getDecoder().decode(fixedBase64);
  }
279663
@Nonnull
  public static String rescaleImageAndEncodeAsBase64(@Nonnull final File file, final int maxSize) throws IOException {
    final Image image = ImageIO.read(file);
    if (image == null) {
      throw new IllegalArgumentException("Can't load image file : " + file); //NOI18N
    }
    return rescaleImageAndEncodeAsBase64(image, maxSize);
  }
119047
public static Binary fromBase64(String base64) {
        byte[] arr = Base64.decode(base64);
        return Binary.wrap(arr);
    }
683799
public static JWSHeader fromBase64String(String base64) throws IOException {
        String json = MessageSecurityHelper.base64UrltoString(base64);
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(json, JWSHeader.class);
    }
373072
public static String decompressFromBase64String(String compressed) throws IOException {
        return decompressString(Base64.decode(compressed.getBytes(StandardCharsets.UTF_8)));
    }
583209
@SneakyThrows(IOException.class)
    public static String compressToBase64(final String string) {
        Preconditions.checkNotNull(string, "string");
        @Cleanup
        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        @Cleanup
        final OutputStream base64OutputStream = Base64.getEncoder().wrap(byteArrayOutputStream);
        @Cleanup
        final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(base64OutputStream);
        gzipOutputStream.write(string.getBytes(UTF_8));
        gzipOutputStream.close();
        return byteArrayOutputStream.toString(UTF_8.name());
    }
440780
public String asBase64(BaseEncoding.Dialect dialect, BaseEncoding.Padding padding) throws IOException {
        String standardBase64 = DatatypeConverter.printBase64Binary(asByteArray(false));
        if (dialect == BaseEncoding.Dialect.STANDARD && padding == BaseEncoding.Padding.STANDARD) {
            return standardBase64;
        }

        StringBuilder safeBase64 = new StringBuilder(standardBase64.length());
        for(int i=0; i<standardBase64.length(); i++) {
            char c = standardBase64.charAt(i);

            if (dialect == BaseEncoding.Dialect.SAFE) {
                if (c == '+') c = '-';
                else if (c == '/') c = '_';
            }

            if (c == '=') {
                if (padding == BaseEncoding.Padding.STANDARD) {
                    safeBase64.append('=');
                }
                else if (padding == BaseEncoding.Padding.SAFE) {
                    safeBase64.append('.');
                }
            } else {
                safeBase64.append(c);
            }
        }
        return safeBase64.toString();
    }
1124371
public static byte[] decode(byte[] in) {
        return org.apache.commons.codec.binary.Base64.decodeBase64(in);
    }