本文整理汇总了Java中net.iharder.Base64.decodeToObject方法的典型用法代码示例。如果您正苦于以下问题:Java Base64.decodeToObject方法的具体用法?Java Base64.decodeToObject怎么用?Java Base64.decodeToObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.iharder.Base64
的用法示例。
在下文中一共展示了Base64.decodeToObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGet
import net.iharder.Base64; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String ctlExportKeyBase64 = URLDecoder
.decode(request.getParameter(CTL_EXPORT_KEY_PARAMETER), "UTF-8");
try {
CtlSchemaExportKey key = (CtlSchemaExportKey) Base64
.decodeToObject(ctlExportKeyBase64, Base64.URL_SAFE, null);
FileData ctlExportData = cacheService.getExportedCtlSchema(key);
ServletUtils.prepareDisposition(request, response, ctlExportData.getFileName());
response.setContentType(ctlExportData.getContentType());
response.setContentLength(ctlExportData.getFileData().length);
response.setBufferSize(BUFFER);
response.getOutputStream().write(ctlExportData.getFileData());
response.flushBuffer();
} catch (Exception ex) {
LOG.error("Unexpected error in CtlExportServlet.doGet: ", ex);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Unable to get file: "
+ ex.getMessage());
}
}
示例2: doGet
import net.iharder.Base64; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String recordKeyBase64 = URLDecoder.decode(request.getParameter(RECORD_KEY_PARAMETER), "UTF-8");
try {
RecordKey key = (RecordKey) Base64.decodeToObject(recordKeyBase64, Base64.URL_SAFE, null);
FileData recordLibrary = cacheService.getRecordData(key);
ServletUtils.prepareDisposition(request, response, recordLibrary.getFileName());
response.setContentLength(recordLibrary.getFileData().length);
response.setBufferSize(BUFFER);
response.getOutputStream().write(recordLibrary.getFileData());
response.flushBuffer();
} catch (Exception ex) {
LOG.error("Unexpected error in RecordLibraryServlet.doGet: ", ex);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Unable to get file: "
+ ex.getMessage());
}
}
示例3: doGet
import net.iharder.Base64; //导入方法依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String sdkKeyBase64 = URLDecoder.decode(request.getParameter(SDK_KEY_PARAMETER), "UTF-8");
try {
CacheService.SdkKey key = (CacheService.SdkKey) Base64
.decodeToObject(sdkKeyBase64, Base64.URL_SAFE, null);
FileData sdkFile = cacheService.getSdk(key);
response.setContentType(sdkFile.getContentType());
ServletUtils.prepareDisposition(request, response, sdkFile.getFileName());
response.setContentLength(sdkFile.getFileData().length);
response.setBufferSize(BUFFER);
response.getOutputStream().write(sdkFile.getFileData());
response.flushBuffer();
} catch (Exception ex) {
LOG.error("Unexpected error in SdkServlet.doGet: ", ex);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Unable to get Sdk file: "
+ ex.getMessage());
}
}
示例4: restoreLatestAlert
import net.iharder.Base64; //导入方法依赖的package包/类
/**
* 最新の警報情報を読み込む。
*
* @return 警報情報
*/
@Nullable
private Alert restoreLatestAlert() {
final String string = getPreferences(mContext).getString(KEY_LATEST_ALERT, null);
if (string != null) {
try {
return (Alert) Base64.decodeToObject(string);
} catch (IOException | ClassCastException | ClassNotFoundException e) {
Log.e(TAG, ExceptionUtils.getStackTrace(e));
return null;
}
} else {
return null;
}
}
示例5: CacheableObject
import net.iharder.Base64; //导入方法依赖的package包/类
public CacheableObject(String base64object) {
try {
CacheableObject thisObject = (CacheableObject) Base64
.decodeToObject(base64object);
this.object = thisObject.object;
this.expirationTime = thisObject.expirationTime;
} catch (Exception e) {
}
}