java.io.DataInputStream.readBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(217)

本文整理了Java中java.io.DataInputStream.readBoolean()方法的一些代码示例,展示了DataInputStream.readBoolean()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataInputStream.readBoolean()方法的具体详情如下:
包路径:java.io.DataInputStream
类名称:DataInputStream
方法名:readBoolean

DataInputStream.readBoolean介绍

[英]See the general contract of the readBoolean method of DataInput.

Bytes for this operation are read from the contained input stream.
[中]参见readBoolean方法DataInput的总合同。
此操作的字节从包含的输入流中读取。

代码示例

代码示例来源:origin: apache/nifi

private String readNullableString(final DataInputStream in) throws IOException {
  final boolean valueExists = in.readBoolean();
  if (valueExists) {
    return in.readUTF();
  } else {
    return null;
  }
}

代码示例来源:origin: google/ExoPlayer

@Override
 public ProgressiveDownloadAction readFromStream(int version, DataInputStream input)
   throws IOException {
  Uri uri = Uri.parse(input.readUTF());
  boolean isRemoveAction = input.readBoolean();
  int dataLength = input.readInt();
  byte[] data = new byte[dataLength];
  input.readFully(data);
  String customCacheKey = input.readBoolean() ? input.readUTF() : null;
  return new ProgressiveDownloadAction(uri, isRemoveAction, data, customCacheKey);
 }
};

代码示例来源:origin: stackoverflow.com

File file = new File("C:/text.bin");
DataInputStream stream = new DataInputStream(new FileInputStream(file));
boolean isTrue = stream.readBoolean();
int value = stream.readInt();
stream.close();
System.out.printlin(isTrue + " " + value);

代码示例来源:origin: apache/nifi

@Override
  public Boolean execute(final CommsSession session) throws IOException {
    final DataOutputStream dos = new DataOutputStream(session.getOutputStream());
    dos.writeUTF("putIfAbsent");
    serialize(key, keySerializer, dos);
    serialize(value, valueSerializer, dos);
    dos.flush();
    final DataInputStream dis = new DataInputStream(session.getInputStream());
    return dis.readBoolean();
  }
});

代码示例来源:origin: apache/hive

