本文整理汇总了Java中org.apache.flink.core.memory.DataOutputView.write方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutputView.write方法的具体用法?Java DataOutputView.write怎么用?Java DataOutputView.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.core.memory.DataOutputView
的用法示例。
在下文中一共展示了DataOutputView.write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeCondition
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
private void serializeCondition(IterativeCondition<T> condition, DataOutputView out) throws IOException {
out.writeBoolean(condition != null);
if (condition != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(condition);
oos.close();
baos.close();
byte[] serCondition = baos.toByteArray();
out.writeInt(serCondition.length);
out.write(serCondition);
}
}
示例2: run
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void run() {
try {
for (int n = 0; n < NUM_ITERATIONS; n++) {
DataOutputView writeEnd = backChannel.getWriteEnd();
readInputFromDataChannel();
Thread.sleep(random.nextInt(10));
DataInputView inputView = Mockito.mock(DataInputView.class);
actionLog.add("tail writes in iteration " + n);
writeEnd.write(inputView, 1);
backChannel.notifyOfEndOfSuperstep();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
super.write(out);
if (typeSerializer instanceof UnloadableDummyTypeSerializer) {
UnloadableDummyTypeSerializer<T> dummyTypeSerializer =
(UnloadableDummyTypeSerializer<T>) this.typeSerializer;
byte[] serializerBytes = dummyTypeSerializer.getActualBytes();
out.write(serializerBytes.length);
out.write(serializerBytes);
} else {
// write in a way that allows the stream to recover from exceptions
try (ByteArrayOutputStreamWithPos streamWithPos = new ByteArrayOutputStreamWithPos()) {
InstantiationUtil.serializeObject(streamWithPos, typeSerializer);
out.writeInt(streamWithPos.getPosition());
out.write(streamWithPos.getBuf(), 0, streamWithPos.getPosition());
}
}
}
示例4: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(final DataOutputView out) throws IOException {
int len = this.len;
// write the length, variable-length encoded
while (len >= HIGH_BIT) {
out.write(len | HIGH_BIT);
len >>>= 7;
}
out.write(len);
// write the char data, variable length encoded
for (int i = 0; i < this.len; i++) {
int c = this.value[i];
while (c >= HIGH_BIT) {
out.write(c | HIGH_BIT);
c >>>= 7;
}
out.write(c);
}
}
示例5: copy
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
int val = source.readUnsignedByte();
target.writeByte(val);
if (val >= MAX_BIT) {
int shift = 7;
int curr;
val = val & 0x7f;
while ((curr = source.readUnsignedByte()) >= MAX_BIT) {
target.writeByte(curr);
val |= (curr & 0x7f) << shift;
shift += 7;
}
target.writeByte(curr);
val |= curr << shift;
}
target.write(source, val);
}
示例6: copyInternal
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
protected static void copyInternal(DataInputView source, DataOutputView target) throws IOException {
int count = source.readInt();
target.writeInt(count);
int bytes = ELEMENT_LENGTH_IN_BYTES * count;
target.write(source, bytes);
}
示例7: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
out.writeInt(val);
out.writeBoolean(isLong);
if (isLong) {
out.write(BUFFER);
}
}
示例8: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
out.write(bytes);
}
示例9: copy
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
target.write(source, 1);
}
示例10: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
byte[] bytes = new byte[32941];
out.write(bytes);
}
示例11: copy
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
int size = source.readInt();
target.writeInt(size);
target.write(source, size);
}
示例12: copy
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
target.write(source, 8);
}
示例13: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
out.writeInt(this.data.length);
out.write(this.data);
}
示例14: copy
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
final int len = source.readInt();
target.writeInt(len);
target.write(source, len * 4);
}
示例15: copy
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
final int len = source.readInt();
target.writeInt(len);
target.write(source, len * 8);
}