Commit | Line | Data |
---|---|---|
8e15b929 MK |
1 | /********************************************************************** |
2 | * Copyright (c) 2014 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial implementation and API | |
11 | * Marc-Andre Laperle - Initial implementation and API | |
12 | **********************************************************************/ | |
13 | ||
9bc60be7 | 14 | package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands; |
8e15b929 MK |
15 | |
16 | import java.nio.ByteBuffer; | |
17 | import java.nio.ByteOrder; | |
18 | ||
19 | /** | |
20 | * VIEWER_GET_NEXT_INDEX payload. | |
21 | * | |
22 | * @author Matthew Khouzam | |
8e15b929 MK |
23 | */ |
24 | public class GetNextIndex implements IRelayCommand { | |
25 | ||
26 | /** | |
8adfbb73 | 27 | * Command size (fStreamId) |
8e15b929 MK |
28 | */ |
29 | public static final int SIZE = Long.SIZE / 8; | |
30 | /** | |
31 | * the id of the stream | |
32 | */ | |
33 | private final long fStreamId; | |
34 | ||
35 | /** | |
36 | * Constructor | |
37 | * | |
38 | * @param streamId | |
39 | * the index stream id | |
40 | */ | |
41 | public GetNextIndex(long streamId) { | |
42 | fStreamId = streamId; | |
43 | } | |
44 | ||
45 | /** | |
46 | * Gets the stream id | |
47 | * | |
48 | * @return the stream id | |
49 | */ | |
50 | public long getStreamId() { | |
51 | return fStreamId; | |
52 | } | |
53 | ||
54 | @Override | |
55 | public byte[] serialize() { | |
56 | byte data[] = new byte[SIZE]; | |
57 | ByteBuffer bb = ByteBuffer.wrap(data); | |
58 | bb.order(ByteOrder.BIG_ENDIAN); | |
59 | bb.putLong(getStreamId()); | |
60 | return data; | |
61 | } | |
62 | ||
63 | } |