Package org.apache.activemq.util

Examples of org.apache.activemq.util.DataByteArrayInputStream


        if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) {
            if (LOG.isInfoEnabled()) {
                LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms");
            }
        }
        DataByteArrayInputStream is = new DataByteArrayInputStream(data);
        byte readByte = is.readByte();
        KahaEntryType type = KahaEntryType.valueOf(readByte);
        if( type == null ) {
            try {
                is.close();
            } catch (IOException e) {}
            throw new IOException("Could not load journal record. Invalid location: "+location);
        }
        JournalCommand<?> message = (JournalCommand<?>)type.createMessage();
        message.mergeFramed(is);
View Full Code Here


    }

    final int XID_PREFIX_SIZE = 16;
    //+|-,(long)lastAck,(byte)priority,(int)formatid,(short)globalLength....
    private void initFromEncodedBytes() throws IOException {
        DataByteArrayInputStream inputStream = new DataByteArrayInputStream(encodedXidBytes);
        inputStream.skipBytes(10);
        formatId = inputStream.readInt();
        int globalLength = inputStream.readShort();
        globalTransactionId = new byte[globalLength];
        try {
            inputStream.read(globalTransactionId);
            branchQualifier = new byte[inputStream.available()];
            inputStream.read(branchQualifier);
        } catch (IOException fatal) {
            throw new RuntimeException(this + ", failed to decode:", fatal);
        }
    }
View Full Code Here

        if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) {
            if (LOG.isInfoEnabled()) {
                LOG.info("Slow KahaDB access: Journal read took: "+(end-start)+" ms");
            }
        }
        DataByteArrayInputStream is = new DataByteArrayInputStream(data);
        byte readByte = is.readByte();
        KahaEntryType type = KahaEntryType.valueOf(readByte);
        if( type == null ) {
            try {
                is.close();
            } catch (IOException e) {}
            throw new IOException("Could not load journal record. Invalid location: "+location);
        }
        JournalCommand<?> message = (JournalCommand<?>)type.createMessage();
        message.mergeFramed(is);
View Full Code Here

        recoveredPendingCommit.addAll(inflightTransactions.keySet());
        LOG.info("pending local transactions: " + recoveredPendingCommit);
    }

    public JournalCommand<?> load(Location location) throws IOException {
        DataByteArrayInputStream is = new DataByteArrayInputStream(journal.read(location));
        byte readByte = is.readByte();
        KahaEntryType type = KahaEntryType.valueOf(readByte);
        if (type == null) {
            throw new IOException("Could not load journal record. Invalid location: " + location);
        }
        JournalCommand<?> message = (JournalCommand<?>) type.createMessage();
View Full Code Here

    }

    public void load() {
        if (loaded.compareAndSet(false, true)) {
            keysPerPage = pageSize / keySize;
            dataIn = new DataByteArrayInputStream();
            dataOut = new DataByteArrayOutputStream(pageSize);
            readBuffer = new byte[pageSize];
            try {
                openIndexFile();
                long offset = 0;
View Full Code Here

            }
            this.bins = new HashBin[capacity];
            this.numberOfBins=capacity;
            threshold = calculateThreashold();
            keysPerPage = pageSize / keySize;
            dataIn = new DataByteArrayInputStream();
            dataOut = new DataByteArrayOutputStream(pageSize);
            readBuffer = new byte[pageSize];
            try {
                openIndexFile();
                if (indexFile.length() > 0) {
View Full Code Here

     *
     * @param fileId
     */
    SyncDataFileReader(DataManagerImpl fileManager) {
        this.dataManager = fileManager;
        this.dataIn = new DataByteArrayInputStream();
    }
View Full Code Here

     *
     * @param file
     */
    StoreIndexReader(RandomAccessFile file) {
        this.file = file;
        this.dataIn = new DataByteArrayInputStream();
    }
View Full Code Here

                   if (!processedHeaders) {
                       currentCommand.write(b);
                       // end of headers section, parse action and header
                       if (previousByte == '\n' && b == '\n') {
                           if (wireFormat instanceof StompWireFormat) {
                               DataByteArrayInputStream data = new DataByteArrayInputStream(currentCommand.toByteArray());
                               action = ((StompWireFormat)wireFormat).parseAction(data);
                               headers = ((StompWireFormat)wireFormat).parseHeaders(data);
                               String contentLengthHeader = headers.get(Stomp.Headers.CONTENT_LENGTH);
                               if (contentLengthHeader != null) {
                                   contentLength = ((StompWireFormat)wireFormat).parseContentLength(contentLengthHeader);
View Full Code Here

           if (!processedHeaders) {
               currentCommand.write(b);
               // end of headers section, parse action and header
               if (b == '\n' && (previousByte == '\n' || currentCommand.endsWith(crlfcrlf))) {
                   StompWireFormat wf = (StompWireFormat) transport.getWireFormat();
                   DataByteArrayInputStream data = new DataByteArrayInputStream(currentCommand.toByteArray());
                   action = wf.parseAction(data);
                   headers = wf.parseHeaders(data);
                   try {
                       if (action.equals(Stomp.Commands.CONNECT) || action.equals(Stomp.Commands.STOMP)) {
                           wf.setStompVersion(detectVersion(headers));
View Full Code Here

TOP

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

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.