List of usage examples for org.apache.hadoop.io WritableUtils readStringArray
public static String[] readStringArray(DataInput in) throws IOException
From source file:org.apache.mahout.classifier.KnnMR.data.Dataset.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { int nbAttributes = in.readInt(); attributes = new Attribute[nbAttributes]; for (int attr = 0; attr < nbAttributes; attr++) { String name = WritableUtils.readString(in); attributes[attr] = Attribute.valueOf(name); }/* w w w . j a v a2 s . c om*/ ignored = Chi_RWUtils.readIntArray(in); // only CATEGORICAL attributes have values values = new String[nbAttributes][]; for (int attr = 0; attr < nbAttributes; attr++) { if (attributes[attr].isCategorical()) { values[attr] = WritableUtils.readStringArray(in); } } labelId = in.readInt(); nbInstances = in.readInt(); }
From source file:org.apache.mahout.df.data.Dataset.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { int nbAttributes = in.readInt(); attributes = new Attribute[nbAttributes]; for (int attr = 0; attr < nbAttributes; attr++) { String name = WritableUtils.readString(in); attributes[attr] = Attribute.valueOf(name); }/* w w w . ja v a2 s . c o m*/ labels = WritableUtils.readStringArray(in); ignored = DFUtils.readIntArray(in); // only CATEGORICAL attributes have values values = new String[nbAttributes][]; for (int attr = 0; attr < nbAttributes; attr++) { if (attributes[attr].isCategorical()) { values[attr] = WritableUtils.readStringArray(in); } } labelId = in.readInt(); nbInstances = in.readInt(); }
From source file:org.apache.nutch.parse.ParseStatus.java
License:Apache License
public void readFields(DataInput in) throws IOException { byte version = in.readByte(); switch (version) { case 1://from ww w .j a v a2 s . co m majorCode = in.readByte(); minorCode = in.readShort(); args = WritableUtils.readCompressedStringArray(in); break; case 2: majorCode = in.readByte(); minorCode = in.readShort(); args = WritableUtils.readStringArray(in); break; default: throw new VersionMismatchException(VERSION, version); } }