Java Code Examples for java.io.DataInput#readInt()

The following examples show how to use java.io.DataInput#readInt() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void readFields(DataInput in) throws IOException {
  if (in.readBoolean()) {
    int eventsCount = in.readInt();
    events = new ArrayList<TezEvent>(eventsCount);
    for (int i = 0; i < eventsCount; ++i) {
      TezEvent e = new TezEvent();
      e.readFields(in);
      events.add(e);
    }
  }
  if (in.readBoolean()) {
    currentTaskAttemptID = TezTaskAttemptID.readTezTaskAttemptID(in);
  } else {
    currentTaskAttemptID = null;
  }
  startIndex = in.readInt();
  maxEvents = in.readInt();
  requestId = in.readLong();
  containerIdentifier = Text.readString(in);
}
 
Example 2
Source Project: Arabesque   File: ODAGStash.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void readFields(DataInput dataInput) throws IOException {
    if (true) {
        throw new RuntimeException("Shouldn't be used any more");
    }
    compressedEmbeddingsByPattern.clear();
    int numEntries = dataInput.readInt();
    for (int i = 0; i < numEntries; ++i) {
        Pattern pattern = Configuration.get().createPattern();
        pattern.readFields(dataInput);
        ODAG shrunkEmbeddings = new ODAG(false);
        shrunkEmbeddings.setPattern(pattern);
        shrunkEmbeddings.readFields(dataInput);
        compressedEmbeddingsByPattern.put(pattern, shrunkEmbeddings);
    }
}
 
Example 3
Source Project: RDFS   File: CombineFileSplit.java    License: Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  totLength = in.readLong();
  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();
  }
}
 
Example 4
Source Project: gemfirexd-oss   File: QueryTask.java    License: Apache License 2.0 5 votes vote down vote up
@Override
 public void fromData(DataInput input) throws IOException, ClassNotFoundException
{
	super.fromData(input);
	uuid = DataSerializer.readString(input);
	queryString = DataSerializer.readString(input);
	nextEnabled = input.readBoolean();
	isPRLocalData = input.readBoolean();
	fetchSize = input.readInt();
	keysOnly = input.readBoolean();
}
 
Example 5
Source Project: hadoop-gpu   File: Counters.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Read a set of groups.
 */
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);
  }
}
 
Example 6
Source Project: gemfirexd-oss   File: ObjectPartList.java    License: Apache License 2.0 5 votes vote down vote up
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.hasKeys = in.readBoolean();
  if (this.hasKeys) {
    this.keys = new ArrayList();
  }
  int numObjects = in.readInt();
  if (numObjects > 0) {
    for (int index = 0; index < numObjects; ++index) {
      if (this.hasKeys) {
        Object key = DataSerializer.readObject(in);
        this.keys.add(key);
      }
      boolean isException = in.readBoolean();
      Object value;
      if (isException) {
        byte[] exBytes = DataSerializer.readByteArray(in);
        value = CacheServerHelper.deserialize(exBytes);
        // ignore the exception string meant for native clients
        DataSerializer.readString(in);
      }
      else {
        value = DataSerializer.readObject(in);
      }
      this.objects.add(value);
    }
  }
}
 
Example 7
Source Project: spork   File: L10.java    License: Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    timespent = in.readInt();
    estimated_revenue = in.readDouble();
    int len = in.readInt();
    byte[] b = new byte[len];
    in.readFully(b);
    query_term = new String(b);
}
 
Example 8
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException
{
  super.fromData(in);
  this.prId = in.readInt();
  this.bucketId = in.readInt();
  this.processorId = in.readInt();
  this.profile = (BucketAdvisor.BucketProfile)DataSerializer.readObject(in);
}
 
Example 9
public int[] readIntArray(int length) throws IOException {
	DataInput dataInput = asDataInput();

	int[] result = new int[length];

	for(int i = 0; i < result.length; i++){
		result[i] = dataInput.readInt();
	}

	return result;
}
 
Example 10
Source Project: consulo   File: PutSystemLabelChange.java    License: Apache License 2.0 4 votes vote down vote up
public PutSystemLabelChange(DataInput in) throws IOException {
  super(in);
  myColor = in.readInt();
}
 
