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 | ||
14 | package org.eclipse.linuxtools.internal.lttng2.control.core.relayd.lttngviewerCommands; | |
15 | ||
16 | import java.nio.ByteBuffer; | |
17 | import java.nio.ByteOrder; | |
18 | ||
19 | /** | |
20 | * VIEWER_GET_NEXT_INDEX payload. | |
21 | * | |
22 | * @author Matthew Khouzam | |
23 | * @since 3.0 | |
24 | */ | |
25 | public class GetNextIndex implements IRelayCommand { | |
26 | ||
27 | /** | |
8adfbb73 | 28 | * Command size (fStreamId) |
8e15b929 MK |
29 | */ |
30 | public static final int SIZE = Long.SIZE / 8; | |
31 | /** | |
32 | * the id of the stream | |
33 | */ | |
34 | private final long fStreamId; | |
35 | ||
36 | /** | |
37 | * Constructor | |
38 | * | |
39 | * @param streamId | |
40 | * the index stream id | |
41 | */ | |
42 | public GetNextIndex(long streamId) { | |
43 | fStreamId = streamId; | |
44 | } | |
45 | ||
46 | /** | |
47 | * Gets the stream id | |
48 | * | |
49 | * @return the stream id | |
50 | */ | |
51 | public long getStreamId() { | |
52 | return fStreamId; | |
53 | } | |
54 | ||
55 | @Override | |
56 | public byte[] serialize() { | |
57 | byte data[] = new byte[SIZE]; | |
58 | ByteBuffer bb = ByteBuffer.wrap(data); | |
59 | bb.order(ByteOrder.BIG_ENDIAN); | |
60 | bb.putLong(getStreamId()); | |
61 | return data; | |
62 | } | |
63 | ||
64 | } |