当前位置: 首页>>代码示例>>Java>>正文


Java DataInput.readByte方法代码示例

本文整理汇总了Java中java.io.DataInput.readByte方法的典型用法代码示例。如果您正苦于以下问题:Java DataInput.readByte方法的具体用法?Java DataInput.readByte怎么用?Java DataInput.readByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.DataInput的用法示例。


在下文中一共展示了DataInput.readByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFields

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void readFields(DataInput in) throws IOException {
  
  // Get the number of "unknown" classes
  
  newClasses = in.readByte();
  
  // Then read in the class names and add them to our tables
  
  for (int i = 0; i < newClasses; i++) {
    byte id = in.readByte();
    String className = in.readUTF();
    try {
      addToMap(Class.forName(className), id);
      
    } catch (ClassNotFoundException e) {
      throw new IOException("can't find class: " + className + " because "+
          e.getMessage());
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:AbstractMapWritable.java

示例2: fromData

import java.io.DataInput; //导入方法依赖的package包/类
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.entryBits = in.readByte();
  byte flags = in.readByte();
  this.key = DataSerializer.readObject(in);

  if (EntryBits.isTombstone(this.entryBits)) {
    this.value = Token.TOMBSTONE;
  } else {
    this.value = DataSerializer.readByteArray(in);
  }
  this.lastModified = in.readLong();
  if ((flags & HAS_VERSION) != 0) {
    // note that null IDs must be later replaced with the image provider's ID
    this.versionTag = VersionTag.create((flags & PERSISTENT_VERSION) != 0, in);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:17,代码来源:InitialImageOperation.java

示例3: fromData

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.name = in.readUTF();
  this.expression = in.readUTF();
  this.fromClause = in.readUTF();
  this.loadEntries = in.readBoolean();

  byte byteIndexType = in.readByte();
  if (0 == byteIndexType) {
    this.indexType = IndexType.PRIMARY_KEY;
  } else if (1 == byteIndexType) {
    this.indexType = IndexType.HASH;
  } else {
    this.indexType = IndexType.FUNCTIONAL;
  }

  boolean isImportStr = in.readBoolean();
  if (isImportStr) {
    this.importStr = in.readUTF();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:22,代码来源:IndexCreationData.java

示例4: fromData

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  byte flags = in.readByte();
  final boolean hasVersionTag;
  if ((hasVersionTag = (flags & VALUE_HAS_VERSION_TAG) != 0)) {
    flags &= ~VALUE_HAS_VERSION_TAG;
  }
  this.valueType = flags;
  this.valueInBytes = DataSerializer.readByteArray(in);
  if (flags != VALUE_IS_BYTES) {
    this.remoteVersion = InternalDataSerializer.getVersionForDataStreamOrNull(in);
  }
  if (hasVersionTag) {
    this.versionTag = (VersionTag) DataSerializer.readObject(in);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:GetMessage.java

示例5: fromData

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  byte flag = in.readByte();
  if (flag != NO_PARTITION) {
    this.configuredMaxMemory = in.readLong();
    this.size = in.readLong();
    this.bucketCount = in.readInt();
    this.primaryCount = in.readInt();
    if (flag == OK_INTERNAL) {
      this.prLoad = PRLoad.createFromDataInput(in);
      this.bucketSizes = DataSerializer.readLongArray(in);
      this.offlineDetails = new OfflineMemberDetailsImpl();
      InternalDataSerializer.invokeFromData(this.offlineDetails, in);
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:FetchPartitionDetailsMessage.java

示例6: getZoneInfo

import java.io.DataInput; //导入方法依赖的package包/类
public static ZoneInfo getZoneInfo(DataInput in, String zoneId) throws Exception {
    byte type = in.readByte();
    // TBD: assert ZRULES:
    int stdSize = in.readInt();
    long[] stdTrans = new long[stdSize];
    for (int i = 0; i < stdSize; i++) {
        stdTrans[i] = readEpochSec(in);
    }
    int [] stdOffsets = new int[stdSize + 1];
    for (int i = 0; i < stdOffsets.length; i++) {
        stdOffsets[i] = readOffset(in);
    }
    int savSize = in.readInt();
    long[] savTrans = new long[savSize];
    for (int i = 0; i < savSize; i++) {
        savTrans[i] = readEpochSec(in);
    }
    int[] savOffsets = new int[savSize + 1];
    for (int i = 0; i < savOffsets.length; i++) {
        savOffsets[i] = readOffset(in);
    }
    int ruleSize = in.readByte();
    ZoneOffsetTransitionRule[] rules = new ZoneOffsetTransitionRule[ruleSize];
    for (int i = 0; i < ruleSize; i++) {
        rules[i] = new ZoneOffsetTransitionRule(in);
    }
    return getZoneInfo(zoneId, stdTrans, stdOffsets, savTrans, savOffsets, rules);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ZoneInfoFile.java

示例7: PutAllEntryData

import java.io.DataInput; //导入方法依赖的package包/类
/**
 * Constructor to use when receiving a putall from someone else
 */
public PutAllEntryData(DataInput in, EventID baseEventID, int idx, Version version,
    ByteArrayDataInput bytesIn) throws IOException, ClassNotFoundException {
  this.key = DataSerializer.readObject(in);
  byte flgs = in.readByte();
  if ((flgs & IS_OBJECT) != 0) {
    this.value = DataSerializer.readObject(in);
  } else {
    byte[] bb = DataSerializer.readByteArray(in);
    if ((flgs & IS_CACHED_DESER) != 0) {
      this.value = CachedDeserializableFactory.create(bb);
    } else {
      this.value = bb;
    }
  }
  this.oldValue = null;
  this.op = Operation.fromOrdinal(in.readByte());
  this.flags = in.readByte();
  if ((this.flags & FILTER_ROUTING) != 0) {
    this.filterRouting = (FilterRoutingInfo) DataSerializer.readObject(in);
  }
  if ((this.flags & VERSION_TAG) != 0) {
    boolean persistentTag = (this.flags & PERSISTENT_TAG) != 0;
    this.versionTag = VersionTag.create(persistentTag, in);
  }
  if (isUsedFakeEventId()) {
    this.eventID = new EventID();
    InternalDataSerializer.invokeFromData(this.eventID, in);
  } else {
    this.eventID = new EventID(baseEventID, idx);
  }
  if ((this.flags & HAS_TAILKEY) != 0) {
    this.tailKey = DataSerializer.readLong(in);
  }
  this.opInfo = DataSerializer.readObject(in);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:39,代码来源:DistributedPutAllOperation.java

示例8: readFields

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void readFields(DataInput in, Model m) throws IOException {
    isRecurrent = in.readBoolean();
    if(in.readBoolean()) relativeRid = (int) in.readByte();
    if(in.readBoolean()) absoluteRid = (int) in.readByte();
    rangeMatch = Relation.read(in, m);
    rangeOutput = Output.read(in, m);
}
 
开发者ID:aika-algorithm,项目名称:aika,代码行数:9,代码来源:Synapse.java

示例9: fromData

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.grantorVersion = in.readLong();
  this.dlsSerialNumber = in.readInt();
  this.serviceName = DataSerializer.readString(in);
  this.processorId = in.readInt();
  this.opCode = in.readByte();
  if (this.opCode == BECOME_OP) {
    this.oldTurk = (InternalDistributedMember) DataSerializer.readObject(in);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:GrantorRequestProcessor.java

示例10: readUnsignedVarInt

import java.io.DataInput; //导入方法依赖的package包/类
/**
 * @throws IllegalArgumentException if variable-length value does not terminate
 *                                  after 5 bytes have been read
 * @throws IOException              if {@link DataInput} throws {@link IOException}
 * @see #readUnsignedVarLong(DataInput)
 */
public static int readUnsignedVarInt(DataInput in) throws IOException {
    int value = 0;
    int i = 0;
    int b;
    while (((b = in.readByte()) & 0x80) != 0) {
        value |= (b & 0x7F) << i;
        i += 7;
        if (i > 35) {
            throw new IllegalArgumentException("Variable length quantity is too long");
        }
    }
    return value | (b << i);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:20,代码来源:Varint.java

示例11: newDataInput

import java.io.DataInput; //导入方法依赖的package包/类
/**
 * Creates a new {@link NormalizedNodeDataInput} instance that reads from the given input. This method first reads
 * and validates that the input contains a valid NormalizedNode stream.
 *
 * @param input the DataInput to read from
 * @return a new {@link NormalizedNodeDataInput} instance
 * @throws IOException if an error occurs reading from the input
 */
public static NormalizedNodeDataInput newDataInput(@Nonnull final DataInput input) throws IOException {
    final byte marker = input.readByte();
    if (marker != TokenTypes.SIGNATURE_MARKER) {
        throw new InvalidNormalizedNodeStreamException(String.format("Invalid signature marker: %d", marker));
    }

    final short version = input.readShort();
    switch (version) {
        case TokenTypes.LITHIUM_VERSION:
            return new NormalizedNodeInputStreamReader(input, true);
        default:
            throw new InvalidNormalizedNodeStreamException(String.format("Unhandled stream version %s", version));
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:NormalizedNodeInputOutput.java

示例12: readType

import java.io.DataInput; //导入方法依赖的package包/类
private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException
{
    return input.readByte();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:NBTTagCompound.java

示例13: fromData

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.responseCode = in.readByte();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:6,代码来源:BecomePrimaryBucketMessage.java

示例14: fromData

import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  long l;
  if (in == null) {
    throw new NullPointerException("Null DataInput");
  }
  this.hasKeys = in.readBoolean();
  this.index = in.readInt();
  this.typeArray = new byte[index];
  this.keyArray = new Object[index];
  this.objectArray = new Object[index];
  byte objectType;
  Object value;
  int length;
  byte[] bytes;
  for (int i = 0; i < this.index; i++) {
    if (this.hasKeys) {
      length = in.readByte();
      bytes = new byte[length];
      in.readFully(bytes, 0, length);
      this.keyArray[i] = bytes;
    }
    objectType = in.readByte();
    if (objectType == BYTES) {
      length = in.readShort();
      if (length >= 0) {
        bytes = new byte[length];
        in.readFully(bytes, 0, length);
      } else {
        bytes = null;
      }
      value = bytes;
    } else if (objectType == OBJECT) {
      value = DataSerializer.readObject(in);
    } else if (objectType == EXCEPTION) {
      byte[] exBytes = DataSerializer.readByteArray(in);
      value = CacheServerHelper.deserialize(exBytes);
      // ignore the exception string meant for native clients
      DataSerializer.readString(in);
    } else {
      value = null;
    }
    this.objectArray[i] = value;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:46,代码来源:MPartList.java

示例15: readInterestResultPolicy

import java.io.DataInput; //导入方法依赖的package包/类
/**
 * Reads an instance of <code>InterestResultPolicy</code> from a <code>DataInput</code>.
 *
 * @throws IOException A problem occurs while reading from <code>in</code>
 */
private static InterestResultPolicyImpl readInterestResultPolicy(DataInput in)
    throws IOException, ClassNotFoundException {
  byte ordinal = in.readByte();
  return (InterestResultPolicyImpl) InterestResultPolicy.fromOrdinal(ordinal);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:DSFIDFactory.java


注:本文中的java.io.DataInput.readByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。