Java Code Examples for java.io.ObjectInput

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Cours-3eme-ann-e, under directory /Java/FerryInpres/src/identity_server/.

Source file: Utils.java

  22 
vote

public static Object decryptObject(byte[] bytes,Cipher decryptor) throws IOException, ClassNotFoundException, IllegalBlockSizeException, BadPaddingException {
  ByteArrayInputStream bis=new ByteArrayInputStream(decryptor.doFinal(bytes));
  ObjectInput in=new ObjectInputStream(bis);
  Object o=in.readObject();
  bis.close();
  in.close();
  return o;
}
 

Example 2

From project gora, under directory /gora-core/src/main/java/org/apache/gora/util/.

Source file: IOUtils.java

  22 
vote

public static Object readObject(DataInput in) throws ClassNotFoundException, IOException {
  if (in instanceof ObjectInput) {
    return ((ObjectInput)in).readObject();
  }
 else {
    if (in instanceof InputStream) {
      ObjectInput objIn=new ObjectInputStream((InputStream)in);
      Object obj=objIn.readObject();
      return obj;
    }
  }
  throw new IOException("cannot write to DataOutput of instance:" + in.getClass());
}
 

Example 3

From project platform_external_android-mock, under directory /tests/com/google/android/testing/mocking/.

Source file: AndroidMockTest.java

  22 
vote

public void testAndThrowsOnMockedInterface() throws IOException {
  ObjectInput mockInStream=AndroidMock.createMock(ObjectInput.class);
  AndroidMock.expect(mockInStream.read()).andThrow(new IOException("foo"));
  AndroidMock.replay(mockInStream);
  try {
    mockInStream.read();
    fail("IOException not thrown");
  }
 catch (  IOException e) {
    assertEquals("foo",e.getMessage());
  }
  AndroidMock.verify(mockInStream);
}
 

Example 4

From project rj-core, under directory /de.walware.rj.data/src/de/walware/rj/data/.

Source file: RJIO.java

  22 
vote

public byte[] readByteArray() throws IOException {
  final ObjectInput in=this.in;
  final byte[] array=new byte[in.readInt()];
  in.readFully(array);
  return array;
}
 

Example 5

From project serialization, under directory /thrift/src/test/java/com/ning/metrics/serialization/event/.

Source file: TestThriftEnvelopeEvent.java

  22 
vote

@Test(groups="fast") public void testSerialization() throws Exception {
  final ThriftEnvelope thriftEnvelope=new ThriftEnvelope(eventType);
  thriftEnvelope.getPayload().add(ThriftField.createThriftField("fuuness",(short)0));
  thriftEnvelope.getPayload().add(ThriftField.createThriftField(100L,(short)1));
  final ThriftEnvelopeEvent event=new ThriftEnvelopeEvent(new DateTime("2009-01-01T02:03:04"),thriftEnvelope);
  final ByteArrayOutputStream byteOut=new ByteArrayOutputStream();
  final ObjectOutput objectOut=new ObjectOutputStream(byteOut);
  event.writeExternal(objectOut);
  objectOut.close();
  final ObjectInput objectInput=new ObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
  @SuppressWarnings({"deprecation"}) final ThriftEnvelopeEvent resultEvent=new ThriftEnvelopeEvent();
  resultEvent.readExternal(objectInput);
  Assert.assertEquals(resultEvent.getData(),event.getData());
}
 

Example 6

From project stream-lib, under directory /src/test/java/com/clearspring/analytics/stream/.

Source file: TestStreamSummary.java

  22 
vote

@SuppressWarnings("unchecked") @Test public void testSerialization() throws IOException, ClassNotFoundException {
  StreamSummary<String> vs=new StreamSummary<String>(3);
  String[] stream={"X","X","Y","Z","A","B","C","X","X","A","C","A","A"};
  for (  String i : stream)   vs.offer(i);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ObjectOutput oo=new ObjectOutputStream(baos);
  oo.writeObject(vs);
  oo.close();
  ObjectInput oi=new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
  StreamSummary<String> clone=(StreamSummary<String>)oi.readObject();
  assertEquals(vs.toString(),clone.toString());
}
 

Example 7

From project ha-jdbc, under directory /src/main/java/net/sf/hajdbc/util/.

Source file: Objects.java

  21 
vote

/** 
 * Deserializes the specified bytes into the object of the specified type.
 * @param bytes a serialized object
 * @param loader the classloader used during deserialization
 * @return a deserialized object
 */
public static <T>T deserialize(byte[] bytes,ClassLoader loader){
  if (bytes == null)   return null;
  try {
    ObjectInput input=new ObjectInputStream(new ByteArrayInputStream(bytes));
    try {
      return readObject(input,loader);
    }
  finally {
      Resources.close(input);
    }
  }
 catch (  IOException e) {
    throw new IllegalStateException(e);
  }
}
 

