172ca30a5b1dcc5993d0ab6f70373a8f43a227f8
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 * fStreamId + fOffset + fLength
32 public static final int SIZE
= (Long
.SIZE
+ Long
.SIZE
+ Integer
.SIZE
) / 8;
34 private final long fStreamId
;
36 private final long fOffset
;
37 /** the length of the packet */
38 private final int fLength
;
41 * Get packet constructor
50 public GetPacket(long streamId
, long offset
, int length
) {
57 * Get the length of the packet
59 * @return the length of the packet in bytes
61 public int getLength() {
66 * Gets the offset of the packet
70 public long getOffset() {
77 * @return the stream id
79 public long getStreamId() {
84 public byte[] serialize() {
85 byte data
[] = new byte[SIZE
];
86 ByteBuffer bb
= ByteBuffer
.wrap(data
);
87 bb
.order(ByteOrder
.BIG_ENDIAN
);
88 bb
.putLong(getStreamId());
89 bb
.putLong(getOffset());
90 bb
.putInt(getLength());
This page took 0.035799 seconds and 4 git commands to generate.