本文整理了Java中net.openhft.chronicle.bytes.Bytes.bytesStore()
方法的一些代码示例,展示了Bytes.bytesStore()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.bytesStore()
方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:bytesStore
暂无
代码示例来源:origin: net.openhft/chronicle-map
@Override
public RandomDataInput bytes() {
return bytes.bytesStore();
}
代码示例来源:origin: net.openhft/chronicle-map
@Override
public RandomDataInput bytes() {
return bytes.bytesStore();
}
代码示例来源:origin: net.openhft/chronicle-map
@Override
public RandomDataInput bytes() {
return bytes.bytesStore();
}
代码示例来源:origin: net.openhft/chronicle-bytes
/**
* @return the size which can be safely read. If this isElastic() it can be lower than the
* point it can safely write.
*/
@Override
default long safeLimit() {
return bytesStore().safeLimit();
}
代码示例来源:origin: net.openhft/chronicle-map
@Override
public RandomDataInput bytes() {
initBytes();
return bytes.bytesStore();
}
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
default boolean readWrite() {
return bytesStore().readWrite();
}
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
default boolean sharedMemory() {
return bytesStore().sharedMemory();
}
代码示例来源:origin: net.openhft/chronicle-map
@NotNull
@Override
public final T read(@NotNull Bytes in, long size, @Nullable T using) {
if (using == null)
using = createInstance();
using.bytesStore(in.bytesStore(), in.readPosition(), size);
return using;
}
}
代码示例来源:origin: net.openhft/chronicle-map
@Override
public RandomDataInput bytes() {
if (!bytesInit) {
bytes.clear();
sizedWriter.write(bytes, size, instance);
bytesInit = true;
}
return bytes.bytesStore();
}
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
public void ensureCapacity(long size) throws IllegalArgumentException {
if (size > realCapacity()) {
underlyingBytes.ensureCapacity(size);
bytesStore = (NativeBytesStore<Underlying>) underlyingBytes.bytesStore();
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
public void ensureCapacity(long size) throws IllegalArgumentException {
if (size > realCapacity()) {
underlyingBytes.ensureCapacity(size);
bytesStore = underlyingBytes.bytesStore();
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void parseUtf8(
@NotNull RandomDataInput input, long offset, Appendable appendable, int utflen)
throws UTFDataFormatRuntimeException, BufferUnderflowException {
if (appendable instanceof StringBuilder) {
if (input instanceof NativeBytesStore) {
parseUtf8_SB1((NativeBytesStore) input, offset, (StringBuilder) appendable, utflen);
return;
} else if (input instanceof Bytes
&& ((Bytes) input).bytesStore() instanceof NativeBytesStore) {
@org.jetbrains.annotations.Nullable NativeBytesStore bs = (NativeBytesStore) ((Bytes) input).bytesStore();
parseUtf8_SB1(bs, offset, (StringBuilder) appendable, utflen);
return;
}
}
parseUtf81(input, offset, appendable, utflen);
}
代码示例来源:origin: net.openhft/chronicle-bytes
public UncheckedBytes(@NotNull Bytes underlyingBytes) throws IllegalStateException {
super(underlyingBytes.bytesStore(), underlyingBytes.writePosition(), underlyingBytes.writeLimit());
this.underlyingBytes = underlyingBytes;
readPosition(underlyingBytes.readPosition());
}
代码示例来源:origin: net.openhft/chronicle-map
@NotNull
@Override
public T read(Bytes in, @Nullable T using) {
if (using != null && using.getClass() == nativeClass) {
((Byteable) using).bytesStore(in.bytesStore(), in.readPosition(),
nativeReference.maxSize());
return using;
}
if (using == null)
using = createInstance();
nativeReference.bytesStore(in.bytesStore(), in.readPosition(),
nativeReference.maxSize());
((Copyable) using).copyFrom(nativeReference);
return using;
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void parse8bit(@NotNull StreamingDataInput bytes, Appendable appendable, int utflen)
throws BufferUnderflowException, IOException {
if (appendable instanceof StringBuilder) {
@org.jetbrains.annotations.NotNull final StringBuilder sb = (StringBuilder) appendable;
if (bytes instanceof Bytes && ((Bytes) bytes).bytesStore() instanceof NativeBytesStore) {
parse8bit_SB1((Bytes) bytes, sb, utflen);
} else {
BytesInternal.parse8bit1(bytes, sb, utflen);
}
} else {
BytesInternal.parse8bit1(bytes, appendable, utflen);
}
}
代码示例来源:origin: net.openhft/chronicle-bytes
public static void parse8bit_SB1(@org.jetbrains.annotations.NotNull @NotNull Bytes bytes, @org.jetbrains.annotations.NotNull @NotNull StringBuilder sb, int utflen)
throws BufferUnderflowException {
if (utflen > bytes.readRemaining())
throw new BufferUnderflowException();
@Nullable NativeBytesStore nbs = (NativeBytesStore) bytes.bytesStore();
long offset = bytes.readPosition();
int count = BytesInternal.parse8bit_SB1(offset, nbs, sb, utflen);
bytes.readSkip(count);
}
代码示例来源:origin: net.openhft/chronicle-bytes
public UncheckedNativeBytes(@NotNull Bytes<Underlying> underlyingBytes)
throws IllegalStateException {
this.underlyingBytes = underlyingBytes;
this.bytesStore = (NativeBytesStore<Underlying>) underlyingBytes.bytesStore();
assert bytesStore.start() == 0;
writePosition = underlyingBytes.writePosition();
writeLimit = underlyingBytes.writeLimit();
readPosition = underlyingBytes.readPosition();
capacity = bytesStore.capacity();
}
代码示例来源: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;
}
代码示例来源:origin: net.openhft/chronicle-bytes
public void setBytes(@NotNull Bytes bytes) throws IllegalStateException {
BytesStore underlyingBytes = bytes.bytesStore();
if (bytesStore != underlyingBytes) {
bytesStore.release();
this.bytesStore = underlyingBytes;
bytesStore.reserve();
}
readPosition(bytes.readPosition());
this.uncheckedWritePosition(bytes.writePosition());
this.writeLimit = bytes.writeLimit();
assert !bytesStore.isDirectMemory() || BytesUtil.register(this);
this.underlyingBytes = bytes;
}
代码示例来源:origin: net.openhft/chronicle-bytes
@Override
public void readMarshallable(BytesIn bytes) throws IORuntimeException {
long position = bytes.readPosition();
long capacity = bytes.readLong();
long used = bytes.readLong();
if (capacity < 0 || capacity > bytes.readRemaining() >> 3)
throw new IORuntimeException("Corrupt used capacity");
if (used < 0 || used > capacity)
throw new IORuntimeException("Corrupt used value");
bytes.readSkip(capacity * 8);
long length = bytes.readPosition() - position;
bytesStore(((Bytes) bytes).bytesStore(), position, length);
}
内容来源于网络,如有侵权,请联系作者删除!