本文整理了Java中net.openhft.chronicle.bytes.Bytes.start()
方法的一些代码示例,展示了Bytes.start()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.start()
方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:start
暂无
代码示例来源:origin: net.openhft/chronicle-bytes
/**
* @return is the readPosition at the start and the writeLimit at the end.
*/
@Override
default boolean isClear() {
return start() == readPosition() && writeLimit() == capacity();
}
代码示例来源:origin: net.openhft/chronicle-bytes
/**
* Creates a slice of the current Bytes based on its position() and limit(). As a sub-section
* of a Bytes it cannot be elastic.
*
* @return a slice of the existing Bytes where the start is moved to the position and the
* current limit determines the capacity.
* @throws IllegalStateException if the underlying BytesStore has been released
*/
@NotNull
@Override
default Bytes<Underlying> bytesForRead() throws IllegalStateException {
return isClear() ? BytesStore.super.bytesForRead() : new SubBytes<>(this, readPosition(), readLimit() + start());
}
代码示例来源:origin: net.openhft/chronicle-engine
@NotNull
private net.openhft.lang.io.Bytes toLangBytes(@NotNull BytesStore b, @NotNull Bytes tmpBytes, @NotNull net.openhft.lang.io.NativeBytes lb) {
if (b.isDirectMemory()) {
// check(b);
lb.setStartPositionAddress(b.address(b.start()), b.address(b.readLimit()));
// check(lb);
} else {
tmpBytes.clear();
tmpBytes.write(b);
lb.setStartPositionAddress(tmpBytes.address(tmpBytes.start()),
tmpBytes.address(tmpBytes.readLimit()));
}
return lb;
}
代码示例来源:origin: net.openhft/chronicle-bytes
/**
* Return a Bytes which is optionally unchecked. This allows bounds checks to be turned off.
* Note: this means that the result is no longer elastic, even if <code>this</code> is elastic.
*
* @param unchecked if true, minimal bounds checks will be performed.
* @return Bytes without bounds checking.
* @throws IllegalStateException if the underlying BytesStore has been released
*/
@NotNull
default Bytes<Underlying> unchecked(boolean unchecked) throws IllegalStateException {
if (unchecked) {
if (isElastic())
Jvm.debug().on(getClass(), "Wrapping elastic bytes with unchecked() will require calling ensureCapacity() as needed!");
return start() == 0 && bytesStore().isDirectMemory() ?
new UncheckedNativeBytes<>(this) :
new UncheckedBytes<>(this);
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!