當前位置: 首頁>>代碼示例>>Java>>正文


Java FSDataOutputStream.writeInt方法代碼示例

本文整理匯總了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));
    }
  }
}
 
開發者ID:Tencent,項目名稱:angel,代碼行數:23,代碼來源:ServerPartition.java

示例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;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:IndexFile.java

示例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);
  }
}
 
開發者ID:Tencent,項目名稱:angel,代碼行數:15,代碼來源:DataSpliter.java

示例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);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:6,代碼來源:JobSplitWriter.java


注:本文中的org.apache.hadoop.fs.FSDataOutputStream.writeInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。