Example 8

From project joshua, under directory /test/joshua/util/io/.

Source file: BinaryTest.java

  21 
vote

@Test public void externalizeVocabulary() throws IOException, ClassNotFoundException {
  Set<String> words=new HashSet<String>();
  for (char c1='a'; c1 <= 'z'; c1++) {
    words.add(new String(new char[]{c1}));
    for (char c2='a'; c2 <= 'z'; c2++) {
      words.add(new String(new char[]{c1,c2}));
    }
  }
  Vocabulary vocab=new Vocabulary(words);
  try {
    File tempFile=File.createTempFile(BinaryTest.class.getName(),"vocab");
    FileOutputStream outputStream=new FileOutputStream(tempFile);
    ObjectOutput out=new BinaryOut(outputStream,true);
    vocab.writeExternal(out);
    ObjectInput in=new BinaryIn<Vocabulary>(tempFile.getAbsolutePath(),Vocabulary.class);
    Object o=in.readObject();
    Assert.assertTrue(o instanceof Vocabulary);
    Vocabulary newVocab=(Vocabulary)o;
    Assert.assertNotNull(newVocab);
    Assert.assertEquals(newVocab.size(),vocab.size());
    Assert.assertEquals(newVocab,vocab);
  }
 catch (  SecurityException e) {
    Assert.fail("Operating system is unable to create a temp file required by this unit test: " + e);
  }
}
 

Example 9

From project jPOS, under directory /jpos/src/test/java/org/jpos/iso/.

Source file: ISOAmountTest.java

  21 
vote

@Test public void testBadReadAttemptISOException() throws IOException, ClassNotFoundException {
  iSOAmount=new ISOAmount(){
    @Override public void setValue(    Object obj) throws ISOException {
      throw new ISOException("yikes!");
    }
  }
;
  ObjectInput in=mock(ObjectInput.class);
  try {
    iSOAmount.readExternal(in);
  }
 catch (  IOException ioe) {
    assertThat(ioe.getMessage(),is("yikes!"));
  }
}
 

Example 10

From project oreilly-ejb-6thedition-book-examples, under directory /ch06-filetransfer/src/test/java/org/jboss/ejb3/examples/ch06/filetransfer/.

Source file: FileTransferUnitTestCase.java

  21 
vote

/** 
 * Mocks the passivation/activation process by manually invoking upon the  {@link PrePassivate} and {@link PostActivate} lifecyclecallbacks.  The client should function properly after these calls are made, reconnecting as expected, and resuming into the correct present working  directory
 * @throws Exception
 */
@Test public void testPassivationAndActivation() throws Exception {
  log.info("testPassivationAndActivation");
  final FileTransferCommonBusiness client=this.getClient();
  final String home=getFtpHome().getAbsolutePath();
  client.cd(home);
  final String pwdBefore=client.pwd();
  TestCase.assertEquals("Present working directory should be set to home",home,pwdBefore);
  log.info("Mock @" + PrePassivate.class.getName());
  client.disconnect();
  log.info("Mock passivation");
  final ByteArrayOutputStream outStream=new ByteArrayOutputStream();
  final ObjectOutput objectOut=new ObjectOutputStream(outStream);
  objectOut.writeObject(client);
  objectOut.close();
  log.info("Mock activation");
  final InputStream inStream=new ByteArrayInputStream(outStream.toByteArray());
  final ObjectInput objectIn=new ObjectInputStream(inStream);
  final FileTransferCommonBusiness serializedClient=(FileTransferCommonBusiness)objectIn.readObject();
  objectIn.close();
  log.info("Mock @" + PostActivate.class.getName());
  serializedClient.connect();
  final String pwdAfter=serializedClient.pwd();
  TestCase.assertEquals("Present working directory should be the same as before passivation/activation",home,pwdAfter);
}
 

Example 11

From project pangool, under directory /core/src/main/java/com/datasalt/pangool/utils/.

Source file: DCUtils.java

  21 
vote

/** 
 * Given a Hadoop Configuration property and an Class, this method can re-instantiate an Object instance that was previously serialized and saved in the Distributed Cache like in {@link DCUtils#serializeToDC(Object,String,Configuration)}.
 * @param < T >  The object type.
 * @param conf The Hadoop Configuration.
 * @param objClass The object type class.
 * @param fileName The file name to locate in DC
 * @param callSetConf If true, will call setConf() if deserialized object is Configurable
 * @throws IOException
 */
