Example usage for java.io ObjectInput readObject

List of usage examples for java.io ObjectInput readObject

Introduction

In this page you can find the example usage for java.io ObjectInput readObject.

Prototype

public Object readObject() throws ClassNotFoundException, IOException;

Source Link

Document

Read and return an object.

Usage

From source file:org.marketcetera.util.ws.wrappers.RemoteException.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    setProperties((RemoteProperties) in.readObject());
}

From source file:com.splicemachine.derby.stream.output.direct.DirectTableWriterBuilder.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    destConglomerate = in.readLong();//from   w ww.j  a v a2 s.  c o m
    opCtx = (OperationContext) in.readObject();
    skipIndex = in.readBoolean();
    txn = SIDriver.driver().getOperationFactory().readTxn(in);
}

From source file:org.apache.camel.component.bean.BeanInvocation.java

public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
    methodBean = ObjectHelper.cast(MethodBean.class, objectInput.readObject());
    try {/*from   ww  w  . j  av a  2s .co  m*/
        method = methodBean.getMethod();
    } catch (NoSuchMethodException e) {
        throw IOHelper.createIOException(e);
    }
    args = ObjectHelper.cast(Object[].class, objectInput.readObject());
}

From source file:com.talis.storage.s3.ExternalizableS3Object.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    this.setKey(in.readUTF());
    this.setBucketName(in.readUTF());
    this.setAcl((AccessControlList) in.readObject());
    this.setMetadataComplete(in.readBoolean());
    this.addAllMetadata((Map) in.readObject());
    int length = in.readInt();
    byte[] entity = new byte[length];
    in.readFully(entity);/*from   ww w  .  ja v a2  s . c  om*/
    this.setDataInputStream(new ByteArrayInputStream(entity));
}

From source file:org.apache.ibatis.executor.loader.AbstractSerialStateHolder.java

@Override
public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    final Object data = in.readObject();
    if (data.getClass().isArray()) {
        this.userBeanBytes = (byte[]) data;
    } else {//from   w w w  .  ja  v  a  2 s  . c om
        this.userBean = data;
    }
}

From source file:org.apache.lens.lib.query.WrappedFileFormatter.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    formatter = (AbstractFileFormatter) in.readObject();
    metadata = formatter.getMetadata();/*w  w w .  j  a  va2  s .  c  o  m*/
}

From source file:bftsmart.consensus.TimestampValuePair.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    timestamp = in.readInt();/*from  w w w  .j a  v a 2  s  .  co  m*/
    value = (byte[]) in.readObject();
}

From source file:com.conwet.silbops.model.ContextFunctionTest.java

@Test
public void shouldExternalize() throws Exception {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutput output = new ObjectOutputStream(baos);

    output.writeObject(function);/*from  w  w w. j ava  2  s  .c o  m*/
    output.close();

    ObjectInput input = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));

    ContextFunction cxtFun = (ContextFunction) input.readObject();
    assertThat(cxtFun).isEqualTo(function);
}

From source file:org.nuxeo.ecm.platform.ui.web.binding.MetaMethodExpression.java

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    originalMethodExpression = (MethodExpression) in.readObject();
}

From source file:com.conwet.silbops.msg.UnadvertiseMsgTest.java

@Test
public void shouldExternalize() throws Exception {
    UnadvertiseMsg unAdvMsg = new UnadvertiseMsg();

    Advertise subscription = new Advertise().attribute("attr1", Type.DOUBLE).attribute("attr2", Type.LONG)
            .attribute("attr3", Type.STRING);
    unAdvMsg.setAdvertise(subscription);

    Advertise uncovered1 = new Advertise().attribute("attr1", Type.DOUBLE).attribute("attr2", Type.LONG)
            .attribute("attr3", Type.STRING).attribute("attr4", Type.DOUBLE);

    Advertise uncovered2 = new Advertise().attribute("attr1", Type.DOUBLE).attribute("attr2", Type.LONG)
            .attribute("attr3", Type.STRING).attribute("attr5", Type.LONG);

    Set<Advertise> uncovered = new HashSet<>();
    uncovered.add(uncovered1);//from  w w w  . ja v a 2  s  .  c  o  m
    uncovered.add(uncovered2);
    unAdvMsg.setUncovered(uncovered);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutput output = new ObjectOutputStream(baos);

    output.writeObject(unAdvMsg);
    output.close();

    ObjectInput input = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));

    assertThat((UnadvertiseMsg) input.readObject()).isEqualTo(unAdvMsg);
}