-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathWire.java
More file actions
54 lines (49 loc) · 1.78 KB
/
Copy pathWire.java
File metadata and controls
54 lines (49 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright 2013-2025 chronicle.software; SPDX-License-Identifier: Apache-2.0
*/
package net.openhft.chronicle.wire;
import net.openhft.chronicle.core.annotation.DontChain;
import net.openhft.chronicle.core.annotation.SingleThreaded;
import org.jetbrains.annotations.NotNull;
/**
* Defines the standard interface for sequentially writing to and reading from a Bytes stream.
* Implementations of this interface should ensure single-threaded access and avoid method chaining.
*
* <p>This interface combines the capabilities of both {@link WireIn} and {@link WireOut} interfaces.
*/
@SingleThreaded
@DontChain
public interface Wire extends WireIn, WireOut {
/**
* Factory method to create a new YamlWire instance that writes to an on-heap Bytes object.
*
* @return A YamlWire instance configured to write to an on-heap Bytes object.
*/
static Wire newYamlWireOnHeap() {
return new YamlWire();
}
/**
* Set the header number for the Wire. Concrete implementations should ensure they provide the expected behavior for this method.
*
* @param headerNumber The header number to be set.
* @return The current Wire instance, often for method chaining.
*/
@Override
@NotNull
Wire headerNumber(long headerNumber);
/**
* Indicates whether tuples should be generated.
* By default, this method returns the value of Wires.GENERATE_TUPLES
* @return true if tuples should be generated, false otherwise.
*/
default boolean generateTuples() {
return Wires.GENERATE_TUPLES;
}
/**
* Sets whether tuples should be generated.
* @param generateTuples true to enable tuple generation, false to disable it.
*/
default Wire generateTuples(boolean generateTuples) {
return this;
}
}