btf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / io / Util.java
1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Matthew Khouzam - Initial API and implementation
10 ******************************************************************************/
11
12 package org.eclipse.linuxtools.ctf.core.tests.io;
13
14 import java.nio.ByteBuffer;
15
16 import org.eclipse.jdt.annotation.NonNull;
17
18 /**
19 * Helpers for the tests
20 *
21 * @author Matthew Khouzam
22 */
23 public final class Util {
24
25 private Util() {
26 }
27
28 /**
29 * Wrapper to make sure the bytebuffer is not null
30 *
31 * @param buffer
32 * a potentially null byte buffer
33 * @return a non-null byte buffer or an illegal state exception
34 */
35 @NonNull
36 public static ByteBuffer testMemory(ByteBuffer buffer) {
37 if (buffer == null) {
38 throw new IllegalStateException("Failed to alloc");
39 }
40 return buffer;
41 }
42 }
This page took 0.035089 seconds and 5 git commands to generate.