Package java.io

Examples of java.io.ObjectInputStream.readObject()


        Content content = getContentResponseHandler.getContent();
        ByteArrayInputStream bis = new ByteArrayInputStream(content.getContent());
      ObjectInputStream in;
      try {
        in = new ObjectInputStream(bis);
        input = in.readObject();
        in.close();
      } catch (IOException e) {
        e.printStackTrace();
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
View Full Code Here


                    processInstance).getProcess()).getDefaultContext(VariableScope.VARIABLE_SCOPE);
                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance(variableScope);
                    for (int i = 0; i < nbVariables; i++) {
                        String name = stream.readUTF();
                        try {
                            Object value = stream.readObject();
                            variableScopeInstance.internalSetVariable(name, value);
                        } catch (ClassNotFoundException e) {
                            throw new IllegalArgumentException("Could not reload variable " + name);
                        }
                    }
View Full Code Here

    assertTrue(contentId != -1);
    BlockingGetContentResponseHandler getContentResponseHandler = new BlockingGetContentResponseHandler();
    getClient().getContent(contentId, getContentResponseHandler);
    ByteArrayInputStream bis = new ByteArrayInputStream(getContentResponseHandler.getContent().getContent());
    ObjectInputStream in = new ObjectInputStream(bis);
    Object data = in.readObject();
    in.close();
    assertEquals("This is the content", data);

    System.out.println("Starting task " + task.getId());
    BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
View Full Code Here

    assertTrue(contentId != -1);
    BlockingGetContentResponseHandler getContentResponseHandler = new BlockingGetContentResponseHandler();
    getClient().getContent(contentId, getContentResponseHandler);
    ByteArrayInputStream bis = new ByteArrayInputStream(getContentResponseHandler.getContent().getContent());
    ObjectInputStream in = new ObjectInputStream(bis);
    Map<String, Object> data = (Map<String, Object>) in.readObject();
    in.close();
                //Checking that the input parameters are being copied automatically if the Content Element doesn't exist
    assertEquals("MyObjectValue", ((MyObject)data.get("MyObject")).getValue());
                assertEquals("10", data.get("Priority"));
                assertEquals("MyObjectValue", ((MyObject)((Map<String, Object>)data.get("MyMap")).get("MyObjectInsideTheMap")).getValue());
View Full Code Here

        int nbParameters = stream.readInt();

        for ( int i = 0; i < nbParameters; i++ ) {
            String name = stream.readUTF();
            try {
                Object value = stream.readObject();
                workItem.setParameter( name,
                                       value );
            } catch ( ClassNotFoundException e ) {
                throw new IllegalArgumentException( "Could not reload parameter " + name );
            }
View Full Code Here

        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(new ExceptionHolder(new BadException(obj)));
        oos.flush();
       
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ExceptionHolder holder = (ExceptionHolder)ois.readObject();
        assertTrue(holder.getException() instanceof BadException);
        assertEquals("Remote org.teiid.client.util.TestExceptionHolder$BadException: null", holder.getException().getMessage()); //$NON-NLS-1$
  }

View Full Code Here

        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(new ExceptionHolder(new BadException2(obj, "I have foreign exception embedded in me"))); //$NON-NLS-1$
        oos.flush();
       
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ExceptionHolder holder = (ExceptionHolder)ois.readObject();
        Throwable e = holder.getException();
        assertTrue(e instanceof BadException2);
        assertEquals("Remote org.teiid.client.util.TestExceptionHolder$BadException2: I have foreign exception embedded in me", e.getMessage()); //$NON-NLS-1$
       
        // now unknown exception is not found, so promote known SQL exception up
View Full Code Here

        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(new ExceptionHolder(obj));
        oos.flush();
       
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ExceptionHolder holder = (ExceptionHolder)ois.readObject();
        Throwable e = holder.getException();
        assertTrue(e instanceof TeiidRuntimeException);
        assertEquals("Unknown Exception", e.getMessage()); //$NON-NLS-1$
 
 
View Full Code Here

        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(new ExceptionHolder(ex));
        oos.flush();
       
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
        ExceptionHolder holder = (ExceptionHolder)ois.readObject();
        Throwable e = holder.getException();
        assertTrue(e instanceof TeiidException);
  }
}
View Full Code Here

          Thread t = new Thread() {
            public void run() {
              try {
              InputStream is = getResources().openRawResource(R.raw.hcsb_ser);
              ObjectInputStream ios = new ObjectInputStream(is);
              Object o = ios.readObject();
              DetectHaarParam.setCascade((HaarClassifierCascade) o);
              ios.close();
              is.close();
              } catch (Exception ex) {
                    ex.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.