public static <T>T loadSerializedObjectInDC(Configuration conf,Class<T> objClass,String fileName,boolean callSetConf) throws IOException {
  Path path=DCUtils.locateFileInDC(conf,fileName);
  T obj;
  ObjectInput in;
  if (path == null) {
    throw new IOException("Path is null");
  }
  in=new ObjectInputStream(FileSystem.get(conf).open(path));
  try {
    obj=objClass.cast(in.readObject());
  }
 catch (  ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
  in.close();
  if (obj instanceof Configurable && callSetConf) {
    ((Configurable)obj).setConf(conf);
  }
  return obj;
}
 

Example 12

From project prishlo-li-android, under directory /src/org/aectann/postage/.

Source file: TrackingStorageUtils.java

  21 
vote

public static TrackingInfo loadStoredTrackingInfo(String trackingNumber,Context context){
  ObjectInput in=null;
  try {
    File trackingFile=getTrackingFile(context,trackingNumber);
    in=new ObjectInputStream(new FileInputStream(trackingFile));
    return (TrackingInfo)in.readObject();
  }
 catch (  FileNotFoundException e) {
    return null;
  }
catch (  Exception e) {
    throw new IllegalStateException(e);
  }
 finally {
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
 

Example 13

From project android_external_libphonenumber, under directory /java/src/com/android/i18n/phonenumbers/geocoding/.

Source file: AreaCodeMap.java

  19 
vote

/** 
 * Supports Java Serialization.
 */
public void readExternal(ObjectInput objectInput) throws IOException {
  boolean useFlyweightMapStorage=objectInput.readBoolean();
  if (useFlyweightMapStorage) {
    areaCodeMapStorage=new FlyweightMapStorage();
  }
 else {
    areaCodeMapStorage=new DefaultMapStorage();
  }
  areaCodeMapStorage.readExternal(objectInput);
}
 

Example 14

From project arquillian-core, under directory /test/spi/src/main/java/org/jboss/arquillian/test/spi/.

Source file: ExceptionProxy.java

  19 
vote

/** 
 * Custom Serialization logic. If possible, we try to keep the original Exception form the Container side. If we can't load the Exception on the client side, return a ArquillianProxyException that keeps the original stack trace etc. We can't use in.readObject() on the Throwable cause, because if a ClassNotFoundException is thrown, the stream is marked with the exception and that stream is the same stream that is deserializing us, so we will fail outside of our control. Store the Throwable cause as a serialized byte array instead, so we can deserialize it outside of our own stream.
 */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  className=(String)in.readObject();
  message=(String)in.readObject();
  trace=(StackTraceElement[])in.readObject();
  causeProxy=(ExceptionProxy)in.readObject();
  byte[] originalExceptionData=(byte[])in.readObject();
  if (originalExceptionData != null && originalExceptionData.length > 0) {
    try {
      ByteArrayInputStream originalIn=new ByteArrayInputStream(originalExceptionData);
      ObjectInputStream input=new ObjectInputStream(originalIn);
      original=(Throwable)input.readObject();
      SecurityActions.setFieldValue(Throwable.class,original,"cause",causeProxy.createException());
    }
 catch (    Throwable e) {
      deserializationProblem=true;
    }
  }
}
 

Example 15

From project arquillian-extension-warp, under directory /impl/src/main/java/org/jboss/arquillian/warp/impl/shared/.

Source file: RequestPayload.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  boolean isAnonymous=in.readBoolean();
  if (isAnonymous) {
    byte[] classFile=(byte[])in.readObject();
    byte[] obj=(byte[])in.readObject();
    final DynamicClassLoader cl=new DynamicClassLoader(Thread.currentThread().getContextClassLoader());
    final Class<?> clazz=cl.load(classFile);
    ObjectInputStream input=new ObjectInputStream(new ByteArrayInputStream(obj)){
      protected Class<?> resolveClass(      ObjectStreamClass desc) throws IOException, ClassNotFoundException {
        if (desc.getName().equals(clazz.getName())) {
          return clazz;
        }
        return super.resolveClass(desc);
      }
    }
;
    assertion=(ServerAssertion)input.readObject();
  }
 else {
    assertion=(ServerAssertion)in.readObject();
  }
}
 

Example 16

From project bam, under directory /modules/activity-analysis/analytics/src/main/java/org/overlord/bam/analytics/principal/.

Source file: PrincipalAction.java

  19 
vote

/** 
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  in.readInt();
  _principal=(String)in.readObject();
  _type=(Type)in.readObject();
  _properties=(java.util.Map<String,java.io.Serializable>)in.readObject();
}
 

Example 17

From project BeeQueue, under directory /src/org/beequeue/piles/flock/.

Source file: AbstractFlock.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  this.delta=in.readInt();
  this.size=in.readInt();
  this.empty=readEmpty(in);
  readData(in);
}
 

Example 18

From project cloudify, under directory /esc/src/main/java/org/cloudifysource/esc/driver/provisioning/.

Source file: MachineDetails.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  privateAddress=IOUtils.readString(in);
  publicAddress=IOUtils.readString(in);
  cloudifyInstalled=in.readBoolean();
  installationDirectory=IOUtils.readString(in);
  agentRunning=in.readBoolean();
  machineId=IOUtils.readString(in);
  fileTransferMode=FileTransferModes.valueOf(IOUtils.readString(in));
  remoteExecutionMode=RemoteExecutionModes.valueOf(IOUtils.readString(in));
  remoteDirectory=IOUtils.readString(in);
  locationId=IOUtils.readString(in);
}
 

Example 19

From project Collections, under directory /src/test/java/vanilla/java/collections/hand/.

Source file: HandTypesElement.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  setBoolean(BooleanFieldModel.read(in));
  setBoolean2(Boolean2FieldModel.read(in));
  setByte(ByteFieldModel.read(in));
  setByte2(Byte2FieldModel.read(in));
  setChar(CharFieldModel.read(in));
  setDouble(DoubleFieldModel.read(in));
  setElementType(Enum8FieldModel.read(in,ElementType.class));
  setString(Enumerated16FieldModel.read(in,String.class));
  setFloat(FloatFieldModel.read(in));
  setInt(IntFieldModel.read(in));
  setLong(LongFieldModel.read(in));
  setShort(ShortFieldModel.read(in));
  setA(ObjectFieldModel.read(in,ObjectTypes.A.class));
}
 

Example 20

From project DeuceSTM, under directory /src/java/org/deuce/trove/.

Source file: THash.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  in.readByte();
  float old_factor=_loadFactor;
  _loadFactor=in.readFloat();
  _autoCompactionFactor=in.readFloat();
  if (old_factor != _loadFactor) {
    setUp((int)Math.ceil(DEFAULT_INITIAL_CAPACITY / _loadFactor));
  }
}
 

Example 21

From project drools-chance, under directory /drools-chance-core/src/main/java/org/drools/chance/reteoo/nodes/.

Source file: LogicalAplhaOperatorNode.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  super.readExternal(in);
  connective=(ConnectiveCore)in.readObject();
  arity=in.readInt();
  argIndexes=(int[])in.readObject();
}
 

Example 22

From project droolsjbpm-integration, under directory /drools-grid/drools-grid-impl/src/main/java/org/drools/grid/timer/impl/.

Source file: ScheduledJob.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  this.jobId=in.readUTF();
  this.jobClass=(Class)Class.forName(in.readUTF());
  this.jobtrigger=(Serializable)in.readObject();
  this.nextFireTime=new Date(in.readLong());
  this.ctx=(Serializable)in.readObject();
  this.configuration=(ScheduledJobConfiguration)in.readObject();
}
 

Example 23

From project elw, under directory /datapath/src/main/java/gnu/trove/.

Source file: TIntArrayList.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  in.readByte();
  _pos=in.readInt();
  int len=in.readInt();
  _data=new int[len];
  for (int i=0; i < len; i++) {
    _data[i]=in.readInt();
  }
}
 

Example 24

From project git-plugin, under directory /src/main/java/org/spearce/jgit/transport/.

Source file: RemoteConfig.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  name=in.readUTF();
  final int items=in.readInt();
  Map<String,List<String>> map=new HashMap<String,List<String>>();
  for (int i=0; i < items; i++) {
    String key=in.readUTF();
    String value=in.readUTF();
    List<String> values=map.get(key);
    if (null == values) {
      values=new ArrayList<String>();
      map.put(key,values);
    }
    values.add(value);
  }
  fromMap(map);
}
 

Example 25

From project grails-ide, under directory /org.grails.ide.eclipse.editor.gsp/src/org/grails/ide/eclipse/editor/gsp/translation/internal/.

Source file: GSPTranslator.java

  19 
vote

/** 
 * <p><b>NOTE 1: </b>After reading in an externalized  {@link JSPTranslator} the caller mustmanually call  {@link #postReadExternalSetup(IStructuredModel)} to finish setting upthe  {@link JSPTranslator} for use.</p><p><b>NOTE 2: </b>If the implementation of this method is changed be sure to update {@link #writeExternal(ObjectOutput)} and {@link #serialVersionUID}</p>
 * @see #writeExternal(ObjectOutput)
 * @see #serialVersionUID
 * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  this.fClassHeader=readString(in);
  this.fClassname=readString(in);
  this.fSuperclass=readString(in);
  this.fImplicitImports=readString(in);
  this.fServiceHeader=readString(in);
  this.fUserImports=new StringBuffer(readString(in));
  this.fSourcePosition=in.readInt();
  this.fRelativeOffset=in.readInt();
  this.fCursorPosition=in.readInt();
  this.fIsErrorPage=in.readBoolean();
  this.fCursorInExpression=in.readBoolean();
  this.fIsInASession=in.readBoolean();
  this.fUserCode=new StringBuffer(readString(in));
  this.fUserELExpressions=new StringBuffer(readString(in));
  this.fUserDeclarations=new StringBuffer(readString(in));
  this.fCursorOwner=new StringBuffer(readString(in));
  this.fInCodeRegion=in.readBoolean();
  this.fProcessIncludes=in.readBoolean();
  this.fOffsetInUserImports=in.readInt();
  this.fOffsetInUserDeclarations=in.readInt();
  this.fOffsetInUserCode=in.readInt();
  int size=in.readInt();
  this.fIncludedPaths=new HashSet(size);
  for (int i=0; i < size; ++i) {
    this.fIncludedPaths.add(readString(in));
  }
  this.fImportRanges=readRanges(in);
  this.fCodeRanges=readRanges(in);
  this.fDeclarationRanges=readRanges(in);
  this.fUseBeanRanges=readRanges(in);
  this.fUserELRanges=readRanges(in);
  this.fIndirectRanges=readRanges(in);
  this.fELTranslatorID=readString(in);
  this.buildResult(false);
}
 

Example 26

From project hcatalog, under directory /src/java/org/apache/hcatalog/data/transfer/.

Source file: ReaderContext.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  conf.readFields(in);
  int numOfSplits=in.readInt();
  for (int i=0; i < numOfSplits; i++) {
    HCatSplit split=new HCatSplit();
    split.readFields(in);
    splits.add(split);
  }
}
 

Example 27

From project human-task-poc-proposal, under directory /human-task-core-cdi-experiment/src/main/java/org/jboss/human/interactions/model/.

Source file: PeopleAssignments.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  if (in.readBoolean()) {
    taskInitiator=new User();
    taskInitiator.readExternal(in);
  }
  potentialOwners=CollectionUtils.readOrganizationalEntityList(in);
  excludedOwners=CollectionUtils.readOrganizationalEntityList(in);
  taskStakeholders=CollectionUtils.readOrganizationalEntityList(in);
  businessAdministrators=CollectionUtils.readOrganizationalEntityList(in);
  recipients=CollectionUtils.readOrganizationalEntityList(in);
}
 

Example 28

From project Japid, under directory /src.japid/cn/bran/japid/template/.

Source file: RenderResult.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  String contentString=in.readUTF();
  if (_NULL.equals(contentString)) {
    this.content=null;
  }
 else {
    this.content=new StringBuilder(contentString);
  }
  renderTime=in.readLong();
  headers=(Map<String,String>)in.readObject();
}
 

Example 29

From project japid42, under directory /app/cn/bran/japid/template/.

Source file: RenderResult.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  String contentString=in.readUTF();
  if (_NULL.equals(contentString)) {
    this.content=null;
  }
 else {
    this.content=new StringBuilder(contentString);
  }
  renderTime=in.readLong();
  headers=(Map<String,String>)in.readObject();
}
 

Example 30

From project JavaStory, under directory /Core/src/main/java/javastory/io/.

Source file: GamePacket.java

  19 
vote

@Override public void readExternal(final ObjectInput input) throws IOException, ClassNotFoundException {
  final int length=input.read();
  this.bytes=new byte[length];
  int read=0;
  do {
    read+=input.read(this.bytes,read,length - read);
  }
 while (read < length);
}
 

Example 31

From project jboss-ejb-client, under directory /src/main/java/org/jboss/ejb/client/remoting/.

Source file: ProtocolMessageHandler.java

  19 
vote

protected Map<String,Object> readAttachments(final ObjectInput input) throws IOException, ClassNotFoundException {
  final int numAttachments=input.readByte();
  if (numAttachments == 0) {
    return null;
  }
  final Map<String,Object> attachments=new HashMap<String,Object>(numAttachments);
  for (int i=0; i < numAttachments; i++) {
    final String key=(String)input.readObject();
    final Object val=input.readObject();
    attachments.put(key,val);
  }
  return attachments;
}
 

Example 32

From project jboss-jpa, under directory /impl/src/main/java/org/jboss/jpa/impl/injection/.

Source file: InjectedEntityManagerFactory.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  String kernelName=in.readUTF();
  persistenceUnit=PersistenceUnitRegistry.getPersistenceUnit(kernelName);
  if (persistenceUnit == null)   throw new IOException("Unable to find persistence unit in registry: " + kernelName);
  delegate=persistenceUnit.getContainerEntityManagerFactory();
}
 

Example 33

From project jboss-marshalling, under directory /api/src/test/java/org/jboss/marshalling/cloner/.

Source file: SerializingClonerTestCase.java

  19 
vote

public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  foo=in.readInt();
  one=(ExtTest)in.readObject();
  foo=in.readInt();
  one=(ExtTest)in.readObject();
}
 

Example 34

From project jetty-session-redis, under directory /src/main/java/com/ovea/jetty/session/serializer/jboss/serial/classmetamodel/.

Source file: StreamingClass.java

  19 
vote

public static StreamingClass readStream(ObjectInput inp,ClassResolver resolver,ClassLoader loader,String className) throws IOException {
  ClassMetaData metadata=ClassMetamodelFactory.getClassMetaData(className,resolver,loader,false);
  StreamingClass streamClass=new StreamingClass(metadata);
  short slotsNrOnStreaming=inp.readShort();
  ClassMetaDataSlot slots[]=metadata.getSlots();
  if (slotsNrOnStreaming != slots.length) {
    throw new IOException("The hierarchy of " + className + " is different in your current classPath");
  }
  short[][] keyfields=new short[slots.length][];
  for (int slotIndex=0; slotIndex < slots.length; slotIndex++) {
    long shaSlotHash=inp.readLong();
    if (slots[slotIndex].getShaHash() != shaSlotHash) {
      throw new IOException("The hierarchy of " + className + " is different in your current classPath");
    }
    short numberofFields=inp.readShort();
    keyfields[slotIndex]=new short[numberofFields];
    ClassMetadataField fields[]=slots[slotIndex].getFields();
    if (numberofFields > fields.length) {
      throw new IOException("Current classpath has lesser fields on " + className + " than its original version");
    }
    for (short fieldIndex=0; fieldIndex < fields.length; fieldIndex++) {
      long hashfield=inp.readLong();
      ClassMetadataField fieldOnHash=slots[slotIndex].getField(hashfield);
      if (fieldOnHash == null) {
        throw new IOException("Field hash " + fieldOnHash + " is not available on current classPath for class "+ className);
      }
      keyfields[slotIndex][fieldIndex]=fieldOnHash.getOrder();
    }
  }
  streamClass.keyFields=keyfields;
  return streamClass;
}
 

Example 35

From project joda-money, under directory /src/main/java/org/joda/money/.

Source file: Ser.java

  19 
vote

/** 
 * Reads the data in from the stream.
 * @param in  the input stream
 * @throws IOException if an error occurs
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  type=in.readByte();
switch (type) {
case BIG_MONEY:
{
      object=readBigMoney(in);
      return;
    }
case MONEY:
{
    object=new Money(readBigMoney(in));
    return;
  }
case CURRENCY_UNIT:
{
  object=readCurrency(in);
  return;
}
case EXCHANGE_RATE:
{
object=readExchangeRate(in);
return;
}
}
throw new StreamCorruptedException("Serialization input has invalid type");
}
 

Example 36

From project kernel_1, under directory /exo.kernel.component.common/src/main/java/org/exoplatform/services/rpc/impl/.

Source file: AbstractRPCService.java

  19 
vote

/** 
 * {@inheritDoc}
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  boolean unicast=in.readBoolean();
  if (unicast) {
    this.destination=in.readInt();
  }
  this.commandId=in.readUTF();
  int size=in.readInt();
  if (size == -1) {
    this.args=null;
  }
 else {
    this.args=new Serializable[size];
    for (int i=0; i < size; i++) {
      args[i]=(Serializable)in.readObject();
    }
  }
}
 

Example 37

From project lullaby, under directory /src/net/sileht/lullaby/objects/.

Source file: Album.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  id=(String)in.readObject();
  name=(String)in.readObject();
  artist=(String)in.readObject();
  art=(String)in.readObject();
  tracks=(String)in.readObject();
  extra=(String)in.readObject();
  artist_id=(String)in.readObject();
}
 

Example 38

From project MachinaCraft, under directory /MachinaCore/src/gnu/trove/impl/hash/.

Source file: THash.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  in.readByte();
  float old_factor=_loadFactor;
  _loadFactor=in.readFloat();
  _autoCompactionFactor=in.readFloat();
  if (old_factor != _loadFactor) {
    setUp((int)Math.ceil(DEFAULT_CAPACITY / _loadFactor));
  }
}
 

Example 39

From project mdk, under directory /domain/annotation/src/main/java/uk/ac/ebi/mdk/domain/annotation/.

Source file: MolecularFormula.java

  19 
vote

/** 
 * @inheritDoc
 * @deprecated not used anymore
 */
@Override @Deprecated public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  super.readExternal(in);
  IChemObjectBuilder builder=DefaultChemObjectBuilder.getInstance();
  this.formula=MolecularFormulaManipulator.getMolecularFormula(getValue(),builder);
  this.html=MolecularFormulaManipulator.getHTML(formula);
}
 