Example 11
@Override
public void fromData(DataInput in) throws ClassNotFoundException, IOException {
  super.fromData(in);
  this.viewId = in.readLong();
  this.processorId = in.readInt();
}
 
Example 12
public static int readOffset(DataInput in) throws IOException {
    int offsetByte = in.readByte();
    return offsetByte == 127 ? in.readInt() : offsetByte * 900;
}
 
Example 13
Source Project: kylin   File: AppendDictSliceKey.java    License: Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    key = new byte[in.readInt()];
    in.readFully(key);
}
 
Example 14
Source Project: KeePassJava2   File: KdbSerializer.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Deserialize a KdbEntry from a data source
 *
 * @param database  a database to insert the entry into
 * @param dataInput a source of data
 * @throws IOException
 */
private static void deserializeEntry(KdbDatabase database, DataInput dataInput) throws IOException {
    int fieldType;
    KdbEntry entry = new KdbEntry();
    while ((fieldType = dataInput.readUnsignedShort()) != 0xFFFF) {
        switch (fieldType) {
            case 0x0000:
                // we are not doing anything with ExtData for now. Contains header hash ...
                readExtData(dataInput);
                break;
            case 0x0001:
                entry.setUuid(readUuid(dataInput));
                break;
            case 0x0002:
                int groupId = readInt(dataInput);
                // group UUIDs are just the index of the group converted to a UUID
                Group group = database.findGroup(new UUID(0, groupId));
                if (group == null) {
                    throw new IllegalStateException("Entry belongs to group that does not exist");
                }
                group.addEntry(entry);
                break;
            case 0x0003:
                entry.setIcon(new KdbIcon(readInt(dataInput)));
                break;
            case 0x0004:
                entry.setTitle(readString(dataInput));
                break;
            case 0x0005:
                entry.setUrl(readString(dataInput));
                break;
            case 0x0006:
                entry.setUsername(readString(dataInput));
                break;
            case 0x0007:
                entry.setPassword(readString(dataInput));
                break;
            case 0x0008:
                // these are not really notes, they are things like properties from KDBX databases
                // that don't have anywhere else to live and that we would like to expose
                entry.setNotes(readString(dataInput));
                break;
            case 0x0009:
                entry.setCreationTime(readDate(dataInput));
                break;
            case 0x000A:
                entry.setLastModificationTime(readDate(dataInput));
                break;
            case 0x000B:
                entry.setLastAccessTime(readDate(dataInput));
                break;
            case 0x000C:
                entry.setExpiryTime(readDate(dataInput));
                break;
            case 0x000D:
                entry.setBinaryDescription(readString(dataInput));
                break;
            case 0x000E:
                entry.setBinaryData(readBuffer(dataInput));
                break;
            default:
                throw new IllegalStateException("Unknown field type");
        }
    }
    // consume the length indicator on the final block
    dataInput.readInt();
}
 
Example 15
public void fromData(DataInput in) throws IOException, ClassNotFoundException
{
  this.arr = DataSerializer.readByteArray(in);
  this.name = DataSerializer.readString(in);
  this.identifier = in.readInt();
}
 
Example 16
@Override
public void readFields(DataInput dataInput) throws IOException {
    this.index = dataInput.readInt();
}
 
Example 17
@Override
public void fromData(DataInput in) throws IOException,
    ClassNotFoundException {
  super.fromData(in);
  this.alertLevel = in.readInt();
}
 
Example 18
Source Project: KeePassJava2   File: KdbSerializer.java    License: Apache License 2.0 4 votes vote down vote up
private static int readInt(DataInput dataInput) throws IOException {
    if (dataInput.readInt() != 4) {
        throw new IllegalStateException("Integer must be 4 bytes");
    }
    return dataInput.readInt();
}
 
Example 19
Source Project: gemfirexd-oss   File: TinyObject.java    License: Apache License 2.0 4 votes vote down vote up
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.id = in.readInt();
  this.intField = in.readInt();
}
 
Example 20
Source Project: Tomcat8-Source-Read   File: ConstantInteger.java    License: MIT License 2 votes vote down vote up
/**
 * Initialize instance from file data.
 *
 * @param file Input stream
 * @throws IOException
 */
ConstantInteger(final DataInput file) throws IOException {
    super(Const.CONSTANT_Integer);
    this.bytes = file.readInt();
}