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 | ||
4c672322 | 10 | package org.eclipse.tracecompass.internal.provisional.datastore.core.serialization; |
bad51909 GB |
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 | |
4c672322 | 19 | * @noimplement This interface is not intended to be implemented by clients. |
bad51909 GB |
20 | */ |
21 | public interface ISafeByteBufferWriter { | |
22 | ||
23 | /** | |
24 | * Writes a byte at the buffer's current position | |
25 | * | |
26 | * @param value | |
27 | * The byte to write | |
28 | */ | |
29 | void put(byte value); | |
30 | ||
31 | /** | |
32 | * Transfers the bytes from the src array in the buffer at the current | |
33 | * position | |
34 | * | |
35 | * @param src | |
36 | * the byte array to write | |
37 | */ | |
38 | void put(byte[] src); | |
39 | ||
40 | /** | |
41 | * Writes a char at the buffer's current position | |
42 | * | |
43 | * @param value | |
44 | * The char to write | |
45 | */ | |
46 | void putChar(char value); | |
47 | ||
48 | /** | |
49 | * Writes a double at the buffer's current position | |
50 | * | |
51 | * @param value | |
52 | * The double to write | |
53 | */ | |
54 | void putDouble(double value); | |
55 | ||
56 | /** | |
57 | * Writes a float at the buffer's current position | |
58 | * | |
59 | * @param value | |
60 | * The float to write | |
61 | */ | |
62 | void putFloat(float value); | |
63 | ||
64 | /** | |
65 | * Writes an int at the buffer's current position | |
66 | * | |
67 | * @param value | |
68 | * The int to write | |
69 | */ | |
70 | void putInt(int value); | |
71 | ||
72 | /** | |
73 | * Writes a long at the buffer's current position | |
74 | * | |
75 | * @param value | |
76 | * The long to write | |
77 | */ | |
78 | void putLong(long value); | |
79 | ||
80 | /** | |
81 | * Writes a short at the buffer's current position | |
82 | * | |
83 | * @param value | |
84 | * The short to write | |
85 | */ | |
86 | void putShort(short value); | |
87 | ||
88 | /** | |
89 | * Writes a string value in the byte buffer. The implementation can decide | |
90 | * what format it will use. They can also have a maximum size, in which case | |
91 | * string should be truncated if they are larger than that. | |
92 | * | |
93 | * @param value | |
94 | * The String value to write to the buffer | |
95 | */ | |
96 | void putString(String value); | |
97 | ||
98 | } |