下面列出了java.io.DataInput#readInt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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);
}
@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);
}
}
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();
}
}
@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();
}
/**
* 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);
}
}
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);
}
}
}
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);
}
@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);
}
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;
}
public PutSystemLabelChange(DataInput in) throws IOException {
super(in);
myColor = in.readInt();
}
@Override
public void fromData(DataInput in) throws ClassNotFoundException, IOException {
super.fromData(in);
this.viewId = in.readLong();
this.processorId = in.readInt();
}
public static int readOffset(DataInput in) throws IOException {
int offsetByte = in.readByte();
return offsetByte == 127 ? in.readInt() : offsetByte * 900;
}
public void readFields(DataInput in) throws IOException {
key = new byte[in.readInt()];
in.readFully(key);
}
/**
* 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();
}
public void fromData(DataInput in) throws IOException, ClassNotFoundException
{
this.arr = DataSerializer.readByteArray(in);
this.name = DataSerializer.readString(in);
this.identifier = in.readInt();
}
@Override
public void readFields(DataInput dataInput) throws IOException {
this.index = dataInput.readInt();
}
@Override
public void fromData(DataInput in) throws IOException,
ClassNotFoundException {
super.fromData(in);
this.alertLevel = in.readInt();
}
private static int readInt(DataInput dataInput) throws IOException {
if (dataInput.readInt() != 4) {
throw new IllegalStateException("Integer must be 4 bytes");
}
return dataInput.readInt();
}
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.id = in.readInt();
this.intField = in.readInt();
}
/**
* 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();
}