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 |
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.
|
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(long timeout,
TimeUnit timeUnit) |
void |
readMetaDataHeader() |
boolean |
startUse()
Used to check that the wire is being used by only one thread
|
long |
tryWriteHeader(int safeLength)
Makes a single attempt to try and write the header.
|
void |
updateFirstHeader()
update the first header after writing.
|
void |
updateHeader(long position,
boolean metaData)
Change the header from NOT_COMPLETE | UNKNOWN_LENGTH to metaData * META_DATA | length.
|
void |
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, readBytes, readBytes, readDocument, readMap, readText, readText
addPadding, dropDefault, endEvent, getValueOut, padToCacheAlign, startEvent, write, write, write, writeAlignTo, writeAllAsMap, writeComment, writeDocument, writeEvent, writeEventId, writeEventName, writeEventName, writeHeader, writeHeaderOfUnknownLength, writeNotCompleteDocument, 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(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 tryWriteHeader(int safeLength)
WireOut
tryWriteHeader
in interface WireOut
safeLength
- assume this safe lengthpublic void updateHeader(long position, boolean metaData) throws StreamCorruptedException, EOFException
WireOut
updateHeader
in interface WireOut
position
- returned by writeHeadermetaData
- whether the message is meta data or not.StreamCorruptedException
- if the steam has become corruptedEOFException
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 void 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 © 2018. All rights reserved.