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.ikanow.aleph2.analytics.hadoop.assets.Aleph2MultiInputSplit.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from w ww .j av a 2s .c om public void write(DataOutput out) throws IOException { Text.writeString(out, _name); Text.writeString(out, _input_split.getName()); Text.writeString(out, _input_format.getName()); Text.writeString(out, _mapper.getName()); final SerializationFactory factory = new SerializationFactory(_conf); final Serializer serializer = factory.getSerializer(_input_split); serializer.open((DataOutputStream) out); serializer.serialize(_delegate); }
From source file:com.linkedin.cubert.io.MultiMapperSplit.java
License:Open Source License
@Override public void write(DataOutput out) throws IOException { out.writeInt(multiMapperIndex);/*from www. ja va 2 s . co m*/ if (actualSplit instanceof FileSplit) { out.writeBoolean(true); FileSplit fileSplit = (FileSplit) actualSplit; Text.writeString(out, fileSplit.getPath().toString()); out.writeLong(fileSplit.getStart()); out.writeLong(fileSplit.getLength()); } else if (actualSplit instanceof Writable) { out.writeBoolean(false); Text.writeString(out, actualSplit.getClass().getName()); ((Writable) actualSplit).write(out); } else { throw new IOException("Input Split class " + actualSplit.getClass() + " cannot be serialized"); } }
From source file:com.marklogic.contentpump.CombineDocumentSplit.java
License:Apache License
public void write(DataOutput out) throws IOException { // splits/*w ww . j a va 2 s . c o m*/ out.writeInt(splits.size()); for (FileSplit split : splits) { Text.writeString(out, split.getPath().toString()); out.writeLong(split.getStart()); out.writeLong(split.getLength()); } // length out.writeLong(length); // locations: not needed for serialization. See FileSplit.write(). }
From source file:com.marklogic.contentpump.ContentWithFileNameWritable.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, fileName); out.writeByte(type);//ww w . j a v a 2s . com if (value instanceof Text) { ((Text) value).write(out); } else if (value instanceof MarkLogicNode) { ((MarkLogicNode) value).write(out); } else if (value instanceof BytesWritable) { ((BytesWritable) value).write(out); } }
From source file:com.marklogic.mapreduce.DocumentURI.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, uri); }
From source file:com.marklogic.mapreduce.DocumentURIWithSourceInfo.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, uri); Text.writeString(out, srcId); Text.writeString(out, subId); out.writeInt(lineNumber);//from w w w .j av a 2s. c om out.writeInt(colNumber); Text.writeString(out, skipReason); }
From source file:com.marklogic.mapreduce.LargeBinaryDocument.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { super.write(out); Text.writeString(out, path.toString()); out.writeLong(offset);/* w ww . j av a 2 s .c om*/ out.writeLong(size); out.writeLong(binaryOrigLen); conf.write(out); }
From source file:com.marklogic.mapreduce.MarkLogicInputSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeLong(start);/*from www .ja v a 2 s . com*/ out.writeLong(length); Text forestIdText = new Text(forestId.toByteArray()); forestIdText.write(out); if (hostName != null && hostName.length > 0) { Text.writeString(out, hostName[0]); } out.writeBoolean(isLastSplit); }
From source file:com.marklogic.mapreduce.MarkLogicNode.java
License:Apache License
public void write(DataOutput out) throws IOException { if (node != null) { int type = node.getNodeType(); out.writeInt(type);/*w w w . ja v a 2s . c o m*/ if (type == Node.ATTRIBUTE_NODE) { Text.writeString(out, node.getNodeName()); Text.writeString(out, node.getNodeValue()); } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { DomUtil.writeXml(node, baos); Text.writeString(out, baos.toString()); } catch (TransformerException e) { LOG.error("error transforming node", e); throw new IOException(e); } } } else { LOG.error("Node to write is null."); } }
From source file:com.marklogic.mapreduce.NodePath.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, docUri); Text.writeString(out, path); }