本文整理匯總了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);
}