Package org.apache.activemq.util

Examples of org.apache.activemq.util.ByteArrayOutputStream.toByteArray()


            } else {
                decoded.write(value);
            }
        }

        return new String(decoded.toByteArray(), "UTF-8");
    }

    public int getVersion() {
        return version;
    }
View Full Code Here


                os.write(ch);
            }
            is.close();
            os.close();

            return os.toByteArray();

        } catch (IOException e) {
            throw (SQLException)new SQLException("BLOB could not be updated: " + e).initCause(e);
        } finally {
            try {
View Full Code Here

            if (receiptId != null) {
                headers.put(Stomp.Headers.Response.RECEIPT_ID, receiptId);
            }
        }

        StompFrame errorMessage = new StompFrame(Stomp.Responses.ERROR, headers, baos.toByteArray());
        sendToStomp(errorMessage);
    }

    protected void onStompSend(StompFrame command) throws IOException, JMSException {
        checkConnected();
View Full Code Here

                    baos.write(b);
                }

                if (baos != null) {
                    baos.close();
                    data = baos.toByteArray();
                }

            }

            return new StompFrame(action, headers, data);
View Full Code Here

    public void write(Command command, SocketAddress address) throws IOException {
        synchronized (writeLock) {

            ByteArrayOutputStream largeBuffer = new ByteArrayOutputStream(defaultMarshalBufferSize);
            wireFormat.marshal(command, new DataOutputStream(largeBuffer));
            byte[] data = largeBuffer.toByteArray();
            int size = data.length;

            ByteBuffer writeBuffer = bufferPool.borrowBuffer();
            writeBuffer.clear();
            headerMarshaller.writeHeader(command, writeBuffer);
View Full Code Here

              baos.write(b);
          }
         
          if( baos!=null ) {
              baos.close();
              data = baos.toByteArray();
          }
         
      }
     
      return new StompFrame(action, headers, data);
View Full Code Here

            final String receiptId = (String) command.getHeaders().get(Stomp.Headers.RECEIPT_REQUESTED);
            if( receiptId != null ) {
              headers.put(Stomp.Headers.Response.RECEIPT_ID, receiptId);
            }

          StompFrame errorMessage = new StompFrame(Stomp.Responses.ERROR,headers,baos.toByteArray());
      sendToStomp(errorMessage);

      if( e.isFatal() )
        getTransportFilter().onException(e);
        }
View Full Code Here

              os.write(ch);
          }
          is.close();
          os.close();
         
          return os.toByteArray();
         
      } catch (IOException e) {
            throw (SQLException) new SQLException("BLOB could not be updated: "
                    + e).initCause(e);
        } finally {
View Full Code Here

            if (receiptId != null) {
                headers.put(Stomp.Headers.Response.RECEIPT_ID, receiptId);
            }
        }

        StompFrame errorMessage = new StompFrame(Stomp.Responses.ERROR, headers, baos.toByteArray());
        sendToStomp(errorMessage);
    }

    protected void onStompSend(StompFrame command) throws IOException, JMSException {
        checkConnected();
View Full Code Here

            if (remaining(writeBuffer) >= 0) {
                sendWriteBuffer(address, writeBuffer, command.getCommandId());
            }
            else {
                // lets split the command up into chunks
                byte[] data = writeBuffer.toByteArray();
                boolean lastFragment = false;
                for (int fragment = 0, length = data.length; !lastFragment; fragment++) {
                    writeBuffer = createByteArrayOutputStream();
                    headerMarshaller.writeHeader(command, dataOut);
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.