Package java.io

Examples of java.io.ObjectInput.readObject()


            out.writeObject(myTest);
            container.flush();

            ObjectInput input = container.getInput();

            Object value = input.readObject();

            if (!(myTest instanceof String[]))
              {
              assertEquals(value,myTest);
              }
View Full Code Here


       TestProxy proxy = TestProxy.createTestInstance();
       output.writeObject(proxy);
       output.flush();

       Integer obj = (Integer)input.readObject();

       System.out.println("response: " + obj);

       assertEquals(proxy.getProxy().doSomething(),obj.intValue());
View Full Code Here

            final ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(d1);
            out.close();

            final ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
            d2 = (SpreadsheetDate) in.readObject();
            in.close();
        }
        catch (Exception e) {
            System.out.println(e.toString());
        }
View Full Code Here

         // Read
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
         ObjectInput globalOI = globalMarshal.startObjectInput(bais, false);
         try {
            assertEquals(address, globalOI.readObject());

            /** BEGIN: Special treatment **/
            int offset = globalOI.readInt();
            // Now try the cache marshaller and borrow the input stream to read
            StreamingMarshaller cacheMarshaller = extractCacheMarshaller(cm.getCache());
View Full Code Here

            bais = new ByteArrayInputStream(bytes, offset + 4, bytes.length);
            ObjectInput cacheOI = cacheMarshaller.startObjectInput(bais, true);
            /** END: Special treatment **/

            try {
               assertEquals(cmd, cacheOI.readObject());
            } finally {
               cacheMarshaller.finishObjectInput(cacheOI);
            }
         } finally {
            globalMarshal.finishObjectInput(globalOI);
View Full Code Here

         // Read
         ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
         ObjectInput globalOI = globalMarshal.startObjectInput(bais, false);
         try {
            assertEquals(address, globalOI.readObject());
         } finally {
            globalMarshal.finishObjectInput(globalOI);
         }
      } finally {
         cm.stop();
View Full Code Here

    InputStream inFile = new FileInputStream( "C:\\Temp\\test.ser" );
    InputStream inBuffer = new BufferedInputStream( inFile );
    ObjectInput input = new ObjectInputStream ( inBuffer );
    try{
      T recovered = (T)input.readObject();
    }
    finally{
      input.close();
    }
  }
View Full Code Here

    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());
View Full Code Here

      String file = "org/jboss/remoting/marshall/encryption/"+algo+".key";
      InputStream is = tcl.getResourceAsStream(file);
      if(is == null)
         throw new IllegalStateException("Key file is not locatable");
      ObjectInput out = new ObjectInputStream(is);
      Key key = (Key)out.readObject();
      out.close();
      return key;
   }

   //Remove padding etc from the key algo
View Full Code Here

          out.writeObject(m1);
          out.close();

          ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(
                  buffer.toByteArray()));
          m2 = (DefaultBoundedRangeModel) in.readObject();
          in.close();
      }
      catch (Exception e) {
          e.printStackTrace();
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.