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

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

源代码1 项目: stratosphere   文件: StringRecord.java
/**
 * Read a UTF8 encoded string from in
 */
public static String readString(final DataInput in) throws IOException {

	if (in.readBoolean()) {
		final int length = in.readInt();
		if (length < 0) {
			throw new IOException("length of StringRecord is " + length);
		}

		final byte[] bytes = new byte[length];
		in.readFully(bytes, 0, length);
		return decode(bytes);
	}

	return null;
}
 
源代码2 项目: stratosphere   文件: LocatableInputSplit.java
@Override
public void read(final DataInput in) throws IOException {

	// Read the split number
	this.splitNumber = in.readInt();

	// Read hostnames
	if (in.readBoolean()) {
		final int numHosts = in.readInt();
		this.hostnames = new String[numHosts];
		for (int i = 0; i < numHosts; i++) {
			this.hostnames[i] = StringRecord.readString(in);
		}
	} else {
		this.hostnames = null;
	}
}
 
源代码3 项目: stratosphere   文件: Path.java
@Override
public void read(DataInput in) throws IOException {

	final boolean isNotNull = in.readBoolean();
	if (isNotNull) {
		final String scheme = StringRecord.readString(in);
		final String userInfo = StringRecord.readString(in);
		final String host = StringRecord.readString(in);
		final int port = in.readInt();
		final String path = StringRecord.readString(in);
		final String query = StringRecord.readString(in);
		final String fragment = StringRecord.readString(in);

		try {
			uri = new URI(scheme, userInfo, host, port, path, query, fragment);
		} catch (URISyntaxException e) {
			throw new IOException("Error reconstructing URI: " + StringUtils.stringifyException(e));
		}

	}
}
 
源代码4 项目: gemfirexd-oss   文件: ManageBackupBucketMessage.java
@Override
public void fromData(DataInput in)
  throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.acceptedBucket = in.readBoolean();
  this.notYetInitialized = in.readBoolean();
}
 
源代码5 项目: util   文件: BooleanArraySerializer.java
@Override
public boolean[] read(DataInput in) throws IOException {
    final int length = lengthSerializer.read(in);
    final boolean[] values = new boolean[length];
    for (int i = 0; i < values.length; i++) {
        values[i] = in.readBoolean();
    }
    return values;
}
 
源代码6 项目: coming   文件: Elixir_0038_s.java
static OfYear readFrom(DataInput in) throws IOException {
    return new OfYear((char)in.readUnsignedByte(),
                      (int)in.readUnsignedByte(),
                      (int)in.readByte(),
                      (int)in.readUnsignedByte(),
                      in.readBoolean(),
                      (int)readMillis(in));
}
 
源代码7 项目: coming   文件: JGenProg2017_0042_s.java
static OfYear readFrom(DataInput in) throws IOException {
    return new OfYear((char)in.readUnsignedByte(),
                      (int)in.readUnsignedByte(),
                      (int)in.readByte(),
                      (int)in.readUnsignedByte(),
                      in.readBoolean(),
                      (int)readMillis(in));
}
 
