Remove all existing @since annotations
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.core / src / org / eclipse / tracecompass / internal / lttng2 / control / core / relayd / lttngviewerCommands / ListSessionsResponse.java
CommitLineData
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
9bc60be7 14package org.eclipse.tracecompass.internal.lttng2.control.core.relayd.lttngviewerCommands;
8e15b929
MK
15
16import java.io.DataInputStream;
17import java.io.IOException;
18import java.nio.ByteBuffer;
19import java.nio.ByteOrder;
20import java.util.List;
21
22import com.google.common.collect.ImmutableList;
23import com.google.common.collect.ImmutableList.Builder;
24
25/**
26 * VIEWER_LIST_SESSIONS payload.
27 *
28 * @author Matthew Khouzam
8e15b929
MK
29 */
30public class ListSessionsResponse implements IRelayResponse {
31
32 /**
8adfbb73 33 * Response size (nbSessions)
8e15b929
MK
34 */
35 public static final int PACKET_FIXED_SIZE = Integer.SIZE / 8;
36
37 /** the list of sessions */
38 private final List<SessionResponse> fSessionList;
39
40 /**
41 * List Sessions response from network
42 *
43 * @param inNet
44 * the network stream
45 * @throws IOException
46 * network error
47 */
48 public ListSessionsResponse(DataInputStream inNet) throws IOException {
49 byte[] data = new byte[PACKET_FIXED_SIZE];
50 inNet.readFully(data);
51 ByteBuffer bb = ByteBuffer.wrap(data);
52 bb.order(ByteOrder.BIG_ENDIAN);
53 int nbSessions = bb.getInt();
54 Builder<SessionResponse> sl = new ImmutableList.Builder<>();
55 for (int session = 0; session < nbSessions; session++) {
56 sl.add(new SessionResponse(inNet));
57 }
58 fSessionList = sl.build();
59 }
60
61 /**
62 * Gets the session list
63 *
64 * @return the sessions list
65 */
66 public List<SessionResponse> getSessionsList() {
67 return fSessionList;
68 }
69
70
71}
This page took 0.041581 seconds and 5 git commands to generate.