Example 40

From project mvel, under directory /src/main/java/org/mvel2/util/.

Source file: FastList.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  elements=(E[])new Object[size=in.readInt()];
  for (int i=0; i < size; i++) {
    elements[i]=(E)in.readObject();
  }
}
 

Example 41

From project nuxeo-jsf, under directory /nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/component/list/.

Source file: StampState.java

  19 
vote

@SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  int size=in.readInt();
  if (size > 0) {
    rows=(Map<DualKey,Object>)in.readObject();
  }
  if (log.isDebugEnabled()) {
    for (    Map.Entry<DualKey,Object> entry : rows.entrySet()) {
      log.debug("Restoring " + entry.getKey() + ", "+ entry.getValue());
    }
  }
}
 

Example 42

From project Openbravo-POS-iPhone-App, under directory /OpenbravoPOS_PDA/src-pda/com/openbravo/pos/ticket/.

Source file: TicketInfo.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  m_sId=(String)in.readObject();
  tickettype=in.readInt();
  m_iTicketId=in.readInt();
  m_Customer=(CustomerInfoExt)in.readObject();
  m_dDate=(Date)in.readObject();
  attributes=(Properties)in.readObject();
  m_aLines=(List<TicketLineInfo>)in.readObject();
  m_User=null;
  m_sActiveCash=null;
  payments=new ArrayList<PaymentInfo>();
  taxes=null;
}
 

