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

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

源代码1 项目: stratosphere   文件: FileInputSplit.java
@Override
public void read(final DataInput in) throws IOException {
	// read partition number
	this.partitionNumber = in.readInt();

	// read file path
	boolean isNotNull = in.readBoolean();
	if (isNotNull) {
		this.file = new Path();
		this.file.read(in);
	}

	this.start = in.readLong();
	this.length = in.readLong();

	isNotNull = in.readBoolean();
	if (isNotNull) {
		final int numHosts = in.readInt();
		this.hosts = new String[numHosts];
		for (int i = 0; i < numHosts; i++) {
			this.hosts[i] = StringRecord.readString(in);
		}
	} else {
		this.hosts = null;
	}
}
 
源代码2 项目: gemfirexd-oss   文件: InitialImageOperation.java
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 {
    if (!isEagerDeserialize()) {
      this.value = DataSerializer.readByteArray(in);
    }
    else {
      this.value = DataSerializer.readObject(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);
  }
}
 
源代码3 项目: hadoop   文件: SnapshotFSImageFormat.java
public INodeReference.WithCount loadINodeReferenceWithCount(
    boolean isSnapshotINode, DataInput in, FSImageFormat.Loader loader
    ) throws IOException {
  final boolean firstReferred = in.readBoolean();

  final INodeReference.WithCount withCount;
  if (firstReferred) {
    final INode referred = loader.loadINodeWithLocalName(isSnapshotINode,
        in, true);
    withCount = new INodeReference.WithCount(null, referred);
    referenceMap.put(withCount.getId(), withCount);
  } else {
    final long id = in.readLong();
    withCount = referenceMap.get(id);
  }
  return withCount;
}
 
源代码4 项目: RDFS   文件: CombineFileSplit.java
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 in) throws IOException, ClassNotFoundException {
  super.fromData(in);
  if (hasVersionTag()) {
    this.versionTag = (VersionTag)DataSerializer.readObject(in);
  } else {
    this.timestamp = in.readLong();
  }
}
 
源代码6 项目: gemfirexd-oss   文件: InternalDataSerializer.java
/** read a set of Long objects */
public static List<Long> readListOfLongs(DataInput in) throws IOException {
  int size = in.readInt();
  if (size < 0) {
    return null;
  } else {
    List result = new LinkedList();
    boolean longIDs = in.readBoolean();
    for (int i=0; i<size; i++) {
      long l = longIDs? in.readLong() : in.readInt();
      result.add(Long.valueOf(l));
    }
    return result;
  }
}
 
源代码7 项目: big-c   文件: SnapshotFSImageFormat.java
private static FileDiff loadFileDiff(FileDiff posterior, DataInput in,
    FSImageFormat.Loader loader) throws IOException {
  // 1. Read the id of the Snapshot root to identify the Snapshot
  final Snapshot snapshot = loader.getSnapshot(in);

  // 2. Load file size
  final long fileSize = in.readLong();
  
  // 3. Load snapshotINode 
  final INodeFileAttributes snapshotINode = in.readBoolean()?
      loader.loadINodeFileAttributes(in): null;
  
  return new FileDiff(snapshot.getId(), snapshotINode, posterior, fileSize);
}
 
源代码8 项目: coming   文件: jMutRepair_0037_t.java
/**
 * Reads encoding generated by writeMillis.
 */
static long readMillis(DataInput in) throws IOException {
    int v = in.readUnsignedByte();
    switch (v >> 6) {
    case 0: default:
        // Form 00 (6 bits effective precision)
        v = (v << (32 - 6)) >> (32 - 6);
        return v * (30 * 60000L);

    case 1:
        // Form 01 (30 bits effective precision)
        v = (v << (32 - 6)) >> (32 - 30);
        v |= (in.readUnsignedByte()) << 16;
        v |= (in.readUnsignedByte()) << 8;
        v |= (in.readUnsignedByte());
        return v * 60000L;

    case 2:
        // Form 10 (38 bits effective precision)
        long w = (((long)v) << (64 - 6)) >> (64 - 38);
        w |= (in.readUnsignedByte()) << 24;
        w |= (in.readUnsignedByte()) << 16;
        w |= (in.readUnsignedByte()) << 8;
        w |= (in.readUnsignedByte());
        return w * 1000L;

    case 3:
        // Form 11 (64 bits effective precision)
        return in.readLong();
    }
}
 
源代码9 项目: coming   文件: JGenProg2017_0076_t.java
/**
 * Reads encoding generated by writeMillis.
 */
static long readMillis(DataInput in) throws IOException {
    int v = in.readUnsignedByte();
    switch (v >> 6) {
    case 0: default:
        // Form 00 (6 bits effective precision)
        v = (v << (32 - 6)) >> (32 - 6);
        return v * (30 * 60000L);

    case 1:
        // Form 01 (30 bits effective precision)
        v = (v << (32 - 6)) >> (32 - 30);
        v |= (in.readUnsignedByte()) << 16;
        v |= (in.readUnsignedByte()) << 8;
        v |= (in.readUnsignedByte());
        return v * 60000L;

    case 2:
        // Form 10 (38 bits effective precision)
        long w = (((long)v) << (64 - 6)) >> (64 - 38);
        w |= (in.readUnsignedByte()) << 24;
        w |= (in.readUnsignedByte()) << 16;
        w |= (in.readUnsignedByte()) << 8;
        w |= (in.readUnsignedByte());
        return w * 1000L;

    case 3:
        // Form 11 (64 bits effective precision)
        return in.readLong();
    }
}
 
