List of usage examples for org.apache.hadoop.io WritableUtils writeString
public static void writeString(DataOutput out, String s) throws IOException
From source file:org.apache.mahout.classifier.chi_rwcs.data.Dataset.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeInt(attributes.length); // nb attributes for (Attribute attr : attributes) { WritableUtils.writeString(out, attr.name()); }/*w w w. ja v a2 s. c om*/ Chi_RWCSUtils.writeArray(out, ignored); // only CATEGORICAL attributes have values for (String[] vals : values) { if (vals != null) { WritableUtils.writeStringArray(out, vals); } } // only NUMERICAL attributes have values for (double[] vals : nvalues) { if (vals != null) { DFUtils.writeArray(out, vals); } } for (double[] vals : minmaxvalues) { if (vals != null) { DFUtils.writeArray(out, vals); } } out.writeInt(labelId); out.writeInt(nbInstances); }
From source file:org.apache.mahout.classifier.KnnMR.data.Dataset.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeInt(attributes.length); // nb attributes for (Attribute attr : attributes) { WritableUtils.writeString(out, attr.name()); }// www.jav a 2 s .co m Chi_RWUtils.writeArray(out, ignored); // only CATEGORICAL attributes have values for (String[] vals : values) { if (vals != null) { WritableUtils.writeStringArray(out, vals); } } out.writeInt(labelId); out.writeInt(nbInstances); }
From source file:org.apache.mahout.classifier.mlp.NeuralNetwork.java
License:Apache License
/** * Write the fields of the model to output. * /* w ww.j av a2 s. co m*/ * @param output The output instance. * @throws IOException */ public void write(DataOutput output) throws IOException { // Write model type WritableUtils.writeString(output, modelType); // Write learning rate output.writeDouble(learningRate); // Write model path if (modelPath != null) { WritableUtils.writeString(output, modelPath); } else { WritableUtils.writeString(output, "null"); } // Write regularization weight output.writeDouble(regularizationWeight); // Write momentum weight output.writeDouble(momentumWeight); // Write cost function WritableUtils.writeString(output, costFunctionName); // Write layer size list output.writeInt(layerSizeList.size()); for (Integer aLayerSizeList : layerSizeList) { output.writeInt(aLayerSizeList); } WritableUtils.writeEnum(output, trainingMethod); // Write squashing functions output.writeInt(squashingFunctionList.size()); for (String aSquashingFunctionList : squashingFunctionList) { WritableUtils.writeString(output, aSquashingFunctionList); } // Write weight matrices output.writeInt(this.weightMatrixList.size()); for (Matrix aWeightMatrixList : weightMatrixList) { MatrixWritable.writeMatrix(output, aWeightMatrixList); } }
From source file:org.apache.mahout.df.data.Dataset.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeInt(attributes.length); // nb attributes for (Attribute attr : attributes) { WritableUtils.writeString(out, attr.name()); }/*from ww w.j av a 2 s .co m*/ WritableUtils.writeStringArray(out, labels); DFUtils.writeArray(out, ignored); // only CATEGORICAL attributes have values for (String[] vals : values) { if (vals != null) { WritableUtils.writeStringArray(out, vals); } } out.writeInt(labelId); out.writeInt(nbInstances); }
From source file:org.apache.nutch.searcher.QueryParams.java
License:Apache License
@Override public void write(DataOutput output) throws IOException { metadata.write(output);//from ww w . ja v a 2s . c o m WritableUtils.writeVInt(output, numHits); WritableUtils.writeVInt(output, maxHitsPerDup); WritableUtils.writeString(output, dedupField); WritableUtils.writeString(output, sortField); output.writeBoolean(reverse); }
From source file:org.apache.phoenix.expression.function.ToCharFunction.java
License:Apache License
@Override public void write(DataOutput output) throws IOException { super.write(output); WritableUtils.writeString(output, formatString); WritableUtils.writeEnum(output, type); }
From source file:org.apache.phoenix.expression.function.ToDateFunction.java
License:Apache License
@Override public void write(DataOutput output) throws IOException { super.write(output); WritableUtils.writeString(output, ""); // For b/w compat int nChildren = children.size(); // If dateFormat and/or timeZoneId are supplied as children, don't write them again, // except if using LOCAL, in which case we want to write the resolved/actual time zone. if (nChildren == 1) { WritableUtils.writeString(output, dateFormat); WritableUtils.writeString(output, timeZoneId); } else if (nChildren == 2 || DateUtil.LOCAL_TIME_ZONE_ID.equalsIgnoreCase(getTimeZoneIdArg())) { WritableUtils.writeString(output, timeZoneId); }/*from ww w .ja v a 2 s. co m*/ }
From source file:org.apache.phoenix.expression.function.UDFExpression.java
License:Apache License
@Override public void write(DataOutput output) throws IOException { super.write(output); WritableUtils.writeString(output, tenantId.getString()); WritableUtils.writeString(output, this.functionClassName); if (this.jarPath == null) { WritableUtils.writeString(output, ""); } else {//from w w w . ja va 2 s .c om WritableUtils.writeString(output, this.jarPath); } }
From source file:org.apache.phoenix.hive.mapreduce.PhoenixInputSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { super.write(out); Preconditions.checkNotNull(scans);/*from ww w. j a va2 s. c o m*/ WritableUtils.writeVInt(out, scans.size()); for (Scan scan : scans) { ClientProtos.Scan protoScan = ProtobufUtil.toScan(scan); byte[] protoScanBytes = protoScan.toByteArray(); WritableUtils.writeVInt(out, protoScanBytes.length); out.write(protoScanBytes); } WritableUtils.writeString(out, query); WritableUtils.writeVLong(out, regionSize); }
From source file:org.apache.phoenix.mapreduce.bulkload.CsvTableRowkeyPair.java
License:Apache License
@Override public void write(DataOutput output) throws IOException { WritableUtils.writeString(output, tableName); rowkey.write(output); }