本文整理汇总了Java中org.apache.hadoop.fs.FSDataOutputStream.writeInt方法的典型用法代码示例。如果您正苦于以下问题:Java FSDataOutputStream.writeInt方法的具体用法?Java FSDataOutputStream.writeInt怎么用?Java FSDataOutputStream.writeInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.FSDataOutputStream
的用法示例。
在下文中一共展示了FSDataOutputStream.writeInt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.apache.hadoop.fs.FSDataOutputStream; //导入方法依赖的package包/类
/**
* Save a matrix partition to file.
*
* @param output the output
* @param partitionMeta the meta
* @throws IOException the io exception
*/
public void save(DataOutputStream output , ModelPartitionMeta partitionMeta) throws IOException {
FSDataOutputStream dataOutputStream = new FSDataOutputStream(output, null,
partitionMeta != null ? partitionMeta.getOffset() : 0);
dataOutputStream.writeInt(rows.size());
long offset;
for (Map.Entry<Integer, ServerRow> entry : rows.entrySet()) {
offset = dataOutputStream.getPos();
dataOutputStream.writeInt(entry.getKey());
ServerRow row = entry.getValue();
row.writeTo(dataOutputStream);
if (partitionMeta != null) {
partitionMeta.setRowMeta(new RowOffset(entry.getKey(), offset));
}
}
}
示例2: writeIndex
import org.apache.hadoop.fs.FSDataOutputStream; //导入方法依赖的package包/类
static long writeIndex(final FSDataOutputStream o,
final List<byte []> keys, final List<Long> offsets,
final List<Integer> sizes)
throws IOException {
long pos = o.getPos();
// Don't write an index if nothing in the index.
if (keys.size() > 0) {
o.write(INDEXBLOCKMAGIC);
// Write the index.
for (int i = 0; i < keys.size(); ++i) {
o.writeLong(offsets.get(i).longValue());
o.writeInt(sizes.get(i).intValue());
byte [] key = keys.get(i);
Bytes.writeByteArray(o, key);
}
}
return pos;
}
示例3: serialize
import org.apache.hadoop.fs.FSDataOutputStream; //导入方法依赖的package包/类
/**
* write data splits to a output stream
*
* @param outputStream output stream
* @throws IOException
*/
public void serialize(FSDataOutputStream outputStream) throws IOException {
outputStream.writeInt(splitNum);
outputStream.writeInt(splitClassifications.size());
for (Entry<Integer, SplitClassification> entry : splitClassifications.entrySet()) {
outputStream.writeInt(entry.getKey());
entry.getValue().serialize(outputStream);
}
}
示例4: writeSplitHeader
import org.apache.hadoop.fs.FSDataOutputStream; //导入方法依赖的package包/类
private static void writeSplitHeader(FSDataOutputStream out)
throws IOException {
out.write(SPLIT_FILE_HEADER);
out.writeInt(splitVersion);
}