当前位置: 首页>>代码示例>>Java>>正文


Java Base64.decodeToObject方法代码示例

本文整理汇总了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());
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:22,代码来源:CtlExportServlet.java

示例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());
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:19,代码来源:RecordServlet.java

示例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());
  }
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:21,代码来源:SdkServlet.java

示例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;
    }
}
 
开发者ID:ipublishing-osp,项目名称:esnavi,代码行数:20,代码来源:AlertStore.java

示例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) {
	}
}
 
开发者ID:codeforamerica,项目名称:open311_java,代码行数:10,代码来源:CacheableObject.java


注:本文中的net.iharder.Base64.decodeToObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。