java.io.DataInput#readShort ( )源码实例Demo

下面列出了java.io.DataInput#readShort ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jamod   文件: WriteMultipleRegistersRequest.java
public void readData(DataInput din) throws IOException {

		m_Reference = din.readShort();
		// read lengths
		int wc = din.readUnsignedShort();
		@SuppressWarnings("unused")
		int bc = din.readUnsignedByte();

		// read values
		if (m_NonWordDataHandler == null) {
			m_Registers = new Register[wc];
			ProcessImageFactory pimf = ModbusCoupler.getReference()
					.getProcessImageFactory();
			for (int i = 0; i < wc; i++) {
				m_Registers[i] = pimf.createRegister(din.readByte(),
						din.readByte());
			}
		} else {
			m_NonWordDataHandler.readData(din, m_Reference, wc);
		}
	}
 
源代码2 项目: gemfirexd-oss   文件: FilterProfile.java
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.processorId = in.readInt();
  this.regionName = in.readUTF();
  this.opType = operationType.values()[in.readShort()];
  this.updatesAsInvalidates = in.readBoolean();
  this.profileVersion = in.readLong();
  if (isCqOp(this.opType)){
    this.serverCqName = in.readUTF();
    if (this.opType == operationType.REGISTER_CQ || 
        this.opType == operationType.SET_CQ_STATE){
      this.cq = new CqQueryImpl();
      InternalDataSerializer.invokeFromData(((CqQueryImpl)this.cq), in);
    }
  } else {
    this.clientID = in.readLong();
    this.interest = DataSerializer.readObject(in);
  }
}
 
源代码3 项目: gemfirexd-oss   文件: XML.java
@Override
public final void fromDataForOptimizedResultHolder(final DataInput dis)
    throws IOException, ClassNotFoundException {
  if (xmlStringValue == null) {
    xmlStringValue = new SQLVarchar();
  }
  // skip UTF8_IMPL_ID since it is not used currently
  dis.readShort();

  // invoke method of the underlying string type DVD
  xmlStringValue.fromDataForOptimizedResultHolder(dis);

  // If we read it from row then it must have type
  // XML_DOC_ANY because that's all we allow to be
  // written into an XML column.
  setXType(XML_DOC_ANY);
}
 
源代码4 项目: archimedes-ships   文件: ChunkIO.java
public static void read(DataInput in, MobileChunk chunk) throws IOException
{
	int count = in.readShort();
	
	ArchimedesShipMod.modLog.debug("Reading mobile chunk data: " + count + " blocks");
	
	int x, y, z;
	int id;
	int meta;
	for (int i = 0; i < count; i++)
	{
		x = in.readByte();
		y = in.readByte();
		z = in.readByte();
		id = in.readShort();
		meta = in.readInt();
		chunk.setBlockIDWithMetadata(x, y, z, Block.getBlockById(id), meta);
	}
}
 
源代码5 项目: gemfirexd-oss   文件: Version.java
/**
 * Reads ordinal as written by {@link #writeOrdinal} from given
 * {@link DataInput}.
 */
public static short readOrdinal(DataInput in) throws IOException {
  final byte ordinal = in.readByte();
  if (ordinal != TOKEN_ORDINAL) {
    return ordinal;
  }
  else {
    return in.readShort();
  }
}
 
源代码6 项目: gemfirexd-oss   文件: DataSerializer.java
/**
 * Reads a primitive <code>short</code> from a
 * <code>DataInput</code>.
 *
 * @throws IOException
 *         A problem occurs while reading from <code>in</code>
 * @see DataInput#readShort
 * @since 5.1
 */
public static short readPrimitiveShort(DataInput in) throws IOException {
  InternalDataSerializer.checkIn(in);

  short value = in.readShort();
  if (DEBUG) {
    InternalDataSerializer.logger.info( LocalizedStrings.DEBUG, "Read Short " + value);
  }
  return value;
}
 