Example 43

From project openfire-jboss-clustering, under directory /src/main/java/com/enernoc/rnd/openfire/cluster/.

Source file: ExternalUtil.java

  19 
vote

@SuppressWarnings("unchecked") public int readExternalizableMap(DataInput in,Map<String,? extends Externalizable> map,ClassLoader loader) throws IOException {
  int size=in.readInt();
  int i;
  Map<String,Externalizable> map2=(Map<String,Externalizable>)map;
  for (i=0; i < size; i++) {
    String key=in.readUTF();
    Externalizable value;
    try {
      value=(Externalizable)Class.forName(in.readUTF(),true,loader).newInstance();
      value.readExternal((ObjectInput)in);
    }
 catch (    Exception e) {
      throw new IOException(e);
    }
    map2.put(key,value);
  }
  return i;
}
 

Example 44

From project openwebbeans, under directory /webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/.

Source file: EjbBeanProxyHandler.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  String passivationId=(String)in.readObject();
  if (passivationId != null) {
    this.ejbBean=(BaseEjbBean<?>)webBeansContext.getBeanManagerImpl().getPassivationCapableBean(passivationId);
  }
  this.isDependent=in.readBoolean();
  this.creationalContext=(CreationalContext<?>)in.readObject();
  this.dependentEJB=in.readObject();
}
 

