本文整理了Java中co.cask.cdap.api.common.Bytes.putByte()
方法的一些代码示例,展示了Bytes.putByte()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.putByte()
方法的具体详情如下:
包路径:co.cask.cdap.api.common.Bytes
类名称:Bytes
方法名:putByte
[英]Write a single byte out to the specified byte array position.
[中]将单个字节写入指定的字节数组位置。
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
private byte[] getMultipartKey(String... parts) {
int sizeOfParts = 0;
for (String part : parts) {
sizeOfParts += part.length();
}
byte[] result = new byte[1 + sizeOfParts + (parts.length * Bytes.SIZEOF_INT)];
Bytes.putByte(result, 0, Constants.ConfigStore.VERSION);
int offset = 1;
for (String part : parts) {
Bytes.putInt(result, offset, part.length());
offset += Bytes.SIZEOF_INT;
Bytes.putBytes(result, offset, part.getBytes(), 0, part.length());
offset += part.length();
}
return result;
}
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
/**
* Encodes the value for the state column with the current transaction and consumer information.
*
* @param state The state to encode
* @return The stateContent byte array
*/
// TODO: This method is copied from AbstractQueue2Consumer. Future effort is needed to unify them.
private byte[] encodeStateColumn(ConsumerEntryState state) {
byte[] stateContent = new byte[Longs.BYTES + Ints.BYTES + 1];
// State column content is encoded as (writePointer) + (instanceId) + (state)
Bytes.putLong(stateContent, 0, transaction.getWritePointer());
Bytes.putInt(stateContent, Longs.BYTES, consumerConfig.getInstanceId());
Bytes.putByte(stateContent, Longs.BYTES + Ints.BYTES, state.getState());
return stateContent;
}
代码示例来源:origin: cdapio/cdap
private byte[] getMultipartKey(String... parts) {
int sizeOfParts = 0;
for (String part : parts) {
sizeOfParts += part.length();
}
byte[] result = new byte[1 + sizeOfParts + (parts.length * Bytes.SIZEOF_INT)];
Bytes.putByte(result, 0, Constants.ConfigStore.VERSION);
int offset = 1;
for (String part : parts) {
Bytes.putInt(result, offset, part.length());
offset += Bytes.SIZEOF_INT;
Bytes.putBytes(result, offset, part.getBytes(), 0, part.length());
offset += part.length();
}
return result;
}
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
private byte[] encodeStateColumn(ConsumerEntryState state) {
// State column content is encoded as (writePointer) + (instanceId) + (state)
byte[] stateContent = new byte[Longs.BYTES + Ints.BYTES + 1];
Bytes.putLong(stateContent, 0, transaction.getWritePointer());
Bytes.putInt(stateContent, Longs.BYTES, getConfig().getInstanceId());
Bytes.putByte(stateContent, Longs.BYTES + Ints.BYTES, state.getState());
return stateContent;
}
代码示例来源:origin: cdapio/cdap
pos = Bytes.putShort(bytes, pos, (short) (rLength & 0x0000ffff));
pos = Bytes.putBytes(bytes, pos, row, rOffset, rLength);
pos = Bytes.putByte(bytes, pos, (byte) (fLength & 0x0000ff));
if (fLength != 0) {
pos = Bytes.putBytes(bytes, pos, family, fOffset, fLength);
return Bytes.putByte(bytes, pos, type.getCode());
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
pos = Bytes.putShort(bytes, pos, (short) (rlength & 0x0000ffff));
pos = Bytes.putBytes(bytes, pos, row, roffset, rlength);
pos = Bytes.putByte(bytes, pos, (byte) (flength & 0x0000ff));
if (flength != 0) {
pos = Bytes.putBytes(bytes, pos, family, foffset, flength);
pos = Bytes.putByte(bytes, pos, type.getCode());
if (value != null && value.length > 0) {
Bytes.putBytes(bytes, pos, value, voffset, vlength);
内容来源于网络,如有侵权,请联系作者删除!