源代码7 项目: RDFS   文件: FileStatus.java
public void readFields(DataInput in) throws IOException {
  String strPath = Text.readString(in);
  this.path = new Path(strPath);
  this.length = in.readLong();
  this.isdir = in.readBoolean();
  this.block_replication = in.readShort();
  blocksize = in.readLong();
  modification_time = in.readLong();
  access_time = in.readLong();
  permission.readFields(in);
  owner = Text.readString(in);
  group = Text.readString(in);
}
 
源代码8 项目: Bytecoder   文件: StackMapType.java
/**
 * Construct object from file stream.
 * @param file Input stream
 * @throws IOException
 */
StackMapType(final DataInput file, final ConstantPool constant_pool) throws IOException {
    this(file.readByte(), -1, constant_pool);
    if (hasIndex()) {
        this.index = file.readShort();
    }
    this.constant_pool = constant_pool;
}
 
源代码9 项目: big-c   文件: FsServerDefaults.java
@Override
@InterfaceAudience.Private
public void readFields(DataInput in) throws IOException {
  blockSize = in.readLong();
  bytesPerChecksum = in.readInt();
  writePacketSize = in.readInt();
  replication = in.readShort();
  fileBufferSize = in.readInt();
  checksumType = WritableUtils.readEnum(in, DataChecksum.Type.class);
}
 
源代码10 项目: gemfirexd-oss   文件: InternalDataSerializer.java
/**
 * now used only for compatibility with GFXD 1.0.3 disk files. DO NOT USE
 * OTHERWISE IN NEW CODE -- INSTEAD SEE {@link #readSignedVL(DataInput)},
 * {@link #readUnsignedVL(DataInput)}.
 */
public static int readCompactInt(final DataInput in) throws IOException {
  final boolean dump = DataSerializer.DEBUG;
  int v = in.readByte();
  if (dump) {
    logger.info(LocalizedStrings.DEBUG, "readCompactValue(byte1)=" + v);
  }
  if (v < MIN_1BYTE_COMPACT_VALUE) {
    if (v == COMPACT_VALUE_2_TOKEN) {
      v = in.readShort();
      if (dump) {
        logger.info(LocalizedStrings.DEBUG, "readCompactValue(short)=" + v);
      }
    }
    else {
      int bytesToRead = (v - COMPACT_VALUE_2_TOKEN) + 2;
      v = in.readByte(); // note the first byte will be a signed byte.
      if (dump) {
        logger.info(LocalizedStrings.DEBUG, "readCompactValue(byte2["
            + bytesToRead + "])=" + v);
      }
      bytesToRead--;
      while (bytesToRead > 0) {
        v <<= 8;
        int b = in.readUnsignedByte();
        v |= b;
        if (dump) {
          logger.info(LocalizedStrings.DEBUG, "readCompactValue("
              + bytesToRead + ")=" + b);
          logger.info(LocalizedStrings.DEBUG, "readCompactValue v=" + v);
        }
        bytesToRead--;
      }
    }
  }
  return v;
}
 
源代码11 项目: gemfirexd-oss   文件: PersistentMemberID.java
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  long diskStoreIdHigh =  in.readLong();
  long diskStoreIdLow =  in.readLong();
  this.diskStoreId = new DiskStoreID(diskStoreIdHigh, diskStoreIdLow);
  this.host = DataSerializer.readInetAddress(in);
  this.directory = DataSerializer.readString(in);
  this.timeStamp = in.readLong();
  this.version = in.readShort();
  this.name = DataSerializer.readString(in);
}
 