Example 45

From project orientdb, under directory /core/src/main/java/com/orientechnologies/orient/core/storage/.

Source file: ORawBuffer.java

  19 
vote

public void readExternal(final ObjectInput iInput) throws IOException, ClassNotFoundException {
  final int bufferLenght=iInput.readInt();
  if (bufferLenght > 0) {
    buffer=new byte[bufferLenght];
    iInput.read(buffer);
  }
 else   buffer=null;
  version=iInput.readInt();
  recordType=iInput.readByte();
}
 

Example 46

From project processFlowProvision, under directory /pfpServices/common/src/main/java/org/jboss/processFlow/bam/.

Source file: HumanTaskLog.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  id=in.readLong();
  processInstanceId=in.readLong();
  nodeInstanceId=in.readLong();
  workItemId=in.readLong();
}
 

Example 47

From project Red5, under directory /src/org/red5/server/net/rtmp/event/.

Source file: Aggregate.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  super.readExternal(in);
  byte[] byteBuf=(byte[])in.readObject();
  if (byteBuf != null) {
    data=IoBuffer.allocate(byteBuf.length);
    data.setAutoExpand(true);
    SerializeUtils.ByteArrayToByteBuffer(byteBuf,data);
  }
}
 

Example 48

From project red5-mavenized, under directory /red5_base/src/main/java/org/red5/server/net/rtmp/event/.

