本文整理汇总了Java中org.apache.commons.codec.binary.Base64InputStream类的典型用法代码示例。如果您正苦于以下问题:Java Base64InputStream类的具体用法?Java Base64InputStream怎么用?Java Base64InputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Base64InputStream类属于org.apache.commons.codec.binary包,在下文中一共展示了Base64InputStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: pushNotificationClient
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
private PushNotificationClient pushNotificationClient() throws IOException {
return new PushNotificationClient(
"passTypeIdentifier",
IOUtils.toString(new Base64InputStream(getClass().getClassLoader().getResourceAsStream("wallet/test.p12"), true)),
"test",
"true") {
@Override
public void connect() {
}
@Override
public PushNotificationResponse sendPushNotification(String pushToken) {
return new PushNotificationResponse(true, "", false);
}
@Override
public void disconnect() {
}
};
}
开发者ID:AusDTO,项目名称:citizenship-appointment-server,代码行数:21,代码来源:PassUpdateServiceTest.java
示例2: _testBinaryReader
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
public void _testBinaryReader() throws Exception {
// read file and store in occurrence
String file = TestFileUtils.getTestInputFile("various", "blob.gif");
Reader ri = new InputStreamReader(new Base64InputStream(new FileInputStream(file), true), "utf-8");
occurrence.setReader(ri, file.length(), DataTypes.TYPE_BINARY);
assertTrue("Occurrence datatype is incorrect", Objects.equals(DataTypes.TYPE_BINARY, occurrence.getDataType()));
// read and decode occurrence content
Reader ro = occurrence.getReader();
assertTrue("Reader value is null", ro != null);
InputStream in = new Base64InputStream(new ReaderInputStream(ro, "utf-8"), false);
try {
OutputStream out = new FileOutputStream("/tmp/blob.gif");
try {
IOUtils.copy(in, out);
} finally {
out.close();
}
} finally {
in.close();
}
}
开发者ID:ontopia,项目名称:ontopia,代码行数:24,代码来源:OccurrenceTest.java
示例3: onSubmit
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override
public void onSubmit() {
FileUpload upload = uploadField.getFileUpload();
if (upload != null) {
try {
Reader input = new InputStreamReader(new Base64InputStream(upload.getInputStream(), true), "utf-8");
FieldInstance fieldInstance = fieldValueModel.getFieldInstanceModel().getFieldInstance();
StringWriter swriter = new StringWriter();
IOUtils.copy(input, swriter);
String value = swriter.toString();
fieldInstance.addValue(value, getLifeCycleListener());
fieldValueModel.setExistingValue(value);
uploaded = true;
} catch (IOException e) {
e.printStackTrace();
}
}
}
开发者ID:ontopia,项目名称:ontopia,代码行数:19,代码来源:UploadIFrame.java
示例4: doPost
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
CertificationRequest csr = decoder.decode(new Base64InputStream(request.getInputStream()));
try {
response.setContentType(APPLICATION_PKCS7_MIME);
response.addHeader("Content-Transfer-Encoding", "base64");
X509Certificate certificate = est.enroll(csr);
Base64OutputStream bOut = new Base64OutputStream(response.getOutputStream());
encoder.encode(bOut, certificate);
bOut.flush();
bOut.close();
} catch (IOException e) {
response.sendError(500);
response.getWriter().write(e.getMessage());
response.getWriter().close();
}
// 202
// Retry-After
// 400
}
开发者ID:jscep,项目名称:jester,代码行数:25,代码来源:EnrollmentServlet.java
示例5: transform
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override
public void transform(InputStream inputStream) throws XMLStreamException {
if (getOutputStream() != null) {
super.transform(inputStream);
} else {
super.transform(new Base64InputStream(inputStream, false));
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:9,代码来源:TransformBase64Decode.java
示例6: decode
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
/**
* Decode an input stream and write processed data to an output stream
* @param in the input stream to be decoded
* @param out the output stream to write the decoded data
* @throws IOException
*/
public static void decode(InputStream in, OutputStream out) throws IOException
{
Base64InputStream base64is = new Base64InputStream(in);
copy(base64is, out);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:13,代码来源:Base64Util.java
示例7: encode
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
/**
* Encode an input stream and write processed data to an output stream
* @param in the input stream to be encoded
* @param out the output stream to write the encoded data
* @throws IOException
*/
public static void encode(InputStream in, OutputStream out) throws IOException
{
Base64InputStream base64is = new Base64InputStream(in, true, DEFAULT_LINE_LENGTH, DEFAULT_LINE_SEPARATOR);
copy(base64is, out);
}
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:13,代码来源:Base64Util.java
示例8: createSigningInformation
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
PKSigningInformation createSigningInformation() {
InputStream appleWwdrcaAsStream = getClass().getClassLoader().getResourceAsStream("wallet/AppleWWDRCA.pem");
InputStream base64EncodedPrivateKeyAndCertificatePkcs12AsStream = new ByteArrayInputStream(privateKeyP12Base64.getBytes(StandardCharsets.UTF_8));
Base64InputStream privateKeyAndCertificatePkcs12AsStream = new Base64InputStream(base64EncodedPrivateKeyAndCertificatePkcs12AsStream);
try {
return new PKSigningInformationUtil().loadSigningInformationFromPKCS12AndIntermediateCertificate(privateKeyAndCertificatePkcs12AsStream, privateKeyPassPhrase, appleWwdrcaAsStream);
} catch (IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException | NoSuchProviderException | UnrecoverableKeyException e) {
throw new RuntimeException("Problem creating pass signing information", e);
}
}
开发者ID:AusDTO,项目名称:citizenship-appointment-server,代码行数:11,代码来源:PassBuilder.java
示例9: PushNotificationClient
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Autowired
public PushNotificationClient(@Value("${wallet.pass.type.identifier}") String passTypeIdentifier,
@Value("${wallet.private.key.p12.base64}") String privateKeyP12Base64,
@Value("${wallet.private.key.passphrase}") String privateKeyPassPhrase,
@Value("${wallet.push.notifications.enabled:true}") String pushNotificationsEnabled) {
this.passTypeIdentifier = passTypeIdentifier;
this.pushNotificationsEnabled = !"false".equalsIgnoreCase(pushNotificationsEnabled);
ByteArrayInputStream base64EncodedPrivateKeyAndCertificatePkcs12AsStream = new ByteArrayInputStream(privateKeyP12Base64.getBytes(StandardCharsets.UTF_8));
Base64InputStream privateKeyAndCertificatePkcs12AsStream = new Base64InputStream(base64EncodedPrivateKeyAndCertificatePkcs12AsStream);
try {
this.client = new ApnsClient<>(privateKeyAndCertificatePkcs12AsStream, privateKeyPassPhrase);
} catch (SSLException e) {
throw new RuntimeException("Problem creating APNs client", e);
}
}
开发者ID:AusDTO,项目名称:citizenship-appointment-server,代码行数:16,代码来源:PushNotificationClient.java
示例10: decompressStream
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
static void decompressStream(InputStream inputStream, OutputStream outputStream) throws IOException {
@SuppressWarnings("resource")
InputStream iStream = new GZIPInputStream(new Base64InputStream(new BufferedInputStream(inputStream), false, -1, null));
OutputStream oStream = new BufferedOutputStream(outputStream);
byte[] buffer = new byte[2048];
int bytesRead;
while ((bytesRead = iStream.read(buffer)) != -1) {
oStream.write(buffer, 0, bytesRead);
}
oStream.flush();
}
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:Compressor.java
示例11: convertFromBase64Png
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override
public File convertFromBase64Png(String base64Png) {
try {
IOUtils.copy(new Base64InputStream(IOUtils.toInputStream(base64Png)), new FileOutputStream(file));
} catch (IOException e) {
throw new WebDriverException(e);
}
return file;
}
开发者ID:adfemg,项目名称:adf-selenium,代码行数:10,代码来源:FileOutputType.java
示例12: DataURIEncodingInputStream
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
public DataURIEncodingInputStream(final InputStream in, final MediaType type) {
// Only text documents should be URL-encoded. It doesn't matter if the encoding is supported or not because
// the URL-encoder works on raw bytes. Everything else must be base-64-encoded.
if (type.getType().equals("text")) {
this.prepend = ("data:" + type + ",").getBytes(StandardCharsets.US_ASCII);
this.encoder = new URLEncodingInputStream(in);
} else {
this.prepend = ("data:" + type + ";base64,").getBytes(StandardCharsets.US_ASCII);
this.encoder = new Base64InputStream(in, true, -1, null);
}
}
开发者ID:ICIJ,项目名称:extract,代码行数:13,代码来源:DataURIEncodingInputStream.java
示例13: getBase64StringImage
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
/**
* Converts the given base 64 string into a BufferedImage object.
* @param string the base 64 string
* @return BufferedImage
* @throws IOException if an exception occurs reading the image data
*/
public static final BufferedImage getBase64StringImage(String string) throws IOException {
ByteArrayInputStream bais = new ByteArrayInputStream(string.getBytes());
BufferedInputStream bis = new BufferedInputStream(bais);
Base64InputStream b64is = new Base64InputStream(bis);
return ImageIO.read(b64is);
}
开发者ID:wnbittle,项目名称:praisenter,代码行数:13,代码来源:ImageUtilities.java
示例14: getInputStream
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override
public InputStream getInputStream() throws ResourceStreamNotFoundException {
try {
return new Base64InputStream(new ReaderInputStream(reader, "utf-8"), false);
} catch (UnsupportedEncodingException e) {
throw new OntopiaRuntimeException(e);
}
}
开发者ID:ontopia,项目名称:ontopia,代码行数:9,代码来源:OccurrenceWebResource.java
示例15: obtainCaCertificates
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
public X509Certificate[] obtainCaCertificates() throws IOException {
HttpGet get = new HttpGet(buildUrl(CA_CERTIFICATES_DISTRIBUTION));
HttpResponse response = httpClient.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
checkStatusCode(statusCode, 200);
checkContentType(response);
checkContentTransferEncoding(response);
HttpEntity entity = response.getEntity();
X509Certificate[] certs = certDecoder.decode(new Base64InputStream(entity.getContent()));
return certs;
}
开发者ID:jscep,项目名称:jester,代码行数:15,代码来源:EstClient.java
示例16: enroll
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
private EnrollmentResponse enroll(CertificationRequest csr, String command) throws IOException {
HttpPost post = new HttpPost(buildUrl(command));
post.addHeader("Content-Type", "application/pkcs10");
post.addHeader("Content-Transfer-Encoding", "base64");
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
Base64OutputStream base64Out = new Base64OutputStream(bOut);
csrEncoder.encode(base64Out, csr);
base64Out.flush();
base64Out.close();
post.setEntity(new ByteArrayEntity(bOut.toByteArray()));
HttpResponse response = httpClient.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
checkStatusCode(statusCode, 200, 202);
if (statusCode == 200) {
checkContentType(response);
checkContentTransferEncoding(response);
HttpEntity entity = response.getEntity();
X509Certificate[] certs = certDecoder.decode(new Base64InputStream(entity.getContent()));
return new EnrollmentResponse(certs[0]);
} else {
String retryAfter = response.getFirstHeader("Retry-After").getValue();
return new EnrollmentResponse(RetryAfterParser.parse(retryAfter));
}
}
开发者ID:jscep,项目名称:jester,代码行数:28,代码来源:EstClient.java
示例17: streamBlob
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
public static void streamBlob(Blob blob, String column, String charset, boolean blobIsCompressed, String blobBase64Direction, Object target, boolean close) throws JdbcException, SQLException, IOException {
if (target==null) {
throw new JdbcException("cannot stream Blob to null object");
}
OutputStream outputStream=StreamUtil.getOutputStream(target);
if (outputStream!=null) {
InputStream inputStream = JdbcUtil.getBlobInputStream(blob, column, blobIsCompressed);
if ("decode".equalsIgnoreCase(blobBase64Direction)){
Base64InputStream base64DecodedStream = new Base64InputStream (inputStream);
StreamUtil.copyStream(base64DecodedStream, outputStream, 50000);
}
else if ("encode".equalsIgnoreCase(blobBase64Direction)){
Base64InputStream base64EncodedStream = new Base64InputStream (inputStream, true);
StreamUtil.copyStream(base64EncodedStream, outputStream, 50000);
}
else {
StreamUtil.copyStream(inputStream, outputStream, 50000);
}
if (close) {
outputStream.close();
}
return;
}
Writer writer = StreamUtil.getWriter(target);
if (writer !=null) {
Reader reader = JdbcUtil.getBlobReader(blob, column, charset, blobIsCompressed);
StreamUtil.copyReaderToWriter(reader, writer, 50000, false, false);
if (close) {
writer.close();
}
return;
}
throw new IOException("cannot stream Blob to ["+target.getClass().getName()+"]");
}
开发者ID:ibissource,项目名称:iaf,代码行数:36,代码来源:JdbcUtil.java
示例18: getImageFile
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override public File getImageFile() throws IOException {
if (empty(getImage())) return null;
final File temp = temp("."+getFormat());
final Base64InputStream stream = new Base64InputStream(new ByteArrayInputStream(image.getBytes()));
FileUtil.toFile(temp, stream);
return temp;
}
开发者ID:cobbzilla,项目名称:cobbzilla-utils,代码行数:8,代码来源:Base64ImageInsertion.java
示例19: doSomething
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override
public InputStream doSomething(InputStream inputStream) {
return new Base64InputStream(inputStream);
}
开发者ID:kekru,项目名称:ILIASDownloader2,代码行数:5,代码来源:FileSync.java
示例20: unmarshal
import org.apache.commons.codec.binary.Base64InputStream; //导入依赖的package包/类
@Override
public Object unmarshal(Exchange exchange, InputStream input) throws Exception {
return new Base64InputStream(input, false, lineLength, lineSeparator);
}
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:Base64DataFormat.java
注:本文中的org.apache.commons.codec.binary.Base64InputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论