java.io.ObjectInput#readUnsignedByte ( )源码实例Demo

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

源代码1 项目: gemfirexd-oss   文件: BinaryDecimal.java
/** 
 * Note the use of data2c: we reuse the array if the
 * incoming array is the same length or smaller than
 * the array length.  
 * 
 * @see java.io.Externalizable#readExternal 
 */
public void readExternal(ObjectInput in) throws IOException 
{
	sqlScale = in.readUnsignedByte();
	int size = in.readUnsignedByte();

	/*
	** Allocate a new array if the data to read
	** is larger than the existing array, or if
	** we don't have an array yet.

       Need to use readFully below and NOT just read because read does not
       guarantee getting size bytes back, whereas readFully does (unless EOF).
       */
	if ((data2c == null) || size != data2c.length)
	{
		data2c = new byte[size];
	}
	in.readFully(data2c);

}
 
源代码2 项目: gemfirexd-oss   文件: BinaryDecimal.java
/** 
 * Note the use of data2c: we reuse the array if the
 * incoming array is the same length or smaller than
 * the array length.  
 * 
 * @see java.io.Externalizable#readExternal 
 */
public void readExternal(ObjectInput in) throws IOException 
{
	sqlScale = in.readUnsignedByte();
	int size = in.readUnsignedByte();

	/*
	** Allocate a new array if the data to read
	** is larger than the existing array, or if
	** we don't have an array yet.

       Need to use readFully below and NOT just read because read does not
       guarantee getting size bytes back, whereas readFully does (unless EOF).
       */
	if ((data2c == null) || size != data2c.length)
	{
		data2c = new byte[size];
	}
	in.readFully(data2c);

}
 
源代码3 项目: ignite   文件: GridDhtPartitionMap.java
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    nodeId = U.readUuid(in);

    updateSeq = in.readLong();

    int size = in.readInt();

    map = new GridPartitionStateMap();

    for (int i = 0; i < size; i++) {
        int ordinal = in.readUnsignedByte();
        int part = in.readUnsignedShort();

        put(part, GridDhtPartitionState.fromOrdinal(ordinal));
    }

    long ver = in.readLong();
    int minorVer = in.readInt();

    if (ver != 0)
        top = new AffinityTopologyVersion(ver, minorVer);
}
 
源代码4 项目: flex-blazeds   文件: AbstractMessage.java
/**
 *
 * To support efficient serialization for SmallMessage implementations,
 * this utility method reads in the property flags from an ObjectInput
 * stream. Flags are read in one byte at a time. Flags make use of
 * sign-extension so that if the high-bit is set to 1 this indicates that
 * another set of flags follows.
 * 
 * @return The array of property flags. 
 */
protected short[] readFlags(ObjectInput input) throws IOException
{
    boolean hasNextFlag = true;
    short[] flagsArray = new short[2];
    int i = 0;

    while (hasNextFlag)
    {
        short flags = (short)input.readUnsignedByte();
        if (i == flagsArray.length)
        {
            short[] tempArray = new short[i*2];
            System.arraycopy(flagsArray, 0, tempArray, 0, flagsArray.length);
            flagsArray = tempArray;
        }

        flagsArray[i] = flags;

        hasNextFlag = (flags & HAS_NEXT_FLAG) != 0;

        i++;
    }

    return flagsArray;
}
 
源代码5 项目: spliceengine   文件: BinaryDecimal.java
/** 
 * Note the use of data2c: we reuse the array if the
 * incoming array is the same length or smaller than
 * the array length.  
 * 
 * @see java.io.Externalizable#readExternal 
 */
public void readExternal(ObjectInput in) throws IOException 
{
	sqlScale = in.readUnsignedByte();
	int size = in.readUnsignedByte();

	/*
	** Allocate a new array if the data to read
	** is larger than the existing array, or if
	** we don't have an array yet.

       Need to use readFully below and NOT just read because read does not
       guarantee getting size bytes back, whereas readFully does (unless EOF).
       */
	if ((data2c == null) || size != data2c.length)
	{
		data2c = new byte[size];
	}
	in.readFully(data2c);
	isNull = evaluateNull();

}
 
源代码6 项目: gemfirexd-oss   文件: ChecksumOperation.java
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
	checksumAlgo = (byte) in.readUnsignedByte();
	dataLength = in.readInt();
	checksumValue = in.readLong();
	initializeChecksumAlgo();
}
 
源代码7 项目: gemfirexd-oss   文件: ChecksumOperation.java
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
	checksumAlgo = (byte) in.readUnsignedByte();
	dataLength = in.readInt();
	checksumValue = in.readLong();
	initializeChecksumAlgo();
}
 
源代码8 项目: spliceengine   文件: ProjectRestrictOperation.java
@Override
public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
		super.readExternal(in);
		restrictionMethodName = readNullableString(in);
		projectionMethodName = readNullableString(in);
		constantRestrictionMethodName = readNullableString(in);
		mapRefItem = in.readInt();
		cloneMapItem = in.readInt();
		int version = in.readUnsignedByte();
		if (version < PROJECT_RESTRICT_OPERATION_V2)
		    reuseResult = (version == 1);
		else
		    reuseResult = in.readBoolean();
		doesProjection = in.readBoolean();
		source = (SpliceOperation) in.readObject();
		if (version >= PROJECT_RESTRICT_OPERATION_V2) {
		    filterPred = readNullableString(in);
		    int numexpressions = in.readInt();
		    if (numexpressions > 0) {
		        expressions = new String[numexpressions];
		        for (int i = 0; i < numexpressions; i++) {
		            expressions[i] = readNullableString(in);
		        }
		    }
		    hasGroupingFunction = in.readBoolean();
		}
		subqueryText = readNullableString(in);
}
 
