public abstract class AbstractWire extends Object implements Wire
WireIn.HeaderType
MarshallableOut.Padding
Modifier and Type | Field and Description |
---|---|
protected static boolean |
ASSERTIONS |
protected net.openhft.chronicle.bytes.Bytes<?> |
bytes |
protected net.openhft.chronicle.core.pool.ClassLookup |
classLookup |
protected Object |
parent |
protected boolean |
use8bit |
MARSHALLABLE_IN_INTERN_SIZE
DEFAULT_SAFE_LENGTH, TRY_WRITE_HEADER_FAILED
Constructor and Description |
---|
AbstractWire(net.openhft.chronicle.bytes.Bytes bytes,
boolean use8bit) |
Modifier and Type | Method and Description |
---|---|
net.openhft.chronicle.bytes.Bytes<?> |
bytes() |
net.openhft.chronicle.bytes.BytesComment<?> |
bytesComment() |
net.openhft.chronicle.core.pool.ClassLookup |
classLookup() |
void |
classLookup(net.openhft.chronicle.core.pool.ClassLookup classLookup)
Define how classes should be looked up.
|
void |
clear()
reset the state of the current wire for reuse.
|
boolean |
endUse()
Check the Wire was not used by another thread.
|
long |
enterHeader(int safeLength) |
void |
forceNotInsideHeader()
used by write bytes when doing a rollback
|
long |
headerNumber() |
Wire |
headerNumber(long headerNumber) |
void |
headNumberCheck(HeadNumberChecker headNumberChecker) |
boolean |
isInsideHeader() |
boolean |
notCompleteIsNotPresent()
If a message is marked as NOT_COMPLETE is it still present.
|
void |
notCompleteIsNotPresent(boolean notCompleteIsNotPresent) |
ObjectInput |
objectInput() |
ObjectOutput |
objectOutput() |
Object |
parent()
Obtain the parent class of this wire if there is one
|
void |
parent(Object parent)
Assign a parent object to this wire for later retrieval.
|
net.openhft.chronicle.threads.Pauser |
pauser() |
void |
pauser(net.openhft.chronicle.threads.Pauser pauser) |
void |
readAndSetLength(long position) |
WireIn.HeaderType |
readDataHeader(boolean includeMetaData) |
long |
readEventNumber() |
void |
readFirstHeader() |
void |
readFirstHeader(long timeout,
TimeUnit timeUnit) |
void |
readMetaDataHeader() |
boolean |
startUse()
Used to check that the wire is being used by only one thread
|
void |
updateFirstHeader()
update the first header after writing.
|
void |
updateHeader(long position,
boolean metaData,
int expectedHeader) |
boolean |
writeEndOfWire(long timeout,
TimeUnit timeUnit,
long lastPosition)
Write the end of wire marker, unless one is already written.
|
boolean |
writeFirstHeader()
Start the first header, if there is none This will increment the headerNumber as appropriate
if successful
|
long |
writeHeaderOfUnknownLength(int safeLength,
long timeout,
TimeUnit timeUnit,
net.openhft.chronicle.core.values.LongValue lastPosition,
Sequence sequence)
Write a message of unknown length, handling timeouts and the end of wire marker.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asText, consumePadding, copyTo, getValueIn, hasMore, isEmpty, isNotEmptyAfterPadding, rawReadData, read, read, read, read, readAlignTo, readAllAsMap, readComment, readDataHeader, readDocument, readDocument, readEvent, readEventName, readingDocument, readingDocument, readingPeekYaml
methodReader, methodReaderBuilder, peekDocument, readBytes, readBytes, readDocument, readMap, readText, readText
addPadding, dropDefault, getValueOut, padToCacheAlign, updateHeader, write, write, write, writeAlignTo, writeAllAsMap, writeComment, writeDocument, writeEndEvent, writeEvent, writeEventId, writeEventName, writeEventName, writeHeader, writeHeaderOfUnknownLength, writeNotCompleteDocument, writeStartEvent, writingDocument, writingDocument
newBooleanReference, newIntReference, newLongArrayReference, newLongReference, newTwoLongReference
methodWriter, methodWriter, methodWriterBuilder, padToCacheAlignMode, recordHistory, writeBytes, writeDocument, writeDocument, writeMap, writeMessage, writeText
protected static final boolean ASSERTIONS
@NotNull protected final net.openhft.chronicle.bytes.Bytes<?> bytes
protected final boolean use8bit
protected net.openhft.chronicle.core.pool.ClassLookup classLookup
protected Object parent
public AbstractWire(@NotNull net.openhft.chronicle.bytes.Bytes bytes, boolean use8bit)
public boolean isInsideHeader()
public net.openhft.chronicle.threads.Pauser pauser()
pauser
in interface WireCommon
public void pauser(net.openhft.chronicle.threads.Pauser pauser)
pauser
in interface WireCommon
pauser
- to use for blocking operations.public void clear()
WireCommon
@NotNull public Wire headerNumber(long headerNumber)
headerNumber
in interface Wire
headerNumber
in interface WireCommon
public void headNumberCheck(HeadNumberChecker headNumberChecker)
public long headerNumber()
headerNumber
in interface WireCommon
public void classLookup(net.openhft.chronicle.core.pool.ClassLookup classLookup)
WireCommon
classLookup
in interface WireCommon
classLookup
- to usepublic net.openhft.chronicle.core.pool.ClassLookup classLookup()
classLookup
in interface WireCommon
@NotNull public net.openhft.chronicle.bytes.Bytes<?> bytes()
bytes
in interface WireCommon
public net.openhft.chronicle.bytes.BytesComment<?> bytesComment()
bytesComment
in interface WireCommon
@NotNull public WireIn.HeaderType readDataHeader(boolean includeMetaData) throws EOFException
readDataHeader
in interface WireIn
EOFException
public void readAndSetLength(long position)
readAndSetLength
in interface WireIn
public void readMetaDataHeader()
readMetaDataHeader
in interface WireIn
public void readFirstHeader() throws StreamCorruptedException
readFirstHeader
in interface WireIn
StreamCorruptedException
public void readFirstHeader(long timeout, TimeUnit timeUnit) throws TimeoutException, StreamCorruptedException
readFirstHeader
in interface WireIn
TimeoutException
StreamCorruptedException
public long writeHeaderOfUnknownLength(int safeLength, long timeout, TimeUnit timeUnit, @Nullable net.openhft.chronicle.core.values.LongValue lastPosition, Sequence sequence) throws TimeoutException, EOFException
WireOut
writeHeaderOfUnknownLength
in interface WireOut
timeout
- throw a TimeoutException if the header could not be written in this
time.timeUnit
- of the timeOutlastPosition
- the last known positionTimeoutException
- the underlying pauser timed out.EOFException
- the end of wire marker was reached.public long enterHeader(int safeLength)
enterHeader
in interface WireOut
public void updateHeader(long position, boolean metaData, int expectedHeader) throws StreamCorruptedException
updateHeader
in interface WireOut
StreamCorruptedException
public boolean writeFirstHeader()
WireOut
Note: the file might contain other data and the caller has to check this.
writeFirstHeader
in interface WireOut
public void updateFirstHeader()
WireOut
updateFirstHeader
in interface WireOut
public boolean writeEndOfWire(long timeout, TimeUnit timeUnit, long lastPosition)
WireOut
writeEndOfWire
in interface WireOut
timeout
- throw TimeoutException if it could not write the marker in time.timeUnit
- of the timeoutlastPosition
- the end of the wirepublic Object parent()
WireCommon
parent
in interface WireCommon
public void parent(Object parent)
WireCommon
parent
in interface WireCommon
parent
- to set, or null if there isn't one.public boolean startUse()
WireCommon
startUse
in interface WireCommon
public boolean endUse()
WireCommon
endUse
in interface WireCommon
public boolean notCompleteIsNotPresent()
WireCommon
notCompleteIsNotPresent
in interface WireCommon
public void notCompleteIsNotPresent(boolean notCompleteIsNotPresent)
notCompleteIsNotPresent
in interface WireCommon
public ObjectOutput objectOutput()
objectOutput
in interface WireOut
public ObjectInput objectInput()
objectInput
in interface WireIn
public long readEventNumber()
readEventNumber
in interface WireIn
public void forceNotInsideHeader()
Copyright © 2019. All rights reserved.