Source file: AudioData.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  super.readExternal(in);
  byte[] byteBuf=(byte[])in.readObject();
  if (byteBuf != null) {
    data=ByteBuffer.allocate(0);
    data.setAutoExpand(true);
    SerializeUtils.ByteArrayToByteBuffer(byteBuf,data);
  }
}
 

Example 49

From project red5-server, under directory /src/org/red5/server/net/rtmp/event/.

Source file: Aggregate.java

  19 
vote

@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  super.readExternal(in);
  byte[] byteBuf=(byte[])in.readObject();
  if (byteBuf != null) {
    data=IoBuffer.allocate(byteBuf.length);
    data.setAutoExpand(true);
    SerializeUtils.ByteArrayToByteBuffer(byteBuf,data);
  }
}
 

Example 50

From project riftsaw-ode, under directory /jacob/src/main/java/org/apache/ode/jacob/vpu/.

Source file: ExecutionQueueImpl.java

  19 
vote

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  type=(Class)in.readObject();
  id=in.readInt();
  description=in.readUTF();
  refCount=in.readInt();
  replicatedSend=in.readBoolean();
  replicatedRecv=in.readBoolean();
  int cnt=in.readInt();
  for (int i=0; i < cnt; ++i) {
    objFrames.add((ObjectFrame)in.readObject());
  }
  cnt=in.readInt();
  for (int i=0; i < cnt; ++i) {
    msgFrames.add((MessageFrame)in.readObject());
  }
}
 

