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
.io
.DataInputStream
;
17 import java
.io
.IOException
;
18 import java
.nio
.ByteBuffer
;
19 import java
.nio
.ByteOrder
;
22 * Get response of viewer stream
24 * @author Matthew Khouzam
27 public class StreamResponse
implements IRelayResponse
{
32 * fId + fCtfTraceId + fMetadataFlag + fPathName + fChannelName
34 public static final int SIZE
= (Long
.SIZE
+ Long
.SIZE
+ Integer
.SIZE
) / 8 + LttngViewerCommands
.LTTNG_VIEWER_PATH_MAX
+ LttngViewerCommands
.LTTNG_VIEWER_NAME_MAX
;
39 private final long fId
;
41 * It is guaranteed to be unique, because the value is assigned sequentially
44 private final long fCtfTraceId
;
46 * if the stream is a metadata stream
48 private final int fMetadataFlag
;
52 private final String fPathName
;
54 * The channel, traditionally channel0
56 private final String fChannelName
;
66 public StreamResponse(DataInputStream inNet
) throws IOException
{
67 byte[] streamData
= new byte[SIZE
];
68 inNet
.readFully(streamData
, 0, SIZE
);
69 ByteBuffer bb
= ByteBuffer
.wrap(streamData
);
70 bb
.order(ByteOrder
.BIG_ENDIAN
);
72 fCtfTraceId
= bb
.getLong();
73 fMetadataFlag
= bb
.getInt();
74 byte pathName
[] = new byte[LttngViewerCommands
.LTTNG_VIEWER_PATH_MAX
];
75 byte channelName
[] = new byte[LttngViewerCommands
.LTTNG_VIEWER_NAME_MAX
];
76 bb
.get(pathName
, 0, LttngViewerCommands
.LTTNG_VIEWER_PATH_MAX
);
77 bb
.get(channelName
, 0, LttngViewerCommands
.LTTNG_VIEWER_NAME_MAX
);
78 fPathName
= new String(pathName
);
79 fChannelName
= new String(channelName
);
94 * @return the CtfTraceId
96 public long getCtfTraceId() {
101 * Get the metadata flag
103 * @return the MetadataFlag
105 public int getMetadataFlag() {
106 return fMetadataFlag
;
112 * @return the PathName
114 public String
getPathName() {
119 * get the Channel name
121 * @return the ChannelName
123 public String
getChannelName() {
This page took 0.034296 seconds and 5 git commands to generate.