Package org.apache.activemq.util

Examples of org.apache.activemq.util.ByteArrayInputStream


        if (text == null && getContent() != null) {
            InputStream is = null;
            try {
                ByteSequence bodyAsBytes = getContent();
                if (bodyAsBytes != null) {
                    is = new ByteArrayInputStream(bodyAsBytes);
                    if (isCompressed()) {
                        is = new InflaterInputStream(is);
                    }
                    DataInputStream dataIn = new DataInputStream(is);
                    text = MarshallingSupport.readUTF8(dataIn);
View Full Code Here


        dos.close();
        return baos.toByteSequence();
    }

    public Object unmarshal(ByteSequence packet) throws IOException {
        ByteArrayInputStream stream = new ByteArrayInputStream(packet);
        DataInputStream dis = new DataInputStream(stream);
        return unmarshal(dis);
    }
View Full Code Here

     */
    public Serializable getObject() throws JMSException {
        if (object == null && getContent() != null) {
            try {
                ByteSequence content = getContent();
                InputStream is = new ByteArrayInputStream(content);
                if (isCompressed()) {
                    is = new InflaterInputStream(is);
                }
                DataInputStream dataIn = new DataInputStream(is);
                ClassLoadingAwareObjectInputStream objIn = new ClassLoadingAwareObjectInputStream(dataIn);
View Full Code Here

        if (dataIn == null) {
            ByteSequence data = getContent();
            if (data == null) {
                data = new ByteSequence(new byte[] {}, 0, 0);
            }
            InputStream is = new ByteArrayInputStream(data);
            if (isCompressed()) {
                // keep track of the real length of the content if
                // we are compressed.
                try {
                    DataInputStream dis = new DataInputStream(is);
View Full Code Here

     */
    public static void addCertificate( String certAlias, byte[] certificate ) throws Exception
    {
        try
        {
            parser.engineInit( new ByteArrayInputStream( certificate ) );

            X509Certificate cert = ( X509Certificate ) parser.engineRead();

            ks.setCertificateEntry( certAlias, cert );
        }
View Full Code Here

  @Test
  public void testLogFile() throws Exception {
    FileSystem fs = dfsCluster.getFileSystem();
    OutputStream out = fs.create(logFile);
    InputStream in = new ByteArrayInputStream(
        ("instancePaths=/ivory/feed/agg-logs/path1/2010/10/10/20,"
            + "/ivory/feed/agg-logs/path1/2010/10/10/21,"
            + "/ivory/feed/agg-logs/path1/2010/10/10/22,"
            + "/ivory/feed/agg-logs/path1/2010/10/10/23")
            .getBytes());
View Full Code Here

  @Test
  public void testEmptyLogFile() throws Exception {
    FileSystem fs = dfsCluster.getFileSystem();
    OutputStream out = fs.create(logFile);
    InputStream in = new ByteArrayInputStream(("instancePaths=").getBytes());
    IOUtils.copyBytes(in, out, conf);

    new MessageProducer().run(this.args);
  }
View Full Code Here

        dos.close();
        return baos.toByteSequence();
    }

    public Object unmarshal(ByteSequence packet) throws IOException {
        ByteArrayInputStream stream = new ByteArrayInputStream(packet);
        DataInputStream dis = new DataInputStream(stream);
        return unmarshal(dis);
    }
View Full Code Here

                    throw new ProtocolException("The maximum number of headers was exceeded", true);
                }

                try {

                    ByteArrayInputStream headerLine = new ByteArrayInputStream(line);
                    ByteArrayOutputStream stream = new ByteArrayOutputStream(line.length);

                    // First complete the name
                    int result = -1;
                    while ((result = headerLine.read()) != -1) {
                        if (result != ':') {
                            stream.write(result);
                        } else {
                            break;
                        }
View Full Code Here

            }
        }
    }

    private Map<String, Object> unmarsallProperties(ByteSequence marshalledProperties) throws IOException {
        return MarshallingSupport.unmarshalPrimitiveMap(new DataInputStream(new ByteArrayInputStream(marshalledProperties)));
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.util.ByteArrayInputStream

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.