List of usage examples for java.io DataInput readInt
int readInt() throws IOException;
From source file:org.apache.hadoop.chukwa.analysis.salsa.fsm.FSMIntermedEntry.java
public void readFields(DataInput in) throws IOException { int currlen, numkeys; this.state_type = new StateType(in.readInt()); this.state_mapred = new MapRedState(in.readInt()); this.state_hdfs = new HDFSState(in.readInt()); this.fsm_type = new FSMType(in.readInt()); in.readChar();/*w w w .j a v a 2 s . co m*/ currlen = in.readInt(); if (currlen > 0) this.state_name = in.readUTF(); else this.state_name = ""; currlen = in.readInt(); if (currlen > 0) this.unique_id = in.readUTF(); else this.unique_id = ""; currlen = in.readInt(); if (currlen > 0) this.timestamp = in.readUTF(); else this.timestamp = ""; currlen = in.readInt(); if (currlen > 0) this.time_start = in.readUTF(); else this.time_start = ""; currlen = in.readInt(); if (currlen > 0) this.time_end = in.readUTF(); else this.time_end = ""; currlen = in.readInt(); if (currlen > 0) this.host_exec = in.readUTF(); else this.host_exec = ""; currlen = in.readInt(); if (currlen > 0) this.host_other = in.readUTF(); else this.host_other = ""; currlen = in.readInt(); if (currlen > 0) this.time_orig_epoch = in.readUTF(); else this.time_orig_epoch = ""; currlen = in.readInt(); if (currlen > 0) this.time_orig = in.readUTF(); else this.time_orig = ""; currlen = in.readInt(); if (currlen > 0) this.job_id = in.readUTF(); else this.job_id = ""; currlen = in.readInt(); if (currlen > 0) this.identifier = in.readUTF(); else this.identifier = ""; numkeys = in.readInt(); this.add_info = new TreeMap<String, String>(); if (numkeys > 0) { for (int i = 0; i < numkeys; i++) { String currkey, currval; currkey = in.readUTF(); currlen = in.readInt(); if (currlen > 0) { currval = in.readUTF(); this.add_info.put(currkey, currval); } } } }
From source file:org.apache.mahout.classifier.chi_rw.data.Dataset.java
@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); }// www. j a v a 2s. co m 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); } } // only NUMERICAL attributes have values nvalues = new double[nbAttributes][]; for (int attr = 0; attr < nbAttributes; attr++) { if (attributes[attr].isNumerical()) { nvalues[attr] = Chi_RWUtils.readDoubleArray(in); } } minmaxvalues = new double[nbAttributes][]; for (int attr = 0; attr < nbAttributes; attr++) { minmaxvalues[attr] = Chi_RWUtils.readDoubleArray(in); } labelId = in.readInt(); nbInstances = in.readInt(); }
From source file:org.apache.mahout.classifier.chi_rwcs.data.Dataset.java
@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); }/*from w w w .j ava 2 s .co m*/ ignored = Chi_RWCSUtils.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); } } // only NUMERICAL attributes have values nvalues = new double[nbAttributes][]; for (int attr = 0; attr < nbAttributes; attr++) { if (attributes[attr].isNumerical()) { nvalues[attr] = DFUtils.readDoubleArray(in); } } minmaxvalues = new double[nbAttributes][]; for (int attr = 0; attr < nbAttributes; attr++) { minmaxvalues[attr] = DFUtils.readDoubleArray(in); } labelId = in.readInt(); nbInstances = in.readInt(); }
From source file:com.chinamobile.bcbsp.util.StaffStatus.java
/** * deserialize/*ww w .ja v a2 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:org.apache.hadoop.mapred.ClusterStatus.java
public void readFields(DataInput in) throws IOException { numActiveTrackers = in.readInt(); int numTrackerNames = in.readInt(); if (numTrackerNames > 0) { for (int i = 0; i < numTrackerNames; i++) { String name = Text.readString(in); activeTrackers.add(name);/*from w w w.ja v a 2 s. co m*/ } } numBlacklistedTrackers = in.readInt(); numTrackerNames = in.readInt(); if (numTrackerNames > 0) { for (int i = 0; i < numTrackerNames; i++) { String name = Text.readString(in); blacklistedTrackers.add(name); } } numGraylistedTrackers = in.readInt(); numTrackerNames = in.readInt(); if (numTrackerNames > 0) { for (int i = 0; i < numTrackerNames; i++) { String name = Text.readString(in); graylistedTrackers.add(name); } } numExcludedNodes = in.readInt(); ttExpiryInterval = in.readLong(); map_tasks = in.readInt(); reduce_tasks = in.readInt(); max_map_tasks = in.readInt(); max_reduce_tasks = in.readInt(); used_memory = in.readLong(); max_memory = in.readLong(); state = WritableUtils.readEnum(in, JobTracker.State.class); }
From source file:org.cloudata.core.tablet.ColumnValue.java
public void readFields(DataInput in) throws IOException { //long startNano = System.nanoTime(); rowKey.readFields(in);//from w w w .jav a2 s . c o m cellKey.readFields(in); int opCode = in.readInt(); if (opCode == Constants.DELETEED) { deleted = true; } else if (opCode == Constants.INSERTED) { deleted = false; } else { throw new IOException("Wrong record operation code(DELETEED or INSERTED): " + opCode); } timestamp = in.readLong(); numOfValues = in.readInt(); int valueLength = in.readInt(); //System.out.println(">>>>>" + valueLength); value = valueLength < 0 ? null : new byte[valueLength]; if (value != null) { in.readFully(value); } }
From source file:org.apache.nutch.protocol.Content.java
private final void readFieldsCompressed(DataInput in) throws IOException { byte oldVersion = in.readByte(); switch (oldVersion) { case 0:/*from w w w. j a va 2s. c o m*/ case 1: url = Text.readString(in); // read url base = Text.readString(in); // read base content = new byte[in.readInt()]; // read content in.readFully(content); contentType = Text.readString(in); // read contentType // reconstruct metadata int keySize = in.readInt(); String key; for (int i = 0; i < keySize; i++) { key = Text.readString(in); int valueSize = in.readInt(); for (int j = 0; j < valueSize; j++) { metadata.add(key, Text.readString(in)); } } break; case 2: url = Text.readString(in); // read url base = Text.readString(in); // read base content = new byte[in.readInt()]; // read content in.readFully(content); contentType = Text.readString(in); // read contentType metadata.readFields(in); // read meta data break; default: throw new VersionMismatchException((byte) 2, oldVersion); } }
From source file:org.apache.hama.bsp.JobStatus.java
@Override public synchronized void readFields(DataInput in) throws IOException { this.jobid = new BSPJobID(); jobid.readFields(in);/*from w ww. ja v a2s. c o 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:edu.umn.cs.spatialHadoop.nasa.HDFRasterLayer.java
@Override public void readFields(DataInput in) throws IOException { super.readFields(in); this.timestamp = in.readLong(); int length = in.readInt(); byte[] serializedData = new byte[length]; in.readFully(serializedData);//from w ww .java 2 s . c om ByteArrayInputStream bais = new ByteArrayInputStream(serializedData); GZIPInputStream gzis = new GZIPInputStream(bais); byte[] buffer = new byte[8]; gzis.read(buffer); ByteBuffer bbuffer = ByteBuffer.wrap(buffer); int width = bbuffer.getInt(); int height = bbuffer.getInt(); // Reallocate memory only if needed if (width != this.getWidth() || height != this.getHeight()) { sum = new long[width][height]; count = new long[width][height]; } buffer = new byte[getHeight() * 2 * 8]; for (int x = 0; x < getWidth(); x++) { int size = 0; while (size < buffer.length) { size += gzis.read(buffer, size, buffer.length - size); } bbuffer = ByteBuffer.wrap(buffer); for (int y = 0; y < getHeight(); y++) { sum[x][y] = bbuffer.getLong(); count[x][y] = bbuffer.getLong(); } } }
From source file:org.apache.nutch.parse.ParseData.java
public final void readFields(DataInput in) throws IOException { version = in.readByte();/* ww w . j a v a 2s.co m*/ // incompatible change from UTF8 (version < 5) to Text if (version != VERSION) throw new VersionMismatchException(VERSION, version); status = ParseStatus.read(in); title = Text.readString(in); // read title int numOutlinks = in.readInt(); outlinks = new Outlink[numOutlinks]; for (int i = 0; i < numOutlinks; i++) { outlinks[i] = Outlink.read(in); } if (version < 3) { int propertyCount = in.readInt(); // read metadata contentMeta.clear(); for (int i = 0; i < propertyCount; i++) { contentMeta.add(Text.readString(in), Text.readString(in)); } } else { contentMeta.clear(); contentMeta.readFields(in); } if (version > 3) { parseMeta.clear(); parseMeta.readFields(in); } }