net.openhft.chronicle.bytes.Bytes.writeByte()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中net.openhft.chronicle.bytes.Bytes.writeByte()方法的一些代码示例,展示了Bytes.writeByte()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.writeByte()方法的具体详情如下:
包路径:net.openhft.chronicle.bytes.Bytes
类名称:Bytes
方法名:writeByte

Bytes.writeByte介绍

暂无

代码示例

代码示例来源:origin: OpenHFT/Chronicle-Queue

private void doRollback(boolean interrupted) {
  if (interrupted)
    LOG.warn("Thread is interrupted. Can't guarantee complete message, so not committing");
  // zero out all contents...
  for (long i = position; i <= wire.bytes().writePosition(); i++)
    wire.bytes().writeByte(i, (byte) 0);
  position = lastPosition;
  wire.bytes().writePosition(position);
  ((AbstractWire) wire).forceNotInsideHeader();
}

代码示例来源:origin: net.openhft/chronicle-map

@Override
public void write(Bytes out, @NotNull Boolean toWrite) {
  out.writeByte((byte) (toWrite ? 'Y' : 0));
}

代码示例来源:origin: net.openhft/chronicle-bytes

public static void setCharAt(@NotNull Appendable sb, int index, char ch)
    throws IllegalArgumentException, BufferOverflowException {
  if (sb instanceof StringBuilder)
    ((StringBuilder) sb).setCharAt(index, ch);
  else if (sb instanceof Bytes)
    ((Bytes) sb).writeByte(index, ch);
  else
    throw new IllegalArgumentException("" + sb.getClass());
}

代码示例来源:origin: net.openhft/chronicle-bytes

default void read(@NotNull Bytes bytes, int length) {
  int len2 = (int) Math.min(length, readRemaining());
  for (int i = 0; i < len2; i++)
    bytes.writeByte(readByte());
}

代码示例来源:origin: net.openhft/chronicle-map

private void writePayload(Bytes payload, Bytes destination) {
  destination.writeByte(BOOTSTRAP_TIME_HUNK);
  destination.write(payload, payload.readPosition(), payload.readRemaining());
}

代码示例来源:origin: com.wavefront/proxy

@Override
 public void write(Bytes out, @NotNull HistogramKey toWrite) {
  int accumulatorKeySize = 5;
  out.writeByte(toWrite.granularityOrdinal);
  out.writeInt(toWrite.binId);
  accumulatorKeySize += 2 + toWrite.metric.length();
  writeString(out, toWrite.metric);
  accumulatorKeySize += 2 + (toWrite.source == null ? 0 : toWrite.source.length());
  writeString(out, toWrite.source);
  short numTags = toWrite.tags == null ? 0 : (short) toWrite.tags.length;
  accumulatorKeySize += 2;
  out.writeShort(numTags);
  for (short i = 0; i < numTags; ++i) {
   accumulatorKeySize += 2 + (toWrite.tags[i] == null ? 0 : toWrite.tags[i].length());
   writeString(out, toWrite.tags[i]);
  }
  accumulatorKeySizes.update(accumulatorKeySize);
 }
}

代码示例来源:origin: wavefrontHQ/java

@Override
 public void write(Bytes out, @NotNull HistogramKey toWrite) {
  int accumulatorKeySize = 5;
  out.writeByte(toWrite.granularityOrdinal);
  out.writeInt(toWrite.binId);
  accumulatorKeySize += 2 + toWrite.metric.length();
  writeString(out, toWrite.metric);
  accumulatorKeySize += 2 + (toWrite.source == null ? 0 : toWrite.source.length());
  writeString(out, toWrite.source);
  short numTags = toWrite.tags == null ? 0 : (short) toWrite.tags.length;
  accumulatorKeySize += 2;
  out.writeShort(numTags);
  for (short i = 0; i < numTags; ++i) {
   accumulatorKeySize += 2 + (toWrite.tags[i] == null ? 0 : toWrite.tags[i].length());
   writeString(out, toWrite.tags[i]);
  }
  accumulatorKeySizes.update(accumulatorKeySize);
 }
}

代码示例来源:origin: net.openhft/chronicle-map

void updateReplicationState(byte identifier, long timestamp) {
  initDelayedUpdateChecksum(true);
  Bytes segmentBytes = s.segmentBytesForWrite();
  segmentBytes.writePosition(replicationBytesOffset);
  segmentBytes.writeLong(timestamp);
  segmentBytes.writeByte(identifier);
}

代码示例来源:origin: net.openhft/chronicle-queue

private void doRollback(boolean interrupted) {
  if (interrupted)
    LOG.warn("Thread is interrupted. Can't guarantee complete message, so not committing");
  // zero out all contents...
  for (long i = position; i <= wire.bytes().writePosition(); i++)
    wire.bytes().writeByte(i, (byte) 0);
  position = lastPosition;
  wire.bytes().writePosition(position);
  ((AbstractWire) wire).forceNotInsideHeader();
}

代码示例来源:origin: net.openhft/chronicle-map

void updateReplicationState(byte identifier, long timestamp) {
  initDelayedUpdateChecksum(true);
  Bytes segmentBytes = this.segmentBytesForWriteGuarded();
  segmentBytes.writePosition(replicationBytesOffset());
  segmentBytes.writeLong(timestamp);
  segmentBytes.writeByte(identifier);
}

代码示例来源:origin: net.openhft/chronicle-map

void updateReplicationState(byte identifier, long timestamp) {
  initDelayedUpdateChecksum(true);
  Bytes segmentBytes = this.segmentBytesForWriteGuarded();
  segmentBytes.writePosition(replicationBytesOffset());
  segmentBytes.writeLong(timestamp);
  segmentBytes.writeByte(identifier);
}

代码示例来源:origin: net.openhft/chronicle-bytes

default void readWithLength(Bytes bytes) {
  bytes.clear();
  int length = Maths.toUInt31(readStopBit());
  int i;
  for (i = 0; i < length - 7; i++)
    bytes.writeLong(readLong());
  for (; i < length; i++)
    bytes.writeByte(readByte());
}

代码示例来源:origin: net.openhft/chronicle-bytes

@org.jetbrains.annotations.NotNull
public static Bytes fromHexString(@org.jetbrains.annotations.NotNull String s) {
  try {
    Bytes in = Bytes.from(s);
    Bytes out = Bytes.elasticByteBuffer();
    OUTER:
    while (in.readRemaining() > 0) {
      in.parseHexLong();
      for (int i = 0; i < 16; i++) {
        if (in.peekUnsignedByte() == ' ') {
          in.readSkip(1);
          if (in.peekUnsignedByte() == ' ')
            break OUTER;
        }
        long value = in.parseHexLong();
        out.writeByte((byte) value);
      }
      if (in.readByte(in.readPosition() - 1) <= ' ')
        in.readSkip(-1);
      in.skipTo(StopCharTesters.CONTROL_STOP);
    }
    return out;
  } catch (BufferUnderflowException | BufferOverflowException e) {
    throw new AssertionError(e);
  }
}

代码示例来源:origin: net.openhft/chronicle-map

destination.writeByte(ENTRY_HUNK);
destination.writeByte(entry.originIdentifier());

相关文章

微信公众号

最新文章

更多