List of usage examples for org.apache.hadoop.io Text readString
public static String readString(DataInput in) throws IOException
From source file:com.chinamobile.bcbsp.sync.SuperStepReportContainer.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { this.partitionId = in.readInt(); this.stageFlag = in.readInt(); int count = in.readInt(); this.dirFlag = new String[count]; for (int i = 0; i < count; i++) { this.dirFlag[i] = Text.readString(in); }/*ww w. jav a 2s.com*/ this.judgeFlag = in.readLong(); this.localBarrierNum = in.readInt(); this.port1 = in.readInt(); this.port2 = in.readInt(); count = in.readInt(); this.aggValues = new String[count]; for (int i = 0; i < count; i++) { this.aggValues[i] = Text.readString(in); } this.staffRunTime = in.readLong(); this.sid = in.readInt(); this.currentSuperStep = in.readInt(); this.migrateCost = in.readLong(); this.splitEdgefactor = in.readFloat(); }
From source file:com.chinamobile.bcbsp.util.JobProfile.java
License:Apache License
/** * deserialize//from w ww . j a v a2 s . co m * * @param in Reads some bytes from an input. */ @Override public void readFields(DataInput in) throws IOException { jobid.readFields(in); this.jobFile = Text.readString(in); this.user = Text.readString(in); this.name = Text.readString(in); }
From source file:com.chinamobile.bcbsp.util.JobStatus.java
License:Apache License
/** * deserialize/* w w w . j a va 2 s. c o m*/ * * @param in Reads some bytes from an input. */ @Override public synchronized void readFields(DataInput in) throws IOException { this.jobid = new BSPJobID(); jobid.readFields(in); this.setupProgress = in.readLong(); this.progress = in.readLong(); this.cleanupProgress = in.readLong(); this.runState = in.readInt(); this.state = WritableUtils.readEnum(in, State.class); this.startTime = in.readLong(); this.finishTime = in.readLong(); this.user = Text.readString(in); // this.schedulingInfo = Text.readString(in); this.superstepCount = in.readLong(); this.recovery = in.readBoolean(); }
From source file:com.chinamobile.bcbsp.util.StaffStatus.java
License:Apache License
/** * deserialize/*w w w . j av a 2 s .c om*/ * * @param in Reads some bytes from an input. */ @Override public void readFields(DataInput in) throws IOException { this.jobId.readFields(in); this.staffId.readFields(in); this.progress = in.readInt(); this.runState = WritableUtils.readEnum(in, State.class); this.stateString = Text.readString(in); this.phase = WritableUtils.readEnum(in, Phase.class); this.startTime = in.readLong(); this.finishTime = in.readLong(); this.superstepCount = in.readLong(); this.faultFlag = in.readInt(); if (this.faultFlag == 1) { this.fault.readFields(in); } this.recovery = in.readBoolean(); this.currentSSTime = in.readLong(); this.workerManager = Text.readString(in); }
From source file:com.chinamobile.bcbsp.workermanager.WorkerManagerStatus.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { this.workerManagerName = Text.readString(in); this.rpc = Text.readString(in); // add by cuiLI this.host = Text.readString(in); // this.host = "192.168.0.211"; this.httpPort = Text.readString(in); this.localIp = Text.readString(in); int staffCount = in.readInt(); StaffStatus status;// w w w . j a v a 2s . com this.staffReports.clear(); for (int i = 0; i < staffCount; i++) { status = new StaffStatus(); status.readFields(in); this.staffReports.add(status); } int workerFaultCount = in.readInt(); Fault faultTemp; this.workerFaultList.clear(); for (int i = 0; i < workerFaultCount; i++) { faultTemp = new Fault(); faultTemp.readFields(in); this.workerFaultList.add(faultTemp); } this.maxStaffsCount = in.readInt(); this.runningStaffsCount = in.readInt(); this.finishedStaffsCount = in.readInt(); this.failedStaffsCount = in.readInt(); }
From source file:com.cloudera.crunch.type.writable.GenericArrayWritable.java
License:Open Source License
public void readFields(DataInput in) throws IOException { values = new Writable[in.readInt()]; // construct values if (values.length > 0) { String valueType = Text.readString(in); setValueType(valueType);//from ww w . j av a 2s . c o m for (int i = 0; i < values.length; i++) { Writable value = WritableFactories.newInstance(valueClass); value.readFields(in); // read a value values[i] = value; // store it in values } } }
From source file:com.cloudera.crunch.type.writable.TextMapWritable.java
License:Open Source License
@Override public void readFields(DataInput in) throws IOException { instance.clear();//from w w w . j a v a 2 s .c om try { this.valueClazz = (Class<T>) Class.forName(Text.readString(in)); } catch (ClassNotFoundException e) { throw (IOException) new IOException("Failed map init").initCause(e); } int entries = WritableUtils.readVInt(in); try { for (int i = 0; i < entries; i++) { Text txt = new Text(); txt.readFields(in); T value = valueClazz.newInstance(); value.readFields(in); instance.put(txt, value); } } catch (IllegalAccessException e) { throw (IOException) new IOException("Failed map init").initCause(e); } catch (InstantiationException e) { throw (IOException) new IOException("Failed map init").initCause(e); } }
From source file:com.cloudera.crunch.type.writable.TupleWritable.java
License:Apache License
/** * {@inheritDoc}/* w w w .j a v a2 s. c o m*/ */ @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) { if (has(i)) { cls[i] = Class.forName(Text.readString(in)).asSubclass(Writable.class); } } for (int i = 0; i < card; ++i) { if (has(i)) { values[i] = cls[i].newInstance(); 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:com.cloudera.sqoop.lib.BigDecimalSerializer.java
License:Apache License
public static BigDecimal readFields(DataInput in) throws IOException { int scale = in.readInt(); boolean fastpath = in.readBoolean(); BigInteger unscaledIntPart;/*w w w . j a v a 2 s . c o m*/ if (fastpath) { long unscaledValue = in.readLong(); unscaledIntPart = BigInteger.valueOf(unscaledValue); } else { String unscaledValueStr = Text.readString(in); unscaledIntPart = new BigInteger(unscaledValueStr); } return new BigDecimal(unscaledIntPart, scale); }
From source file:com.cloudera.sqoop.lib.ClobRef.java
License:Apache License
@Override public void readFieldsInternal(DataInput in) throws IOException { // For internally-stored clobs, the data is written as UTF8 Text. setDataObj(Text.readString(in)); }