源代码8 项目: coming   文件: Cardumen_0069_t.java
static PrecalculatedZone readFrom(DataInput in, String id) throws IOException {
    // Read string pool.
    int poolSize = in.readUnsignedShort();
    String[] pool = new String[poolSize];
    for (int i=0; i<poolSize; i++) {
        pool[i] = in.readUTF();
    }

    int size = in.readInt();
    long[] transitions = new long[size];
    int[] wallOffsets = new int[size];
    int[] standardOffsets = new int[size];
    String[] nameKeys = new String[size];
    
    for (int i=0; i<size; i++) {
        transitions[i] = readMillis(in);
        wallOffsets[i] = (int)readMillis(in);
        standardOffsets[i] = (int)readMillis(in);
        try {
            int index;
            if (poolSize < 256) {
                index = in.readUnsignedByte();
            } else {
                index = in.readUnsignedShort();
            }
            nameKeys[i] = pool[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new IOException("Invalid encoding");
        }
    }

    DSTZone tailZone = null;
    if (in.readBoolean()) {
        tailZone = DSTZone.readFrom(in, id);
    }

    return new PrecalculatedZone
        (id, transitions, wallOffsets, standardOffsets, nameKeys, tailZone);
}
 
源代码9 项目: coming   文件: JGenProg2017_0042_s.java
static PrecalculatedZone readFrom(DataInput in, String id) throws IOException {
    // Read string pool.
    int poolSize = in.readUnsignedShort();
    String[] pool = new String[poolSize];
    for (int i=0; i<poolSize; i++) {
        pool[i] = in.readUTF();
    }

    int size = in.readInt();
    long[] transitions = new long[size];
    int[] wallOffsets = new int[size];
    int[] standardOffsets = new int[size];
    String[] nameKeys = new String[size];
    
    for (int i=0; i<size; i++) {
        transitions[i] = readMillis(in);
        wallOffsets[i] = (int)readMillis(in);
        standardOffsets[i] = (int)readMillis(in);
        try {
            int index;
            if (poolSize < 256) {
                index = in.readUnsignedByte();
            } else {
                index = in.readUnsignedShort();
            }
            nameKeys[i] = pool[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new IOException("Invalid encoding");
        }
    }

    DSTZone tailZone = null;
    if (in.readBoolean()) {
        tailZone = DSTZone.readFrom(in, id);
    }

    return new PrecalculatedZone
        (id, transitions, wallOffsets, standardOffsets, nameKeys, tailZone);
}
 
源代码10 项目: gemfirexd-oss   文件: ManageBucketMessage.java
@Override  
public void fromData(DataInput in)
  throws IOException, ClassNotFoundException {
  super.fromData(in);
  this.acceptedBucket = in.readBoolean();
  this.notYetInitialized = in.readBoolean();
}
 
源代码11 项目: 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;
  }
}
 
源代码12 项目: gemfirexd-oss   文件: CreateRegionProcessor.java
@Override
public void fromData(DataInput in)
throws IOException, ClassNotFoundException {
  super.fromData(in);
  if (in.readBoolean()) {
    // this.profile = new CacheProfile();
    // this.profile.fromData(in);
    this.profile = (CacheProfile) DataSerializer.readObject(in);
  }
  int size = in.readInt();
  if (size == 0) {
    this.bucketProfiles = null;
  }
  else {
    this.bucketProfiles = new ArrayList(size);
    for (int i=0; i < size; i++) {
      RegionAdvisor.BucketProfileAndId bp =
        new RegionAdvisor.BucketProfileAndId();
      InternalDataSerializer.invokeFromData(bp, in);
      this.bucketProfiles.add(bp);
    }
  }
  if (in.readBoolean()) {
    this.eventState = EventStateHelper.fromData(in, false);
  }
  if(in.readBoolean()) {
    this.destroyedId = new PersistentMemberID();
    InternalDataSerializer.invokeFromData(this.destroyedId, in);
  }
  this.skippedCompatibilityChecks = in.readBoolean();
  this.hasActiveTransaction = in.readBoolean();
  this.seqKeyForWan = in.readLong();
}
 
public void fromDelta(DataInput in) throws IOException,
    InvalidDeltaException {
  boolean nameC = in.readBoolean();
  if (nameC) {
    this.name = in.readUTF();
  }
  boolean addressC = in.readBoolean();
  if (addressC) {
    this.address = in.readUTF();
  }
}
 
