net.iharder.Base64.encodeObject()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中net.iharder.Base64.encodeObject()方法的一些代码示例,展示了Base64.encodeObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.encodeObject()方法的具体详情如下:
包路径:net.iharder.Base64
类名称:Base64
方法名:encodeObject

Base64.encodeObject介绍

[英]Serializes an object and returns the Base64-encoded version of that serialized object.

As of v 2.3, if the object cannot be serialized or there is another error, the method will throw an java.io.IOException. This is new to v2.3! In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it.

The object is not GZip-compressed before being encoded.
[中]序列化对象并返回该序列化对象的Base64编码版本。
从v2.3开始,如果对象无法序列化或出现另一个错误,该方法将抛出java。木卫一。例外。这是v2的新特性。3.在早期版本中,它只是返回一个空值,但在retrospect中,这是一种非常糟糕的处理方法。
该对象在编码之前未进行GZip压缩。

代码示例

代码示例来源:origin: kaaproject/kaa

@Override
public String generateSdk(SdkProfileDto sdkProfile, SdkPlatform targetPlatform)
  throws KaaAdminServiceException {
 try {
  doGenerateSdk(sdkProfile, targetPlatform);
  return Base64.encodeObject(
    new CacheService.SdkKey(sdkProfile, targetPlatform), Base64.URL_SAFE);
 } catch (Exception ex) {
  throw Utils.handleException(ex);
 }
}

代码示例来源:origin: kaaproject/kaa

@Override
public String getRecordDataByApplicationIdAndSchemaVersion(String applicationId,
                              int schemaVersion,
                              RecordKey.RecordFiles file)
  throws KaaAdminServiceException {
 checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER);
 try {
  checkApplicationId(applicationId);
  RecordKey sdkKey = new RecordKey(applicationId, schemaVersion, file);
  return Base64.encodeObject(sdkKey, Base64.URL_SAFE);
 } catch (Exception ex) {
  throw Utils.handleException(ex);
 }
}

代码示例来源:origin: kaaproject/kaa

@Override
public String getRecordLibraryByApplicationIdAndSchemaVersion(String applicationId,
                               int logSchemaVersion,
                               RecordKey.RecordFiles file)
  throws KaaAdminServiceException {
 checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER);
 try {
  checkApplicationId(applicationId);
  RecordKey sdkKey = new RecordKey(applicationId, logSchemaVersion, file);
  return Base64.encodeObject(sdkKey, Base64.URL_SAFE);
 } catch (Exception ex) {
  throw Utils.handleException(ex);
 }
}

代码示例来源:origin: kaaproject/kaa

@Override
public String prepareCtlSchemaExport(String ctlSchemaId,
                   CTLSchemaExportMethod method)
  throws KaaAdminServiceException {
 checkAuthority(KaaAuthorityDto.values());
 try {
  CTLSchemaDto schemaFound = controlService.getCtlSchemaById(ctlSchemaId);
  Utils.checkNotNull(schemaFound);
  checkCtlSchemaReadScope(
    schemaFound.getMetaInfo().getTenantId(), schemaFound.getMetaInfo().getApplicationId());
  CtlSchemaExportKey key = new CtlSchemaExportKey(ctlSchemaId, method);
  return Base64.encodeObject(key, Base64.URL_SAFE);
 } catch (Exception ex) {
  throw Utils.handleException(ex);
 }
}

代码示例来源:origin: uk.org.mygrid.taverna/taverna-contrib

/**
 * Serializes an object and returns the Base64-encoded version of that
 * serialized object. If the object cannot be serialized or there is another
 * error, the method will return <tt>null</tt>. The object is not
 * GZip-compressed before being encoded.
 * 
 * @param serializableObject
 *            The object to encode
 * @return The Base64-encoded object
 * @since 1.4
 */
public static String encodeObject(java.io.Serializable serializableObject) {
  return encodeObject(serializableObject, NO_OPTIONS);
} // end encodeObject

代码示例来源:origin: Nextdoor/bender

/**
 * Serializes an object and returns the Base64-encoded
 * version of that serialized object.  
 *  
 * <p>As of v 2.3, if the object
 * cannot be serialized or there is another error,
 * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
 * In earlier versions, it just returned a null value, but
 * in retrospect that's a pretty poor way to handle it.</p>
 * 
 * The object is not GZip-compressed before being encoded.
 *
 * @param serializableObject The object to encode
 * @return The Base64-encoded object
 * @throws java.io.IOException if there is an error
 * @throws NullPointerException if serializedObject is null
 * @since 1.4
 */
public static String encodeObject( java.io.Serializable serializableObject )
throws java.io.IOException {
  return encodeObject( serializableObject, NO_OPTIONS );
}   // end encodeObject

代码示例来源:origin: pelotoncycle/weberknecht

/**
 * Serializes an object and returns the Base64-encoded
 * version of that serialized object.  
 *  
 * <p>As of v 2.3, if the object
 * cannot be serialized or there is another error,
 * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
 * In earlier versions, it just returned a null value, but
 * in retrospect that's a pretty poor way to handle it.</p>
 * 
 * The object is not GZip-compressed before being encoded.
 *
 * @param serializableObject The object to encode
 * @return The Base64-encoded object
 * @throws java.io.IOException if there is an error
 * @throws NullPointerException if serializedObject is null
 * @since 1.4
 */
public static String encodeObject( java.io.Serializable serializableObject )
throws java.io.IOException {
  return encodeObject( serializableObject, NO_OPTIONS );
}   // end encodeObject

代码示例来源:origin: com.wesleyhome.johksoftware/utilities

public void serializeObject(final E object) throws IOException {
  File parentFile = objectFile.getParentFile();
  if (parentFile != null) {
    FileUtils.forceMkdir(parentFile);
  }
  if (!objectFile.exists()) {
    objectFile.createNewFile();
  }
  String encodeObject = Base64.encodeObject(object);
  ObjectOutput objectOutput = new ObjectOutputStream(new FileOutputStream(objectFile));
  objectOutput.writeObject(encodeObject);
  objectOutput.flush();
  objectOutput.close();
}

代码示例来源:origin: org.intermine/intermine-api

String summaryText = Base64.encodeObject(templatePossibleValues);
if (summaryText == null) {
  throw new RuntimeException("Serialised summary is null");

代码示例来源:origin: intermine/intermine

String summaryText = Base64.encodeObject(templatePossibleValues);
if (summaryText == null) {
  throw new RuntimeException("Serialised summary is null");

相关文章