源代码12 项目: gemfirexd-oss   文件: VersionTag.java
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  LogWriterI18n log = null;
  if (DEBUG) {
    log = InternalDistributedSystem.getLoggerI18n();
  }
  int flags = in.readUnsignedShort();
  if (DEBUG) {
    log.info(LocalizedStrings.DEBUG,
            "deserializing " + this.getClass() + " with flags 0x" + Integer.toHexString(flags));
  }
  this.bits = in.readUnsignedShort();
  this.distributedSystemId = in.readByte();
  if ((flags & VERSION_TWO_BYTES) != 0) {
    this.entryVersion = in.readShort() & 0xffff;
  } else {
    this.entryVersion = in.readInt() & 0xffffffff;
  }
  if ((flags & HAS_RVV_HIGH_BYTE) != 0) {
    this.regionVersionHighBytes = in.readShort();
  }
  this.regionVersionLowBytes = in.readInt();
  this.timeStamp = InternalDataSerializer.readUnsignedVL(in);
  if ((flags & HAS_MEMBER_ID) != 0) {
    this.memberID = readMember(in);
  }
  if ((flags & HAS_PREVIOUS_MEMBER_ID) != 0) {
    if ((flags & DUPLICATE_MEMBER_IDS) != 0) {
      this.previousMemberID = this.memberID;
    } else {
      this.previousMemberID = readMember(in);
    }
  }
  this.bits |= BITS_IS_REMOTE_TAG;
}
 
源代码13 项目: hadoop   文件: FSImageFormat.java
/**
 * Load information about root, and use the information to update the root
 * directory of NameSystem.
 * @param in The {@link DataInput} instance to read.
 * @param counter Counter to increment for namenode startup progress
 */
private void loadRoot(DataInput in, Counter counter)
    throws IOException {
  // load root
  if (in.readShort() != 0) {
    throw new IOException("First node is not root");
  }
  final INodeDirectory root = loadINode(null, false, in, counter)
    .asDirectory();
  // update the root's attributes
  updateRootAttr(root);
}
 
源代码14 项目: sagetv   文件: Airing.java
Airing(DataInput in, byte ver, Map<Integer, Integer> idMap) throws IOException
{
  super(in, ver, idMap);
  showID = readID(in, idMap);
  stationID = in.readInt();
  time = in.readLong();
  duration = in.readLong();
  if (duration < 0)
  {
    Wizard.INVALID_AIRING_DURATIONS = true;
    if (Sage.DBG) System.out.println("BAD AIRING DURATION: id=" + id + " showID=" + showID + " time=" + time + " duration=" + duration + " mask=" +
        getMediaMaskString());
  }
  partsB = in.readByte();
  if (ver >= 0x4A)
    miscB = in.readInt();
  else
    miscB = in.readByte() & 0xFF;
  prB = in.readByte();
  if (ver >= 0x41)
    persist = in.readByte();
  if (ver >= 0x4C && ver < 0x54) {
    int size = in.readShort();
    in.skipBytes(size); // url bytes
    long foo = (ver >= 0x51) ? in.readLong() : in.readInt();
    if (foo != 0) {
      in.readShort(); // price
      in.readInt(); // flags
      in.readInt(); // winstart
      if (ver >= 0x4E) {
        size = in.readShort();
        in.skipBytes(size); // provider
      }
    }
  }
}
 
源代码15 项目: RDFS   文件: UpgradeStatusReport.java
/**
 */
public void readFields(DataInput in) throws IOException {
  this.version = in.readInt();
  this.upgradeStatus = in.readShort();
}
 