源代码14 项目: gemfirexd-oss   文件: RemoteBridgeServer.java
public void fromData(DataInput in)
  throws IOException, ClassNotFoundException {
 
  this.port = in.readInt();
  this.notifyBySubscription = in.readBoolean();
  this.isRunning = in.readBoolean();
  this.maxConnections = in.readInt();
  this.id = in.readInt();
  this.maximumTimeBetweenPings = in .readInt();
  this.maximumMessageCount = in.readInt();
  this.messageTimeToLive = in.readInt();
  this.maxThreads = in.readInt();
  setBindAddress(DataSerializer.readString(in));
  setGroups(DataSerializer.readStringArray(in));
  setHostnameForClients(DataSerializer.readString(in));
  setLoadProbe((ServerLoadProbe)DataSerializer.readObject(in));
  setLoadPollInterval(DataSerializer.readPrimitiveLong(in));
  this.socketBufferSize = in.readInt();
  if (InternalDataSerializer.getVersionForDataStream(in).compareTo(Version.GFXD_14) >= 0) {
    this.tcpNoDelay = in.readBoolean();
  }
  this.getClientSubscriptionConfig().setCapacity(in.readInt());
  this.getClientSubscriptionConfig().setEvictionPolicy(
      DataSerializer.readString(in));
  String diskStoreName = DataSerializer.readString(in);
  if (diskStoreName != null) {
    this.getClientSubscriptionConfig().setDiskStoreName(diskStoreName);
  } else {
    this.getClientSubscriptionConfig().setOverflowDirectory(
        DataSerializer.readString(in));
  }
}
 
源代码15 项目: stratio-cassandra   文件: NamesQueryFilter.java
public NamesQueryFilter deserialize(DataInput in, int version) throws IOException
{
    int size = in.readInt();
    SortedSet<CellName> columns = new TreeSet<CellName>(type);
    ISerializer<CellName> serializer = type.cellSerializer();
    for (int i = 0; i < size; ++i)
        columns.add(serializer.deserialize(in));
    boolean countCQL3Rows = in.readBoolean();
    return new NamesQueryFilter(columns, countCQL3Rows);
}
 
源代码16 项目: coming   文件: jMutRepair_0029_t.java
static OfYear readFrom(DataInput in) throws IOException {
    return new OfYear((char)in.readUnsignedByte(),
                      (int)in.readUnsignedByte(),
                      (int)in.readByte(),
                      (int)in.readUnsignedByte(),
                      in.readBoolean(),
                      (int)readMillis(in));
}
 
源代码17 项目: hbase   文件: Reference.java
/**
 * @deprecated Writables are going away. Use the pb serialization methods instead.
 * Remove in a release after 0.96 goes out.  This is here only to migrate
 * old Reference files written with Writables before 0.96.
 */
@Deprecated
public void readFields(DataInput in) throws IOException {
  boolean tmp = in.readBoolean();
  // If true, set region to top.
  this.region = tmp? Range.top: Range.bottom;
  this.splitkey = Bytes.readByteArray(in);
}
 
源代码18 项目: rya   文件: Fact.java
@Override
public void readFields(final DataInput in) throws IOException {
    derivation = null;
    final int tripleLength = in.readInt();
    if (tripleLength == 0) {
        triple = null;
    }
    else {
        final byte[] tripleBytes = new byte[tripleLength];
        in.readFully(tripleBytes);
        final String tripleString = new String(tripleBytes, StandardCharsets.UTF_8);
        final String[] parts = tripleString.split(SEP);
        final ValueFactory factory = SimpleValueFactory.getInstance();
        final String context = parts[0];
        Resource s = null;
        final IRI p = factory.createIRI(parts[2]);
        Value o = null;
        // Subject: either bnode or URI
        if (parts[1].startsWith("_")) {
            s = factory.createBNode(parts[1].substring(2));
        }
        else {
            s = factory.createIRI(parts[1]);
        }
        // Object: literal, bnode, or URI
        if (parts[3].startsWith("_")) {
            o = factory.createBNode(parts[3].substring(2));
        }
        else if (parts[3].startsWith("\"")) {
            //literal: may have language or datatype
            final int close = parts[3].lastIndexOf("\"");
            final int length = parts[3].length();
            final String label = parts[3].substring(1, close);
            if (close == length - 1) {
                // Just a string enclosed in quotes
                o = factory.createLiteral(label);
            }
            else {
                final String data = parts[3].substring(close + 1);
                if (data.startsWith(LiteralLanguageUtils.LANGUAGE_DELIMITER)) {
                    final String lang = data.substring(1);
                    o = factory.createLiteral(label, lang);
                }
                else if (data.startsWith("^^<")) {
                    o = factory.createLiteral(label, factory.createIRI(
                        data.substring(3, data.length() - 1)));
                }
            }
        }
        else {
            o = factory.createIRI(parts[3]);
        }
        // Create a statement with or without context
        if (context.isEmpty()) {
            triple = VF.createStatement(s, p, o);
        }
        else {
            triple = VF.createStatement(s, p, o, factory.createIRI(context));
        }
    }
    useful = in.readBoolean();
    if (in.readBoolean()) {
        derivation = new Derivation();
        derivation.readFields(in);
    }
}
 
