1 /**********************************************************************
2 * Copyright (c) 2014 Ericsson
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
10 * Matthew Khouzam - Initial implementation and API
11 * Marc-Andre Laperle - Initial implementation and API
12 **********************************************************************/
14 package org
.eclipse
.linuxtools
.internal
.lttng2
.control
.core
.relayd
.lttngviewerCommands
;
16 import java
.nio
.ByteBuffer
;
17 import java
.nio
.ByteOrder
;
20 * VIEWER_GET_PACKET payload.
22 * @author Matthew Khouzam
25 public class GetPacket
implements IRelayCommand
{
30 public static final int SIZE
= (Long
.SIZE
+ Long
.SIZE
+ Integer
.SIZE
) / 8;
32 private final long fStreamId
;
34 private final long fOffset
;
35 /** the length of the packet */
36 private final int fLength
;
39 * Get packet constructor
48 public GetPacket(long streamId
, long offset
, int length
) {
55 * Get the length of the packet
57 * @return the length of the packet in bytes
59 public int getLength() {
64 * Gets the offset of the packet
68 public long getOffset() {
75 * @return the stream id
77 public long getStreamId() {
82 public byte[] serialize() {
83 byte data
[] = new byte[SIZE
];
84 ByteBuffer bb
= ByteBuffer
.wrap(data
);
85 bb
.order(ByteOrder
.BIG_ENDIAN
);
86 bb
.putLong(getStreamId());
87 bb
.putLong(getOffset());
88 bb
.putInt(getLength());
This page took 0.035811 seconds and 6 git commands to generate.