blob: b5b5da2500606b795b0cfb00b73c13a0f83325d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jrt;
import java.nio.ByteBuffer;
class RequestPacket extends Packet
{
private StringValue methodName;
private Values parameters;
public RequestPacket(int flags, int reqId,
String methodName,
Values parameters)
{
super(flags, reqId);
this.methodName = new StringValue(methodName);
this.parameters = parameters;
}
public RequestPacket(int flags, int reqId,
ByteBuffer src)
{
super(flags, reqId);
methodName = new StringValue(src);
parameters = new Values(src);
}
public int bytes() {
return (headerLength +
methodName.bytes() +
parameters.bytes());
}
public int packetCode() {
return PCODE_REQUEST;
}
public void encode(ByteBuffer dst) {
methodName.encode(dst);
parameters.encode(dst);
}
public String methodName() {
return methodName.asString();
}
public Values parameters() {
return parameters;
}
}
|