Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  //  The contents of this file are subject to the Mozilla Public License
  //  Version 1.1 (the "License"); you may not use this file except in
  //  compliance with the License. You may obtain a copy of the License
  //  at http://www.mozilla.org/MPL/
  //
  //  Software distributed under the License is distributed on an "AS IS"
  //  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  //  the License for the specific language governing rights and
  //  limitations under the License.
 //
 //  The Original Code is RabbitMQ.
 //
 //  The Initial Developer of the Original Code is VMware, Inc.
 //  Copyright (c) 2007-2011 VMware, Inc.  All rights reserved.
 //
 
 
 package com.rabbitmq.client.impl;
 
 import java.util.Date;
 import java.util.Map;
 
Parses AMQP wire-protocol Method arguments from a DataInputStream. Methods on this object are usually called from generated code.
 
 public class MethodArgumentReader
 {
    
The stream we are reading from.
 
     private final ValueReader in;
    
If we are reading one or more bits, holds the current packed collection of bits
 
     private int bits;
    
If we are reading one or more bits, keeps track of which bit position we will read from next. (reading least to most significant order)
 
     private int nextBitMask;

    
Resets the bit group accumulator variables when some non-bit argument value is to be read.
 
     private void clearBits()
     {
          = 0;
          = 0x100; // triggers readOctet first time
     }

    
Construct a MethodArgumentReader from the given ValueReader.
 
     public MethodArgumentReader(ValueReader in)
     {
         this. = in;
         clearBits();
     }

    
Public API - reads a short string argument.
 
     public final String readShortstr()
         throws IOException
     {
         clearBits();
         return .readShortstr();
     }

    
Public API - reads a long string argument.
 
     public final LongString readLongstr()
         throws IOException
     {
         clearBits();
         return .readLongstr();
     }

    
Public API - reads a short integer argument.
 
     public final int readShort()
         throws IOException
     {
         clearBits();
         return .readShort();
     }

    
Public API - reads an integer argument.
 
     public final int readLong()
         throws IOException
     {
         clearBits();
         return .readLong();
     }

    
Public API - reads a long integer argument.
 
     public final long readLonglong()
         throws IOException
     {
         clearBits();
         return .readLonglong();
     }

    
Public API - reads a bit/boolean argument.
    public final boolean readBit()
        throws IOException
    {
        if ( > 0x80) {
             = .readOctet();
             = 0x01;
        }
        boolean result = (&) != 0;
         =  << 1;
        return result;
    }

    
Public API - reads a table argument.
    public final Map<StringObjectreadTable()
        throws IOException
    {
        clearBits();
        return .readTable();
    }

    
Public API - reads an octet argument.
    public final int readOctet()
        throws IOException
    {
        clearBits();
        return .readOctet();
    }

    
Public API - reads an timestamp argument.
    public final Date readTimestamp()
        throws IOException
    {
        clearBits();
        return .readTimestamp();
    }
New to GrepCode? Check out our FAQ X