List of usage examples for org.apache.hadoop.io Text writeString
public static int writeString(DataOutput out, String s) throws IOException
From source file:com.telefonica.iot.tidoop.apiext.hadoop.ckan.CKANInputSplit.java
License:Open Source License
@Override public void write(DataOutput out) { try {/*from w w w . ja va 2s . c o m*/ Text.writeString(out, resId); out.writeLong(firstRecordIndex); out.writeLong(length); } catch (Exception e) { logger.error("Unable to write CKANInputSplit fields when serializing. Details: " + e.getMessage()); } // catch }
From source file:com.toshiba.mwcloud.gs.hadoop.mapred.GSContainerSplit.java
License:Apache License
/** * <div lang="ja">//from www. java2 s .co m * {@inheritDoc} * @see Writable#write(DataOutput) * @throws IOException DataOutput???????????? * </div><div lang="en"> * {@inheritDoc} * @see Writable#write(DataOutput) * @throws IOException error occurred when writing to DataOutput object * </div> */ @Override public void write(final DataOutput out) throws IOException { out.writeInt(containerInfoLength_); for (int i = 0; i < containerInfoLength_; i++) { Text.writeString(out, partitionHost_[i]); out.writeInt(containerNameListLength_[i]); for (int j = 0; j < containerNameListLength_[i]; j++) { Text.writeString(out, containerNameList_[i][j]); } } }
From source file:com.twitter.elephanttwin.retrieval.IndexedFileSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeLong(first_start);/*from w ww . ja va 2 s.c o m*/ out.writeLong(total_bytes); Text.writeString(out, file.toString()); indexedBlocks.write(out); }
From source file:com.twitter.hraven.AppKey.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, this.cluster); Text.writeString(out, this.userName); Text.writeString(out, this.appId); }
From source file:com.twitter.hraven.etl.JobFile.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, filename); Text.writeString(out, jobid); out.writeBoolean(isJobConfFile);//from w w w .ja v a2s . co m out.writeBoolean(isJobHistoryFile); }
From source file:com.twitter.hraven.QualifiedJobId.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { super.write(out); Text.writeString(out, this.cluster); }
From source file:com.twitter.hraven.TaskKey.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { super.write(out); Text.writeString(out, this.taskId); }
From source file:com.willetinc.hadoop.mapreduce.dynamodb.AttributeValueIOUtils.java
License:Apache License
public static void write(Types type, AttributeValue value, DataOutput out) throws IOException { switch (type) { case STRING:/*w ww . jav a2 s . c om*/ Text.writeString(out, value.getS()); break; case NUMBER: Text.writeString(out, value.getN()); break; case BINARY: { WritableUtils.writeCompressedByteArray(out, value.getB().array()); break; } case STRING_SET: { List<String> values = value.getSS(); out.writeInt(values.size()); for (String s : values) { Text.writeString(out, s); } break; } case NUMBER_SET: { List<String> values = value.getNS(); out.writeInt(values.size()); for (String s : values) { Text.writeString(out, s); } break; } case BINARY_SET: { List<ByteBuffer> values = value.getBS(); out.writeInt(values.size()); for (ByteBuffer buf : values) { WritableUtils.writeCompressedByteArray(out, buf.array()); } } } }
From source file:com.xiaomi.linden.hadoop.indexing.keyvalueformat.Shard.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, dir); }
From source file:com.xiaomi.linden.hadoop.indexing.reduce.RAMDirectoryUtil.java
License:Apache License
/** * Write a number of files from a ram directory to a data output. * @param out the data output//www .j ava2s. co m * @param dir the ram directory * @throws IOException */ public static void writeRAMFiles(DataOutput out, RAMDirectory dir) throws IOException { String[] names = dir.listAll(); out.writeInt(names.length); for (int i = 0; i < names.length; i++) { Text.writeString(out, names[i]); long length = dir.fileLength(names[i]); out.writeLong(length); if (length > 0) { // can we avoid the extra copy? IndexInput input = null; try { IOContext context = new IOContext(); input = dir.openInput(names[i], context); int position = 0; byte[] buffer = new byte[BUFFER_SIZE]; while (position < length) { int len = position + BUFFER_SIZE <= length ? BUFFER_SIZE : (int) (length - position); input.readBytes(buffer, 0, len); out.write(buffer, 0, len); position += len; } } finally { if (input != null) { input.close(); } } } } }