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

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

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

DataInputStream.readDouble介绍

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

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

代码示例

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

DataInputStream in = new DataInputStream(new BufferedInputStream(
             new FileInputStream("filename")));
int x = in.readInt();
double y = in.readDouble();

etc.

代码示例来源:origin: opentripplanner/OpenTripPlanner

public static VerticalDatum fromGTX (InputStream inputStream) throws IOException {
  DataInputStream stream = new DataInputStream(new BufferedInputStream(inputStream));
  double lowerLeftLatitude = stream.readDouble();
  double lowerLeftLongitude = stream.readDouble();
  if (lowerLeftLongitude > 180) {
    lowerLeftLongitude -= 360; //convert to standard coordinates
  }
  double deltaLatitude = stream.readDouble();
  double deltaLongitude = stream.readDouble();
  int nRows = stream.readInt();
  int nColumns = stream.readInt();
  float[][] data = new float[nRows][nColumns];
  for (int y = 0; y < nRows; ++y) {
    for (int x = 0; x < nColumns; ++x) {
      data[y][x] = stream.readFloat();
    }
  }
  return new VerticalDatum(lowerLeftLongitude, lowerLeftLatitude, deltaLatitude * nColumns, deltaLongitude * nRows, data);
}

代码示例来源:origin: addthis/stream-lib