源代码9 项目: spliceengine   文件: SQLDecimal.java
/**
 * Note the use of rawData: we reuse the array if the
 * incoming array is the same length or smaller than
 * the array length.
 *
 * @see java.io.Externalizable#readExternal
 */
public void readExternal(ObjectInput in) throws IOException {

       if (in.readBoolean()) {
           setCoreValue(null);
           return;
       }

	// clear the previous value to ensure that the
	// rawData value will be used
	value = null;

	rawScale = in.readUnsignedByte();
	int size = in.readUnsignedByte();

	/*
	** Allocate a new array if the data to read
	** is larger than the existing array, or if
	** we don't have an array yet.

       Need to use readFully below and NOT just read because read does not
       guarantee getting size bytes back, whereas readFully does (unless EOF).
       */
	if ((rawData == null) || size != rawData.length)
	{
		rawData = new byte[size];
	}
	in.readFully(rawData);
	isNull = evaluateNull();

}
 
源代码10 项目: gemfirexd-oss   文件: InternalDistributedMember.java
/**
 * For Externalizable
 *
 * @see Externalizable
 */
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
  // do it the way we like
  int len = in.readInt(); // IPv6 compatible
  byte addr[] = new byte[len];
  in.readFully(addr);
  InetAddress inetAddr = InetAddress.getByAddress(addr);
  int port = in.readInt();
  
  this.hostName = DataSerializer.readString(in);

  int flags = in.readUnsignedByte();
  boolean sbEnabled = (flags & SB_ENABLED_MASK) != 0;
  boolean elCoord = (flags & COORD_ENABLED_MASK) != 0;
  this.isPartial = (flags & PARTIAL_ID_MASK) != 0;
  
  this.dcPort = in.readInt();
  this.vmPid = in.readInt();
  this.vmKind = in.readInt();
  this.vmViewId = in.readInt();
  this.groups = DataSerializer.readStringArray(in);

  this.name = DataSerializer.readString(in);
  this.uniqueTag = DataSerializer.readString(in);
  String durableId = DataSerializer.readString(in);
  int durableTimeout = DataSerializer.readInteger(in).intValue();
  this.durableClientAttributes = new DurableClientAttributes(durableId, durableTimeout);

  readVersion(flags, in);

  ipAddr = MemberFactory.newNetMember(inetAddr, port, sbEnabled, elCoord,
      new MemberAttributes(dcPort, vmPid, vmKind, vmViewId, name, groups, durableClientAttributes));
  ((JGroupMember)ipAddr).getAddress().setVersionOrdinal(this.version);

  Assert.assertTrue(this.vmKind > 0);
  // [sumedh] loner VMs will have port as zero if no GFE client is connected
  // e.g. with GFXD clients
  Assert.assertTrue(vmKind == DistributionManager.LONER_DM_TYPE
      || getPort() > 0);
}
 
源代码11 项目: gemfirexd-oss   文件: InternalDistributedMember.java
/**
 * For Externalizable
 *
 * @see Externalizable
 */
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
  // do it the way we like
  int len = in.readInt(); // IPv6 compatible
  byte addr[] = new byte[len];
  in.readFully(addr);
  InetAddress inetAddr = InetAddress.getByAddress(addr);
  int port = in.readInt();
  
  this.hostName = DataSerializer.readString(in);

  int flags = in.readUnsignedByte();
  boolean sbEnabled = (flags & SB_ENABLED_MASK) != 0;
  boolean elCoord = (flags & COORD_ENABLED_MASK) != 0;
  this.isPartial = (flags & PARTIAL_ID_MASK) != 0;
  
  this.dcPort = in.readInt();
  this.vmPid = in.readInt();
  this.vmKind = in.readInt();
  this.vmViewId = in.readInt();
  this.groups = DataSerializer.readStringArray(in);

  this.name = DataSerializer.readString(in);
  this.uniqueTag = DataSerializer.readString(in);
  String durableId = DataSerializer.readString(in);
  int durableTimeout = DataSerializer.readInteger(in).intValue();
  this.durableClientAttributes = new DurableClientAttributes(durableId, durableTimeout);

  readVersion(flags, in);

  ipAddr = MemberFactory.newNetMember(inetAddr, port, sbEnabled, elCoord,
      new MemberAttributes(dcPort, vmPid, vmKind, vmViewId, name, groups, durableClientAttributes));
  ((JGroupMember)ipAddr).getAddress().setVersionOrdinal(this.version);

  Assert.assertTrue(this.vmKind > 0);
  // [sumedh] loner VMs will have port as zero if no GFE client is connected
  // e.g. with GFXD clients
  Assert.assertTrue(vmKind == DistributionManager.LONER_DM_TYPE
      || getPort() > 0);
}