源代码19 项目: gemfirexd-oss   文件: RemoteRegionAttributes.java
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.cacheLoaderDesc = DataSerializer.readString(in);
  this.cacheWriterDesc = DataSerializer.readString(in);
  this.cacheListenerDescs = DataSerializer.readStringArray(in);
  this.capacityControllerDesc = DataSerializer.readString(in);
  this.keyConstraint = (Class) DataSerializer.readObject(in);
  this.valueConstraint = (Class) DataSerializer.readObject(in);
  this.rTtl = (ExpirationAttributes) DataSerializer.readObject(in);
  this.rIdleTimeout = (ExpirationAttributes) DataSerializer.readObject(in);
  this.eTtl = (ExpirationAttributes) DataSerializer.readObject(in);
  this.customEttlDesc = DataSerializer.readString(in);
  this.eIdleTimeout = (ExpirationAttributes) DataSerializer.readObject(in);
  this.customEIdleDesc = DataSerializer.readString(in);
  this.dataPolicy = (DataPolicy) DataSerializer.readObject(in);
  this.scope = (Scope) DataSerializer.readObject(in);
  this.statsEnabled = in.readBoolean();
  this.ignoreJTA = in.readBoolean();
  this.concurrencyLevel = in.readInt();
  this.loadFactor = in.readFloat();
  this.initialCapacity = in.readInt();
  this.earlyAck = in.readBoolean();
  this.multicastEnabled = in.readBoolean();
  this.enableGateway = in.readBoolean();
  this.gatewayHubId = DataSerializer.readString(in);
  this.enableSubscriptionConflation = in.readBoolean();
  this.publisher = in.readBoolean();
  this.enableAsyncConflation = in.readBoolean();

  this.diskWriteAttributes = (DiskWriteAttributes) DataSerializer.readObject(in);
  this.diskDirs = (File[]) DataSerializer.readObject(in);
  this.diskSizes = (int[] )DataSerializer.readObject(in);
  this.indexMaintenanceSynchronous = in.readBoolean();
  this.partitionAttributes = (PartitionAttributes) DataSerializer
  .readObject(in);
  this.membershipAttributes = (MembershipAttributes) DataSerializer
      .readObject(in);
  this.subscriptionAttributes = (SubscriptionAttributes) DataSerializer
      .readObject(in);
  this.evictionAttributes = (EvictionAttributesImpl) DataSerializer.readObject(in);
  this.cloningEnable = in.readBoolean();
  this.diskStoreName = DataSerializer.readString(in);
  this.isDiskSynchronous = in.readBoolean();
  this.gatewaySendersDescs = DataSerializer.readStringArray(in);
  this.isGatewaySenderEnabled = in.readBoolean();
  this.concurrencyChecksEnabled = in.readBoolean();
  this.hdfsStoreName = DataSerializer.readString(in);
  this.compressorDesc = DataSerializer.readString(in);
  this.enableOffHeapMemory = in.readBoolean();
}
 
源代码20 项目: DataVec   文件: BooleanWritable.java
/**
 */
public void readFields(DataInput in) throws IOException {
    value = in.readBoolean();
}