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
;
20 import java
.util
.List
;
22 import com
.google
.common
.collect
.ImmutableList
;
23 import com
.google
.common
.collect
.ImmutableList
.Builder
;
26 * VIEWER_LIST_SESSIONS payload.
28 * @author Matthew Khouzam
31 public class ListSessionsResponse
implements IRelayResponse
{
36 public static final int PACKET_FIXED_SIZE
= Integer
.SIZE
/ 8;
38 /** the list of sessions */
39 private final List
<SessionResponse
> fSessionList
;
42 * List Sessions response from network
49 public ListSessionsResponse(DataInputStream inNet
) throws IOException
{
50 byte[] data
= new byte[PACKET_FIXED_SIZE
];
51 inNet
.readFully(data
);
52 ByteBuffer bb
= ByteBuffer
.wrap(data
);
53 bb
.order(ByteOrder
.BIG_ENDIAN
);
54 int nbSessions
= bb
.getInt();
55 Builder
<SessionResponse
> sl
= new ImmutableList
.Builder
<>();
56 for (int session
= 0; session
< nbSessions
; session
++) {
57 sl
.add(new SessionResponse(inNet
));
59 fSessionList
= sl
.build();
63 * Gets the session list
65 * @return the sessions list
67 public List
<SessionResponse
> getSessionsList() {
This page took 0.032544 seconds and 6 git commands to generate.