Package org.jboss.util.stream

Examples of org.jboss.util.stream.MarshalledValueOutputStream


    *         (or null), and element 1 is the persistent state (or null).
    */
   private byte[] generateState(Fqn fqn, long timeout, boolean force) throws Throwable
   {

      MarshalledValueOutputStream out = null;
      byte[] result = null;
      try
      {
         ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
         out = new MarshalledValueOutputStream(baos);
         try
         {
            stateTransferManager.getState(out, fqn, timeout, force, false);
         }
         catch (RegionEmptyException ree)
View Full Code Here


   }

   @Override
   public ObjectOutput getObjectOutput(OutputStream target) throws IOException
   {
      return new MarshalledValueOutputStream(target);
   }
View Full Code Here

      return new MarshalledValueInputStream(source);
   }

   public ObjectOutput getObjectOutput(OutputStream target) throws IOException
   {
      return new MarshalledValueOutputStream(target);
   }
View Full Code Here

    * @return serialized form of the object
    */
   public static byte[] objectToByteBuffer(Object obj) throws Exception
   {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      MarshalledValueOutputStream out = new MarshalledValueOutputStream(baos);
      out.writeObject(obj);
      out.close();
      return baos.toByteArray();
   }
View Full Code Here

    *         (or null), and element 1 is the persistent state (or null).
    */
   private byte[] generateState(Fqn fqn, long timeout, boolean force) throws Throwable
   {

      MarshalledValueOutputStream out = null;
      byte[] result = null;
      try
      {
         ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
         out = new MarshalledValueOutputStream(baos);
         try
         {
            stateTransferManager.getState(out, fqn, timeout, force, false);
         }
         catch (RegionEmptyException ree)
View Full Code Here

                Object state = provider.getCurrentState();
                try {
                    if (provider instanceof StateTransferStreamProvider) {
                        ((StateTransferStreamProvider) provider).getCurrentState(ostream);
                    } else {
                        MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(ostream);
                        toClose = mvos;
                        mvos.writeObject(state);
                    }
                } catch (Exception ex) {
                    CoreGroupCommunicationService.this.log.error("getState failed for service " + serviceName, ex);
                } finally {
                    if (toClose != null) {
View Full Code Here

            CoreGroupCommunicationService.this.log.debug("getState called for service " + serviceName);

            StateTransferProvider provider = stateProviders.get(serviceName);
            if (provider != null) {
                MarshalledValueOutputStream mvos = null;
                Object state = provider.getCurrentState();
                try {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
                    mvos = new MarshalledValueOutputStream(baos);
                    mvos.writeObject(state);
                    mvos.flush();
                    mvos.close();
                    return baos.toByteArray();
                } catch (Exception ex) {
                    CoreGroupCommunicationService.this.log.error("getState failed for service " + serviceName, ex);
                } finally {
                    if (mvos != null) {
                        try {
                            mvos.close();
                        } catch (IOException ignored) {
                            log.debug("Caught exception closing stream used for marshalling state", ignored);
                        }
                    }
                }
View Full Code Here

    /**
     * Serializes an object into a byte buffer. The object has to implement interface Serializable or Externalizable
     */
    byte[] objectToByteBufferInternal(Object obj) throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(baos);
        mvos.writeObject(obj);
        mvos.flush();
        return baos.toByteArray();
    }
View Full Code Here

        }

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        // write a marker to stream to distinguish from null value stream
        baos.write(SERIALIZABLE_VALUE);
        MarshalledValueOutputStream mvos = new MarshalledValueOutputStream(baos);
        mvos.writeObject(obj);
        mvos.flush();
        return baos.toByteArray();
    }
View Full Code Here

    *         (or null), and element 1 is the persistent state (or null).
    */
   public byte[] generateState(Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Throwable
   {

      MarshalledValueOutputStream out = null;
      byte[] result = null;
      try
      {
         ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(16 * 1024);
         out = new MarshalledValueOutputStream(baos);
         stateTransferManager.getState(out, fqn, timeout, force, suppressErrors);
         result = baos.getRawBuffer();
      }
      finally
      {
View Full Code Here

TOP

Related Classes of org.jboss.util.stream.MarshalledValueOutputStream

Copyright © 2018 www.massapicom. 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.