aboutsummaryrefslogtreecommitdiffstats
path: root/jrt/src/com/yahoo/jrt/ReplyPacket.java
blob: 8d9d490c2849c72db0aa858faab3e69aa08090f1 (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
// Copyright Yahoo. 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 ReplyPacket extends Packet
{
    private Values returnValues;

    public ReplyPacket(int flags, int reqId,
                       Values returnValues)
    {
        super(flags, reqId);
        this.returnValues = returnValues;
    }

    public ReplyPacket(int flags, int reqId,
                       ByteBuffer src)
    {
        super(flags, reqId);
        returnValues = new Values(src);
    }

    public int bytes() {
        return (headerLength +
                returnValues.bytes());
    }

    public int packetCode() {
        return PCODE_REPLY;
    }

    public void encode(ByteBuffer dst) {
        returnValues.encode(dst);
    }

    public Values returnValues() {
        return returnValues;
    }
}