IOException {
DataInputStream in = new DataInputStream(new ByteBufferBackedInputStream(payload));
try {
 String columnName = in.readUTF();
  boolean skip = in.readBoolean();
  if (skip) {
   info.skipPruning.set(true);

代码示例来源:origin: apache/nifi

private StateMap deserialize(final byte[] data, final int recordVersion, final String componentId) throws IOException {
  try (final ByteArrayInputStream bais = new ByteArrayInputStream(data);
     final DataInputStream dis = new DataInputStream(bais)) {
    final byte encodingVersion = dis.readByte();
    if (encodingVersion > ENCODING_VERSION) {
      throw new IOException("Retrieved a response from ZooKeeper when retrieving state for component with ID " + componentId
        + ", but the response was encoded using the ZooKeeperStateProvider Encoding Version of " + encodingVersion
        + " but this instance can only decode versions up to " + ENCODING_VERSION
        + "; it appears that the state was encoded using a newer version of NiFi than is currently running. This information cannot be decoded.");
    }
    final int numEntries = dis.readInt();
    final Map<String, String> stateValues = new HashMap<>(numEntries);
    for (int i = 0; i < numEntries; i++) {
      final boolean hasKey = dis.readBoolean();
      final String key = hasKey ? dis.readUTF() : null;
      final boolean hasValue = dis.readBoolean();
      final String value = hasValue ? dis.readUTF() : null;
      stateValues.put(key, value);
    }
    return new StandardStateMap(stateValues, recordVersion);
  }
}

代码示例来源:origin: marytts/marytts

useJampackInAnalysis = dis.readBoolean();
isSilentAnalysis = dis.readBoolean();
harmonicModel = dis.readInt();
noiseModel = dis.readInt();
useHarmonicAmplitudesDirectly = dis.readBoolean();
regularizedCepstrumLambdaHarmonic = dis.readFloat();
useWeightingInRegularizedCepstrumEstimationHarmonic = dis.readBoolean();
harmonicPartCepstrumOrderPreMel = dis.readInt();
harmonicPartCepstrumOrder = dis.readInt();
computeNoisePartLpOrderFromSamplingRate = dis.readBoolean();
noisePartLpOrder = dis.readInt();
preemphasisCoefNoise = dis.readFloat();
hpfBeforeNoiseAnalysis = dis.readBoolean();
decimateNoiseWaveform = dis.readBoolean();
overlapNoiseWaveformModel = dis.readBoolean();
useNoiseAmplitudesDirectly = dis.readBoolean();
regularizedCepstrumEstimationLambdaNoise = dis.readFloat();
useWeightingInRegularizedCesptrumEstimationNoise = dis.readBoolean();
noisePartCepstrumOderPre = dis.readInt();
noisePartCepstrumOrder = dis.readInt();
usePosteriorMelWarpingNoise = dis.readBoolean();

代码示例来源:origin: apache/nifi

@Override
  public Boolean execute(final CommsSession session) throws IOException {
    final DataOutputStream dos = new DataOutputStream(session.getOutputStream());
    dos.writeUTF("containsKey");
    serialize(key, keySerializer, dos);
    dos.flush();
    final DataInputStream dis = new DataInputStream(session.getInputStream());
    return dis.readBoolean();
  }
});

代码示例来源:origin: libgdx/libgdx

if (listener != null) listener.onConnected();
DataInputStream in = new DataInputStream(socket.getInputStream());
multiTouch = in.readBoolean();
while (true) {
  int event = in.readInt();
  KeyEvent keyEvent = null;
  TouchEvent touchEvent = null;
  case RemoteSender.KEY_DOWN:
    keyEvent = new KeyEvent();
    keyEvent.keyCode = in.readInt();
    keyEvent.type = KeyEvent.KEY_DOWN;
    break;
  case RemoteSender.KEY_UP:
    keyEvent = new KeyEvent();
    keyEvent.keyCode = in.readInt();
    keyEvent.type = KeyEvent.KEY_UP;
    break;

代码示例来源:origin: google/ExoPlayer

@Override
public final DownloadAction readFromStream(int version, DataInputStream input)
  throws IOException {
 Uri uri = Uri.parse(input.readUTF());
 boolean isRemoveAction = input.readBoolean();
 int dataLength = input.readInt();
 byte[] data = new byte[dataLength];
 input.readFully(data);
 int keyCount = input.readInt();
 List<StreamKey> keys = new ArrayList<>();
 for (int i = 0; i < keyCount; i++) {
  keys.add(readKey(version, input));
 }
 return createDownloadAction(uri, isRemoveAction, data, keys);
}

代码示例来源:origin: apache/drill

IOException {
DataInputStream in = new DataInputStream(new ByteBufferBackedInputStream(payload));
try {
 String columnName = in.readUTF();
  boolean skip = in.readBoolean();
  if (skip) {
   info.skipPruning.set(true);

代码示例来源:origin: apache/hive

try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(decoded))) {
 String databaseName = in.readUTF();
 String tableName = in.readUTF();
 boolean createPartitions = in.readBoolean();
 long writeId = in.readLong();
 TableType tableType = TableType.valueOf(in.readByte());
 int thriftLength = in.readInt();

代码示例来源:origin: marytts/marytts

useJampackInAnalysis = dis.readBoolean();
isSilentAnalysis = dis.readBoolean();
harmonicModel = dis.readInt();
noiseModel = dis.readInt();
useHarmonicAmplitudesDirectly = dis.readBoolean();
regularizedCepstrumLambdaHarmonic = dis.readFloat();
useWeightingInRegularizedCepstrumEstimationHarmonic = dis.readBoolean();
harmonicPartCepstrumOrderPreMel = dis.readInt();
harmonicPartCepstrumOrder = dis.readInt();
computeNoisePartLpOrderFromSamplingRate = dis.readBoolean();
noisePartLpOrder = dis.readInt();
preemphasisCoefNoise = dis.readFloat();
hpfBeforeNoiseAnalysis = dis.readBoolean();
decimateNoiseWaveform = dis.readBoolean();
overlapNoiseWaveformModel = dis.readBoolean();
useNoiseAmplitudesDirectly = dis.readBoolean();
regularizedCepstrumEstimationLambdaNoise = dis.readFloat();
useWeightingInRegularizedCesptrumEstimationNoise = dis.readBoolean();
noisePartCepstrumOderPre = dis.readInt();
noisePartCepstrumOrder = dis.readInt();
usePosteriorMelWarpingNoise = dis.readBoolean();

代码示例来源:origin: apache/activemq

return this.dataIn.readBoolean();
return Boolean.valueOf(this.dataIn.readUTF()).booleanValue();

代码示例来源:origin: apache/nifi

@Override
  public Boolean execute(final CommsSession session) throws IOException {
    final DataOutputStream dos = new DataOutputStream(session.getOutputStream());
    dos.writeUTF("remove");
    serialize(key, serializer, dos);
    dos.flush();
    // read response
    final DataInputStream dis = new DataInputStream(session.getInputStream());
    return dis.readBoolean();
  }
});

代码示例来源:origin: libgdx/libgdx

if (listener != null) listener.onConnected();
DataInputStream in = new DataInputStream(socket.getInputStream());
multiTouch = in.readBoolean();
while (true) {
  int event = in.readInt();
  KeyEvent keyEvent = null;
  TouchEvent touchEvent = null;
  case RemoteSender.KEY_DOWN:
    keyEvent = new KeyEvent();
    keyEvent.keyCode = in.readInt();
    keyEvent.type = KeyEvent.KEY_DOWN;
    break;
  case RemoteSender.KEY_UP:
    keyEvent = new KeyEvent();
    keyEvent.keyCode = in.readInt();
    keyEvent.type = KeyEvent.KEY_UP;
    break;

代码示例来源:origin: stanfordnlp/CoreNLP

protected void read(DataInputStream file) {
 try {
  int size = file.readInt();
  index = new HashIndex<>();
  for (int i = 0; i < size; i++) {
   String tag = file.readUTF();
   boolean inClosed = file.readBoolean();
   index.add(tag);
   if (inClosed) closed.add(tag);
  }
 } catch (IOException e) {
  throw new RuntimeIOException(e);
 }
}

代码示例来源:origin: apache/nifi

private Object readFieldValue(final InputStream in, final FieldType fieldType, final String fieldName, final List<RecordField> subFields) throws IOException {
  switch (fieldType) {
    case BOOLEAN: {
      final DataInputStream dis = new DataInputStream(in);
      return dis.readBoolean();
      final DataInputStream dis = new DataInputStream(in);
      return dis.readLong();
      final DataInputStream dis = new DataInputStream(in);
      return dis.readUTF();
      final DataInputStream dis = new DataInputStream(in);
      final String childFieldType = dis.readUTF();
      final Optional<RecordField> fieldOption = subFields.stream().filter(field -> field.getFieldName().equals(childFieldType)).findFirst();
      if (!fieldOption.isPresent()) {

代码示例来源:origin: apache/nifi

@Override
public Set<PeerStatus> getPeerStatuses(final Peer peer) throws IOException {
  if (!handshakeComplete) {
    throw new IllegalStateException("Handshake has not been performed");
  }
  logger.debug("{} Get Peer Statuses from {}", this, peer);
  final CommunicationsSession commsSession = peer.getCommunicationsSession();
  final DataInputStream dis = new DataInputStream(commsSession.getInput().getInputStream());
  final DataOutputStream dos = new DataOutputStream(commsSession.getOutput().getOutputStream());
  final boolean queryPeersForOtherPeers = getVersionNegotiator().getVersion() >= 6;
  RequestType.REQUEST_PEER_LIST.writeRequestType(dos);
  dos.flush();
  final int numPeers = dis.readInt();
  final Set<PeerStatus> peers = new HashSet<>(numPeers);
  for (int i = 0; i < numPeers; i++) {
    final String hostname = dis.readUTF();
    final int port = dis.readInt();
    final boolean secure = dis.readBoolean();
    final int flowFileCount = dis.readInt();
    peers.add(new PeerStatus(new PeerDescription(hostname, port, secure), flowFileCount, queryPeersForOtherPeers));
  }
  logger.debug("{} Received {} Peer Statuses from {}", this, peers.size(), peer);
  return peers;
}

代码示例来源:origin: voldemort/voldemort

@Override
public boolean parseRequest(DataInputStream inputStream) throws IOException {
  int numKeys = inputStream.readInt();
  keys = new ArrayList<ByteArray>(numKeys);
  for(int i = 0; i < numKeys; i++)
    keys.add(ClientRequestHandler.readKey(inputStream));
  if(protocolVersion > 2) {
    if(inputStream.readBoolean()) {
      int size = inputStream.readInt();
      transforms = new HashMap<ByteArray, byte[]>(size);
      for(int i = 0; i < size; i++) {
        transforms.put(ClientRequestHandler.readKey(inputStream),
                ClientRequestHandler.readTransforms(inputStream));
      }
    }
  }
  return true;
}

相关文章