源代码10 项目: jdk8u_jdk   文件: ZoneInfoFile.java
static long readEpochSec(DataInput in) throws IOException {
    int hiByte = in.readByte() & 255;
    if (hiByte == 255) {
        return in.readLong();
    } else {
        int midByte = in.readByte() & 255;
        int loByte = in.readByte() & 255;
        long tot = ((hiByte << 16) + (midByte << 8) + loByte);
        return (tot * 900) - 4575744000L;
    }
}
 
源代码11 项目: pravega   文件: WireCommands.java
public static WireCommand readFrom(DataInput in, int length) throws IOException {
    long requestId = in.readLong();
    int numberOfEntries = in.readInt();
    List<Long> updatedVersions = new ArrayList<>(numberOfEntries);
    for (int i = 0; i < numberOfEntries; i++) {
        updatedVersions.add(in.readLong());
    }
    return new TableEntriesUpdated(requestId, updatedVersions);
}
 
源代码12 项目: systemds   文件: TensorIndexes.java
@Override
public void readFields(DataInput in)
		throws IOException {
	_ix = new long[in.readInt()];
	for (int i = 0; i < _ix.length; i++) {
		_ix[i] = in.readLong();
	}
}
 
源代码13 项目: TencentKona-8   文件: ZoneInfoFile.java
static long readEpochSec(DataInput in) throws IOException {
    int hiByte = in.readByte() & 255;
    if (hiByte == 255) {
        return in.readLong();
    } else {
        int midByte = in.readByte() & 255;
        int loByte = in.readByte() & 255;
        long tot = ((hiByte << 16) + (midByte << 8) + loByte);
        return (tot * 900) - 4575744000L;
    }
}
 
源代码14 项目: pravega   文件: WireCommands.java
public static WireCommand readFrom(DataInput in, int length) throws IOException {
    long requestId = in.readLong();
    String segment = in.readUTF();
    UUID attributeId = new UUID(in.readLong(), in.readLong());
    long newValue = in.readLong();
    long excpecteValue = in.readLong();
    String delegationToken = in.readUTF();
    return new UpdateSegmentAttribute(requestId, segment, attributeId, newValue, excpecteValue, delegationToken);
}
 
源代码15 项目: coming   文件: Nopol2015_0010_s.java
/**
 * Reads encoding generated by writeMillis.
 */
static long readMillis(DataInput in) throws IOException {
    int v = in.readUnsignedByte();
    switch (v >> 6) {
    case 0: default:
        // Form 00 (6 bits effective precision)
        v = (v << (32 - 6)) >> (32 - 6);
        return v * (30 * 60000L);

    case 1:
        // Form 01 (30 bits effective precision)
        v = (v << (32 - 6)) >> (32 - 30);
        v |= (in.readUnsignedByte()) << 16;
        v |= (in.readUnsignedByte()) << 8;
        v |= (in.readUnsignedByte());
        return v * 60000L;

    case 2:
        // Form 10 (38 bits effective precision)
        long w = (((long)v) << (64 - 6)) >> (64 - 38);
        w |= (in.readUnsignedByte()) << 24;
        w |= (in.readUnsignedByte()) << 16;
        w |= (in.readUnsignedByte()) << 8;
        w |= (in.readUnsignedByte());
        return w * 1000L;

    case 3:
        // Form 11 (64 bits effective precision)
        return in.readLong();
    }
}
 
源代码16 项目: marklogic-contentpump   文件: ForestDocument.java
@Override
public void readFields(DataInput in) throws IOException {
    fragmentOrdinal = in.readLong();
    collections = WritableUtils.readStringArray(in);
    int numMetadata = in.readInt();
    if (numMetadata > 0) {
        String[] metaStrings = WritableUtils.readStringArray(in);
        metadata = new HashMap<String, String>(numMetadata);
        for (int i = 0; i < metaStrings.length - 1; i++) {
            metadata.put(metaStrings[i], metaStrings[i + 1]);
        }
    }
    quality = in.readInt();
}
 
源代码17 项目: aerospike-hadoop   文件: GenerateProfiles.java
public void readFields(DataInput in) throws IOException {
    userid = in.readLong();
    age = in.readInt();
    isMale = in.readInt();
}
 
源代码18 项目: stratio-cassandra   文件: UUIDSerializer.java
public UUID deserialize(DataInput in, int version) throws IOException
{
    return new UUID(in.readLong(), in.readLong());
}
 
源代码19 项目: deeplearning4j   文件: LongWritable.java
public void readFields(DataInput in) throws IOException {
    value = in.readLong();
}
 
源代码20 项目: TencentKona-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);
}