Commit | Line | Data |
---|---|---|
bad51909 GB |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 École Polytechnique de Montréal | |
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 | ||
10 | package org.eclipse.tracecompass.internal.provisional.statesystem.core.statevalue; | |
11 | ||
12 | /** | |
13 | * Interface for a safe ByteBuffer for writing purposes. This interface allows | |
14 | * only to write data from a buffer, no other operation is allowed on it. The | |
15 | * implementation needs to make sure that the buffer does not write over the | |
16 | * limits of the buffer. | |
17 | * | |
18 | * @author Geneviève Bastien | |
19 | */ | |
20 | public interface ISafeByteBufferWriter { | |
21 | ||
22 | /** | |
23 | * Writes a byte at the buffer's current position | |
24 | * | |
25 | * @param value | |
26 | * The byte to write | |
27 | */ | |
28 | void put(byte value); | |
29 | ||
30 | /** | |
31 | * Transfers the bytes from the src array in the buffer at the current | |
32 | * position | |
33 | * | |
34 | * @param src | |
35 | * the byte array to write | |
36 | */ | |
37 | void put(byte[] src); | |
38 | ||
39 | /** | |
40 | * Writes a char at the buffer's current position | |
41 | * | |
42 | * @param value | |
43 | * The char to write | |
44 | */ | |
45 | void putChar(char value); | |
46 | ||
47 | /** | |
48 | * Writes a double at the buffer's current position | |
49 | * | |
50 | * @param value | |
51 | * The double to write | |
52 | */ | |
53 | void putDouble(double value); | |
54 | ||
55 | /** | |
56 | * Writes a float at the buffer's current position | |
57 | * | |
58 | * @param value | |
59 | * The float to write | |
60 | */ | |
61 | void putFloat(float value); | |
62 | ||
63 | /** | |
64 | * Writes an int at the buffer's current position | |
65 | * | |
66 | * @param value | |
67 | * The int to write | |
68 | */ | |
69 | void putInt(int value); | |
70 | ||
71 | /** | |
72 | * Writes a long at the buffer's current position | |
73 | * | |
74 | * @param value | |
75 | * The long to write | |
76 | */ | |
77 | void putLong(long value); | |
78 | ||
79 | /** | |
80 | * Writes a short at the buffer's current position | |
81 | * | |
82 | * @param value | |
83 | * The short to write | |
84 | */ | |
85 | void putShort(short value); | |
86 | ||
87 | /** | |
88 | * Writes a string value in the byte buffer. The implementation can decide | |
89 | * what format it will use. They can also have a maximum size, in which case | |
90 | * string should be truncated if they are larger than that. | |
91 | * | |
92 | * @param value | |
93 | * The String value to write to the buffer | |
94 | */ | |
95 | void putString(String value); | |
96 | ||
97 | } |