Skip to content

Commit

Permalink
Binary protocol provides a binary response now.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Jan 18, 2008
1 parent 3da5ec4 commit 83ef0df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -49,7 +49,7 @@ protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) {
@Override
protected void decodePayload(byte[] pl) {
getCallback().receivedStatus(new OperationStatus(true,
new String(pl)));
String.valueOf(decodeLong(pl, 0))));
}

}
11 changes: 11 additions & 0 deletions src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java
Expand Up @@ -189,6 +189,17 @@ static long decodeUnsignedInt(byte[] data, int i) {
| (data[i+3] & 0xff);
}

static long decodeLong(byte[] data, int i) {
return(data[i ] & 0xff) << 56
| (data[i+1] & 0xff) << 48
| (data[i+2] & 0xff) << 40
| (data[i+3] & 0xff) << 32
| (data[i+4] & 0xff) << 24
| (data[i+5] & 0xff) << 16
| (data[i+6] & 0xff) << 8
| (data[i+7] & 0xff);
}

/**
* Prepare a send buffer.
*
Expand Down

0 comments on commit 83ef0df

Please sign in to comment.