源代码16 项目: gemfirexd-oss   文件: EntryEventImpl.java
/**
 * Reads the contents of this message from the given input.
 */
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.eventID = (EventID)DataSerializer.readObject(in);
  this.key = DataSerializer.readObject(in);
  this.op = Operation.fromOrdinal(in.readByte());
  short flags = in.readShort();
  this.eventFlags = (short)(flags & EventFlags.FLAG_TRANSIENT_MASK);
  this.extraEventFlags = (short)(flags & 0xFF);
  this.callbackArg = DataSerializer.readObject(in);

  final boolean prefObject = CachedDeserializableFactory.preferObject();
  Version version = null;
  ByteArrayDataInput bytesIn = null;
  if (prefObject) {
    version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
    bytesIn = new ByteArrayDataInput();
  }
  if (in.readBoolean()) {     // isDelta
    this.delta = (Delta)DataSerializer.readObject(in);
  }
  else {
    // OFFHEAP Currently values are never deserialized to off heap memory. If that changes then this code needs to change.
    if (in.readBoolean()) {     // newValueSerialized
      this.newValueBytes = DataSerializer.readByteArray(in);
      if (prefObject) {
        this.newValue = deserialize(this.newValueBytes, version, bytesIn);
      }
      else {
        this.newValue = CachedDeserializableFactory.create(this.newValueBytes);
      }
    }
    else {
      this.newValue = DataSerializer.readObject(in);
    }
  }

  // OFFHEAP Currently values are never deserialized to off heap memory. If that changes then this code needs to change.
  if (in.readBoolean()) {     // oldValueSerialized
    this.oldValueBytes = DataSerializer.readByteArray(in);
    if (prefObject) {
      this.oldValue = deserialize(this.oldValueBytes, version, bytesIn);
    }
    else {
      this.oldValue = CachedDeserializableFactory.create(this.oldValueBytes);
    }
  }
  else {
    this.oldValue = DataSerializer.readObject(in);
  }
  this.distributedMember = DSFIDFactory.readInternalDistributedMember(in);
  this.context = ClientProxyMembershipID.readCanonicalized(in);
  this.tailKey = in.readLong();
}
 
源代码17 项目: dragonwell8_jdk   文件: UID.java
/**
 * Constructs and returns a new <code>UID</code> instance by
 * unmarshalling a binary representation from an
 * <code>DataInput</code> instance.
 *
 * <p>Specifically, this method first invokes the given stream's
 * {@link DataInput#readInt()} method to read a <code>unique</code> value,
 * then it invoke's the stream's
 * {@link DataInput#readLong()} method to read a <code>time</code> value,
 * then it invoke's the stream's
 * {@link DataInput#readShort()} method to read a <code>count</code> value,
 * and then it creates and returns a new <code>UID</code> instance
 * that contains the <code>unique</code>, <code>time</code>, and
 * <code>count</code> values that were read from the stream.
 *
 * @param   in the <code>DataInput</code> instance to read
 * <code>UID</code> from
 *
 * @return  unmarshalled <code>UID</code> instance
 *
 * @throws  IOException if an I/O error occurs while performing
 * this operation
 */
public static UID read(DataInput in) throws IOException {
    int unique = in.readInt();
    long time = in.readLong();
    short count = in.readShort();
    return new UID(unique, time, count);
}
 
源代码18 项目: JDKSourceCode1.8   文件: UID.java
/**
 * Constructs and returns a new <code>UID</code> instance by
 * unmarshalling a binary representation from an
 * <code>DataInput</code> instance.
 *
 * <p>Specifically, this method first invokes the given stream's
 * {@link DataInput#readInt()} method to read a <code>unique</code> value,
 * then it invoke's the stream's
 * {@link DataInput#readLong()} method to read a <code>time</code> value,
 * then it invoke's the stream's
 * {@link DataInput#readShort()} method to read a <code>count</code> value,
 * and then it creates and returns a new <code>UID</code> instance
 * that contains the <code>unique</code>, <code>time</code>, and
 * <code>count</code> values that were read from the stream.
 *
 * @param   in the <code>DataInput</code> instance to read
 * <code>UID</code> from
 *
 * @return  unmarshalled <code>UID</code> instance
 *
 * @throws  IOException if an I/O error occurs while performing
 * this operation
 */
public static UID read(DataInput in) throws IOException {
    int unique = in.readInt();
    long time = in.readLong();
    short count = in.readShort();
    return new UID(unique, time, count);
}
 
源代码19 项目: big-c   文件: Utils.java
/**
 * Construct the Version object by reading from the input stream.
 * 
 * @param in
 *          input stream
 * @throws IOException
 */
public Version(DataInput in) throws IOException {
  major = in.readShort();
  minor = in.readShort();
}
 
源代码20 项目: hadoop-gpu   文件: Utils.java
/**
 * Construct the Version object by reading from the input stream.
 * 
 * @param in
 *          input stream
 * @throws IOException
 */
public Version(DataInput in) throws IOException {
  major = in.readShort();
  minor = in.readShort();
}