public static QDigest deserialize(byte[] b) {
  ByteArrayInputStream bis = new ByteArrayInputStream(b);
  DataInputStream s = new DataInputStream(bis);
  try {
    long size = s.readLong();
    double compressionFactor = s.readDouble();
    long capacity = s.readLong();
    int count = s.readInt();
    QDigest d = new QDigest(compressionFactor);
    d.size = size;
    d.capacity = capacity;
    for (int i = 0; i < count; ++i) {
      long k = s.readLong();
      long n = s.readLong();
      d.node2count.put(k, n);
    }
    return d;
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

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

/**
 * Performs authorization on given DatagramPacket.
 *
 * @param packet to authorize
* @return offset in DatagramPacket where request payload starts
* @throws Exception thrown if passcode received from client does not match set passcode
*/
protected int authorizeProbeRequest(DatagramPacket packet) throws Exception {
 int offset = 0;
 ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
 DataInputStream in = new DataInputStream(bis);
 long t1 = in.readLong();
 double q1 = in.readDouble();
 int length = in.readInt();
 byte[] digest = new byte[length];
 in.readFully(digest);
 offset = 8 + 8 + 4 + digest.length;
 byte[] local = Util.createDigest(passcode, t1, q1);
 if(!MessageDigest.isEqual(digest, local))
   throw new Exception("Authorization failed! Make sure correct passcode is used");
 else
   log.debug("Request authorized");
 return offset;
}

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

break;
case 'I':
  data[i] = in.readInt();
  break;
case 'F':
  break;
case 'D':
  data[i] = Double.valueOf(in.readDouble());
  break;
case 'i':

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

break;
case INTEGER_TYPE:
  value = Integer.valueOf(in.readInt());
  break;
case LONG_TYPE:
  break;
case DOUBLE_TYPE:
  value = new Double(in.readDouble());
  break;
case BYTE_ARRAY_TYPE:
  value = new byte[in.readInt()];
  in.readFully((byte[])value);
  break;
    value = readUTF8(in);
  } else {
    value = readUTF(in, in.readInt());

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

Class<?> type = element.field.getType();
if (type == int.class) {
  element.fieldValue = input.readInt();
} else if (type == byte.class) {
  element.fieldValue = input.readByte();
  element.fieldValue = input.readFloat();
} else if (type == double.class) {
  element.fieldValue = input.readDouble();
} else {

代码示例来源:origin: fesh0r/fernflower

pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Integer, Integer.valueOf(in.readInt())));
break;
pool.add(new PrimitiveConstant(CodeConstants.CONSTANT_Double, in.readDouble()));
pool.add(null);
i++;

代码示例来源:origin: deeplearning4j/nd4j

/**
 * Restore a MultiNormalizerMinMaxScaler that was previously serialized by this strategy
 *
 * @param stream the input stream to restore from
 * @return the restored MultiNormalizerMinMaxScaler
 * @throws IOException
 */
public MultiNormalizerMinMaxScaler restore(@NonNull InputStream stream) throws IOException {
  DataInputStream dis = new DataInputStream(stream);
  boolean fitLabels = dis.readBoolean();
  int numInputs = dis.readInt();
  int numOutputs = dis.readInt();
  double targetMin = dis.readDouble();
  double targetMax = dis.readDouble();
  MultiNormalizerMinMaxScaler result = new MultiNormalizerMinMaxScaler(targetMin, targetMax);
  result.fitLabel(fitLabels);
  List<MinMaxStats> featureStats = new ArrayList<>();
  for (int i = 0; i < numInputs; i++) {
    featureStats.add(new MinMaxStats(Nd4j.read(dis), Nd4j.read(dis)));
  }
  result.setFeatureStats(featureStats);
  if (fitLabels) {
    List<MinMaxStats> labelStats = new ArrayList<>();
    for (int i = 0; i < numOutputs; i++) {
      labelStats.add(new MinMaxStats(Nd4j.read(dis), Nd4j.read(dis)));
    }
    result.setLabelStats(labelStats);
  }
  return result;
}

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

return new Integer(this.dataIn.readInt()).toString();
return new Double(this.dataIn.readDouble()).toString();

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

int size = input.readInt();
Class<?> arrayClass = classDesc.forClass();
Class<?> componentType = arrayClass.getComponentType();
    int[] intArray = (int[]) result;
    for (int i = 0; i < size; i++) {
      intArray[i] = input.readInt();
    double[] doubleArray = (double[]) result;
    for (int i = 0; i < size; i++) {
      doubleArray[i] = input.readDouble();

代码示例来源:origin: pentaho/pentaho-kettle

int theType = dis.readInt();
newValue( theType );
int nameLength = dis.readInt();
setLength( dis.readInt(), dis.readInt() );
   setValue( dis.readDouble() );
   break;
  case VALUE_TYPE_INTEGER:

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

return new JsonValue(oldFormat ? (long)din.readShort() : (long)din.readByte());
else if (type == 'I')
  return new JsonValue(oldFormat ? (long)din.readInt() : (long)din.readShort());
else if (type == 'l')
  return new JsonValue((long)din.readInt());
else if (type == 'L')
  return new JsonValue(din.readLong());
  return new JsonValue(din.readFloat());
else if (type == 'D')
  return new JsonValue(din.readDouble());
else if (type == 's' || type == 'S')
  return new JsonValue(parseString(din, type));

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

return new JsonValue(oldFormat ? (long)din.readShort() : (long)din.readByte());
else if (type == 'I')
  return new JsonValue(oldFormat ? (long)din.readInt() : (long)din.readShort());
else if (type == 'l')
  return new JsonValue((long)din.readInt());
else if (type == 'L')
  return new JsonValue(din.readLong());
  return new JsonValue(din.readFloat());
else if (type == 'D')
  return new JsonValue(din.readDouble());
else if (type == 's' || type == 'S')
  return new JsonValue(parseString(din, type));

代码示例来源:origin: deeplearning4j/nd4j

if (currentType == Type.DOUBLE) {
  for (int i = 0; i < length(); i++) {
    putByGlobalType(i, s.readDouble(), globalType);
    putByGlobalType(i, s.readInt(), globalType);

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

return Integer.valueOf(this.dataIn.readInt());
return new Double(this.dataIn.readDouble());
int len = this.dataIn.readInt();
byte[] value = new byte[len];
this.dataIn.readFully(value);

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

double d = input.readDouble();
if (field != null) {
  field.setDouble(obj, d);
int i = input.readInt();
if (field != null) {
  field.setInt(obj, i);

代码示例来源:origin: EngineHub/WorldEdit

return new ShortTag(is.readShort());
case NBTConstants.TYPE_INT:
  return new IntTag(is.readInt());
case NBTConstants.TYPE_LONG:
  return new LongTag(is.readLong());
  return new FloatTag(is.readFloat());
case NBTConstants.TYPE_DOUBLE:
  return new DoubleTag(is.readDouble());
case NBTConstants.TYPE_BYTE_ARRAY:
  int length = is.readInt();
  byte[] bytes = new byte[length];
  is.readFully(bytes);
case NBTConstants.TYPE_LIST:
  int childType = is.readByte();
  length = is.readInt();

代码示例来源:origin: pentaho/pentaho-kettle

case VALUE_TYPE_STRING:
 int stringLength = dis.readInt();
 if ( stringLength < 0 ) {
  setValue( (String) null );
case VALUE_TYPE_BIGNUMBER:
 int bnLength = dis.readInt();
 if ( bnLength < 0 ) {
  setValue( (BigDecimal) null );
 setValue( dis.readDouble() );
 break;
case VALUE_TYPE_INTEGER:

代码示例来源:origin: GlowstoneMC/Glowstone

return new IntTag(is.readInt());
return new DoubleTag(is.readDouble());
int length = is.readInt();
readLimiter.read(length);
byte[] bytes = new byte[length];
readLimiter.read(37);
TagType childType = TagType.byIdOrError(is.readUnsignedByte());
length = is.readInt();
readLimiter.read(4 * length);

相关文章