List of usage examples for org.apache.commons.lang3 SerializationUtils deserialize
public static <T> T deserialize(final byte[] objectData)
Deserializes a single Object from an array of bytes.
From source file:com.splicemachine.derby.stream.output.direct.DirectTableWriterBuilder.java
public static DirectTableWriterBuilder decodeBase64(String base64) { byte[] bytes = Base64.decodeBase64(base64); return (DirectTableWriterBuilder) SerializationUtils.deserialize(bytes); }
From source file:com.textocat.textokit.resource.SerializedResourceLocator.java
@Override public boolean initialize(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { if (!super.initialize(aSpecifier, aAdditionalParams)) return false; ///* w w w . j av a2s . co m*/ BufferedInputStream in; try { in = new BufferedInputStream(resourceMeta.getInputStream()); } catch (Exception e) { throw new ResourceInitializationException(e); } // closes stream resourceObject = SerializationUtils.deserialize(in); if (expectedClass != null && !expectedClass.isInstance(resourceObject)) { throw new IllegalStateException(format("Unexpected type of object in %s, expected - %s, actual - %s", resourceMeta, expectedClass.getName(), resourceObject.getClass().getName())); } return true; }
From source file:com.iveely.computing.common.StreamPacket.java
/** * Bytes to stream packet. */ public StreamPacket toObject(byte[] bytes) { return (StreamPacket) SerializationUtils.deserialize(bytes); }
From source file:com.dangdang.ddframe.job.cloud.executor.TaskExecutor.java
@Override public void registered(final ExecutorDriver executorDriver, final Protos.ExecutorInfo executorInfo, final Protos.FrameworkInfo frameworkInfo, final Protos.SlaveInfo slaveInfo) { if (!executorInfo.getData().isEmpty()) { Map<String, String> data = SerializationUtils.deserialize(executorInfo.getData().toByteArray()); BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(data.get("event_trace_rdb_driver")); dataSource.setUrl(data.get("event_trace_rdb_url")); dataSource.setPassword(data.get("event_trace_rdb_password")); dataSource.setUsername(data.get("event_trace_rdb_username")); jobEventBus = new JobEventBus(new JobEventRdbConfiguration(dataSource)); }/*from w ww . j a v a2s. com*/ }
From source file:com.iveely.framework.net.Packet.java
/** * Convert bytes to Internet packet. */ public Packet toPacket(byte[] bytes) { return SerializationUtils.deserialize(bytes); }
From source file:com.nesscomputing.sequencer.AbstractSequencerTest.java
@Test public void testEmptySerialization() { final S seq = createEmpty(); byte[] bytes = SerializationUtils.serialize(seq); assertEquals(seq, SerializationUtils.deserialize(bytes)); }
From source file:com.link_intersystems.util.SerializableTemplateObjectFactory.java
/** * @return a new instance of the template object reflecting the template * object's state at the time that this * {@link SerializableTemplateObjectFactory} was created. *//*from w ww . j a v a 2s . c o m*/ @SuppressWarnings("unchecked") public T getObject() { return (T) SerializationUtils.deserialize(template); }
From source file:com.splicemachine.derby.stream.output.delete.DeleteTableWriterBuilder.java
public static DeleteTableWriterBuilder getDeleteTableWriterBuilderFromBase64String(String base64String) throws IOException { if (base64String == null) throw new IOException("tableScanner base64 String is null"); return (DeleteTableWriterBuilder) SerializationUtils.deserialize(Base64.decodeBase64(base64String)); }
From source file:com.mobilesolutionworks.android.httpcache.HttpCacheLoaderImpl.java
public HttpCache onForceLoad(ContentObserver observer) { HttpCache tag = new HttpCache(); tag.local = mBuilder.localUri();/*from w ww . j a v a2 s . com*/ Uri authority = HttpCacheConfiguration.configure(mContext).authority; ContentResolver cr = mContext.getContentResolver(); tag.cursor = cr.query(authority, PROJECTION, "local = ?", new String[] { tag.local }, null); if (tag.cursor == null) { // cursor only null if provider is not set throw new IllegalStateException("is tag provider set properly?"); } tag.cursor.getCount(); tag.cursor.registerContentObserver(observer); tag.cursor.setNotificationUri(mContext.getContentResolver(), authority.buildUpon().appendEncodedPath(tag.local).build()); if (tag.cursor.moveToFirst()) { // cache stored in database tag.loaded = true; tag.remote = tag.cursor.getString(0); tag.content = tag.cursor.getString(1); tag.expiry = tag.cursor.getLong(2); tag.error = tag.cursor.getInt(3); byte[] trace = tag.cursor.getBlob(4); if (trace != null) { tag.trace = SerializationUtils.deserialize(trace); } tag.status = tag.cursor.getInt(5); } return tag; }
From source file:Entities.Orders.java
public HashMap<Products, Integer> getOrderContents() { HashMap<Products, Integer> contents = (HashMap) SerializationUtils.deserialize(orderMap); return contents; }