Example 51

From project rj-client, under directory /de.walware.rj.client/srcRServices/de/walware/rj/services/.

Source file: RPlatform.java

  19 
vote

public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  this.osType=in.readUTF();
  this.fileSep=in.readUTF();
  this.pathSep=in.readUTF();
  this.versionString=in.readUTF();
  this.osName=in.readUTF();
  this.osArch=in.readUTF();
  this.osVersion=in.readUTF();
}
 

Example 52

From project rj-servi, under directory /de.walware.rj.servi/src/de/walware/rj/servi/internal/.

Source file: RServiImpl.java

  19 
vote

public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
  this.accessId=in.readLong();
  this.poolRef=(PoolRef)in.readObject();
  this.backend=(RServiBackend)in.readObject();
  this.rjs.setServer(this.backend,1);
}
 

Example 53

From project scribble-core, under directory /bundles/org.scribble.protocol.monitor/src/main/java/org/scribble/protocol/monitor/.

Source file: DefaultSession.java

  19 
vote

/** 
 * {@inheritDoc}
 */
public void readExternal(ObjectInput ois) throws IOException, ClassNotFoundException {
  int version=ois.readInt();
  int nodeIndexes=ois.readInt();
  for (int i=0; i < nodeIndexes; i++) {
    _nodeIndexes.add(ois.readInt());
  }
  _returnIndex=ois.readInt();
  _mainConversation=(Session)ois.readObject();
  int nestedSize=ois.readInt();
  for (int i=0; i < nestedSize; i++) {
    _nestedConversations.add((Session)ois.readObject());
  }
  int interruptSize=ois.readInt();
  for (int i=0; i < interruptSize; i++) {
    _interruptConversations.add((Session)ois.readObject());
  }
  if (version > 1) {
    _parentConversation=(Session)ois.readObject();
    int stateSize=ois.readInt();
    for (int i=0; i < stateSize; i++) {
      String key=ois.readUTF();
      _state.put(key,ois.readObject());
    }
  }
}
 

Example 54

From project spring-webflow, under directory /spring-webflow/src/main/java/org/springframework/webflow/engine/impl/.

Source file: FlowSessionImpl.java

  19 
vote

@SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  flowId=(String)in.readObject();
  stateId=(String)in.readObject();
  scope=(MutableAttributeMap<Object>)in.readObject();
  parent=(FlowSessionImpl)in.readObject();
}
 

Example 55

From project staccatissimo, under directory /staccatissimo-io/src/main/java/net/sf/staccatocommons/io/.

Source file: IOStreams.java

  19 
vote

/** 
 * Answers a  {@link Stream} that retrieves objects from the given{@link ObjectInput}
 * @param < A > the type of object to read from the given <code>redable</code>
 * @param readable an  {@link ObjectInput} that is the source of the returned{@link Stream}
 * @return a new single-iteration {@link Stream}
 */
@NonNull public static <A>Stream<A> fromObjects(@KeepOpen @NonNull final ObjectInput readable){
  return Streams.from(new NextOptionIterator<A>(){
    protected Option<A> nextOption(){
      try {
        return Option.some((A)readable.readObject());
      }
 catch (      EOFException e) {
        return Option.none();
      }
catch (      Exception e) {
        throw SoftException.soften(e);
      }
    }
  }
);
}