54ee517b090d40287082fad59f562afacb33b8a1
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.core / src / org / eclipse / linuxtools / internal / lttng2 / control / core / relayd / lttngviewerCommands / GetMetadata.java
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_METADATA payload.
21 *
22 * @author Matthew Khouzam
23 * @since 3.0
24 */
25 public class GetMetadata implements IRelayCommand {
26
27 /**
28 * Command size (fStreamId)
29 */
30 public static final int SIZE = Long.SIZE / 8;
31
32 /**
33 * The stream id
34 */
35 private final long fStreamId;
36
37 /**
38 * Set the stream id
39 *
40 * @param streamId
41 * the stream id
42 */
43 public GetMetadata(long streamId) {
44 fStreamId = streamId;
45 }
46
47 /**
48 * Get the stream id
49 *
50 * @return the stream id
51 */
52 public long getStreamId() {
53 return fStreamId;
54 }
55
56 @Override
57 public byte[] serialize() {
58 byte data[] = new byte[SIZE];
59 ByteBuffer bb = ByteBuffer.wrap(data);
60 bb.order(ByteOrder.BIG_ENDIAN);
61 bb.putLong(getStreamId());
62 return data;
63 }
64
65 }
This page took 0.032713 seconds and 4 git commands to generate.