List of usage examples for org.apache.hadoop.io Text readString
public static String readString(DataInput in) throws IOException
From source file:org.apache.gora.util.IOUtils.java
License:Apache License
/** * Reads and returns a String array that is written by * {@link #writeStringArray(DataOutput, String[])}. * @param in the data input to read from * @return read String[]/*from ww w . j av a 2s . c o m*/ */ public static String[] readStringArray(DataInput in) throws IOException { int len = WritableUtils.readVInt(in); String[] arr = new String[len]; for (int i = 0; i < len; i++) { arr[i] = Text.readString(in); } return arr; }
From source file:org.apache.hama.bsp.BSPTask.java
License:Apache License
@Override public final void readFields(DataInput in) throws IOException { super.readFields(in); if (in.readBoolean()) { splitClass = Text.readString(in); if (split == null) { split = new BytesWritable(); }/* w ww .j a v a2 s .c om*/ split.readFields(in); } }
From source file:org.apache.hama.bsp.CombineFileSplit.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { totLength = in.readLong();/*from w w w . j a v a2 s. co m*/ int arrLength = in.readInt(); lengths = new long[arrLength]; for (int i = 0; i < arrLength; i++) { lengths[i] = in.readLong(); } int filesLength = in.readInt(); paths = new Path[filesLength]; for (int i = 0; i < filesLength; i++) { paths[i] = new Path(Text.readString(in)); } arrLength = in.readInt(); startoffset = new long[arrLength]; for (int i = 0; i < arrLength; i++) { startoffset[i] = in.readLong(); } }
From source file:org.apache.hama.bsp.Counters.java
License:Apache License
/** * Read a set of groups.//from w w w . j a v a2 s.co m */ @Override public synchronized void readFields(DataInput in) throws IOException { int numClasses = in.readInt(); counters.clear(); while (numClasses-- > 0) { String groupName = Text.readString(in); Group group = new Group(groupName); group.readFields(in); counters.put(groupName, group); } }
From source file:org.apache.hama.bsp.GroomServerStatus.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { this.groomName = Text.readString(in); this.rpcServer = Text.readString(in); this.hostName = Text.readString(in); this.failures = in.readInt(); this.maxTasks = in.readInt(); taskReports.clear();//from ww w . j a v a 2 s .com int numTasks = in.readInt(); TaskStatus status; for (int i = 0; i < numTasks; i++) { status = new TaskStatus(); status.readFields(in); taskReports.add(status); } }
From source file:org.apache.hama.bsp.JobProfile.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { jobid.readFields(in);//from w w w . j av a2 s.c o m this.jobFile = Text.readString(in); this.user = Text.readString(in); this.name = Text.readString(in); }
From source file:org.apache.hama.bsp.JobStatus.java
License:Apache License
@Override public synchronized void readFields(DataInput in) throws IOException { this.jobid = new BSPJobID(); jobid.readFields(in);//from w w w . j ava2 s.co m this.setupProgress = in.readLong(); this.progress = in.readLong(); this.cleanupProgress = in.readLong(); this.runState = in.readInt(); this.startTime = in.readLong(); this.finishTime = in.readLong(); this.user = Text.readString(in); this.schedulingInfo = Text.readString(in); this.superstepCount = in.readLong(); counter = new Counters(); counter.readFields(in); }
From source file:org.apache.hama.bsp.join.CompositeInputSplit.java
License:Apache License
/** * {@inheritDoc}//from w ww. j a v a2 s .c o m * * @throws IOException If the child InputSplit cannot be read, typically for * faliing access checks. */ @SuppressWarnings("unchecked") // Generic array assignment public void readFields(DataInput in) throws IOException { int card = WritableUtils.readVInt(in); if (splits == null || splits.length != card) { splits = new InputSplit[card]; } Class<? extends InputSplit>[] cls = new Class[card]; try { for (int i = 0; i < card; ++i) { cls[i] = Class.forName(Text.readString(in)).asSubclass(InputSplit.class); } for (int i = 0; i < card; ++i) { splits[i] = ReflectionUtils.newInstance(cls[i], null); splits[i].readFields(in); } } catch (ClassNotFoundException e) { throw (IOException) new IOException("Failed split init").initCause(e); } }
From source file:org.apache.hama.bsp.join.TupleWritable.java
License:Apache License
/** * {@inheritDoc}/*from w ww . ja v a 2 s . c om*/ */ @SuppressWarnings("unchecked") // No static typeinfo on Tuples public void readFields(DataInput in) throws IOException { int card = WritableUtils.readVInt(in); values = new Writable[card]; written = WritableUtils.readVLong(in); Class<? extends Writable>[] cls = new Class[card]; try { for (int i = 0; i < card; ++i) { cls[i] = Class.forName(Text.readString(in)).asSubclass(Writable.class); } for (int i = 0; i < card; ++i) { values[i] = cls[i].newInstance(); if (has(i)) { values[i].readFields(in); } } } catch (ClassNotFoundException e) { throw (IOException) new IOException("Failed tuple init").initCause(e); } catch (IllegalAccessException e) { throw (IOException) new IOException("Failed tuple init").initCause(e); } catch (InstantiationException e) { throw (IOException) new IOException("Failed tuple init").initCause(e); } }
From source file:org.apache.hama.bsp.Task.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { jobId.readFields(in);// www.j a v a 2 s. c o m jobFile = Text.readString(in); taskId.readFields(in); partition = in.readInt(); }