public class Header extends Object
struct MsgHeader {
int32 messageLength; // total message size, including this
int32 requestID; // identifier for this message
int32 responseTo; // requestID from the original request
// (used in reponses from db)
int32 opCode; // request type - see table below
}
Modifier and Type | Field and Description |
---|---|
static int |
SIZE
The size of a message header.
|
Constructor and Description |
---|
Header(BsonInputStream in)
Creates a new header.
|
Header(int length,
int requestId,
int responseId,
Operation operation)
Creates a new header.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Determines if the passed object is of this same type as this object and
if so that its fields are equal.
|
int |
getLength()
Returns the length of the message in bytes.
|
Operation |
getOperation()
Returns the operation for the message.
|
int |
getRequestId()
Returns the request id for the message.
|
int |
getResponseId()
Returns the response id for the message.
|
int |
hashCode()
Computes a reasonable hash code.
|
public static final int SIZE
public Header(BsonInputStream in) throws IOException
in
- The stream to read the header from.IOException
- On a failure reading the header.public Header(int length, int requestId, int responseId, Operation operation)
length
- The length of the message in bytes.requestId
- The request id for the message.responseId
- The response id for the message.operation
- The operation for the message.public boolean equals(Object object)
equals
in class Object
object
- The object to compare to.Object.equals(java.lang.Object)
public int getLength()
SIZE
of the header.public Operation getOperation()
public int getRequestId()
public int getResponseId()
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.