java.io.RandomAccessFile.writeDouble()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(139)

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

RandomAccessFile.writeDouble介绍

[英]Writes a big-endian 64-bit double to this file, starting at the current file pointer. The bytes are those returned by Double#doubleToLongBits(double), meaning a canonical NaN is used.
[中]从当前文件指针开始,向该文件写入一个大端64位双精度。字节是由Double#doubleToLongBits(Double)返回的,这意味着使用规范的NaN。

代码示例

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

@Override
public Bytes writeDouble(int offset, double d) {
 checkWrite(offset, DOUBLE);
 try {
  seekToOffset(offset);
  randomAccessFile.writeDouble(d);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

@Override
public void writeDouble(double v) throws IOException {
  try {
    getRaf().writeDouble(v);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: i2p/i2p.i2p

public void writeDouble(double v)	throws IOException { delegate.writeDouble(v); }
public void writeBytes(String s)	throws IOException { delegate.writeBytes(s); }

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

raf.writeFloat((Float) value);
} else if (binding == Double.class || binding == double.class) {
  raf.writeDouble((Double) value);
} else if (binding == String.class) {
  raf.writeUTF((String) value);

代码示例来源:origin: org.openmicroscopy/ome-common

@Override
public void writeDouble(double v) throws IOException {
 raf.writeDouble(v);
}

代码示例来源:origin: ome/formats-common

@Override
public void writeDouble(double v) throws IOException {
 raf.writeDouble(v);
}

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

RandomAccessFile valueFile;

try
{
  valueFile = new RandomAccessFile("valuefile.txt", "rw");
  for (int i=0; i<numOfNums; i++)
    valueFile.writeDouble(randomizer.nextDouble()*200);
}

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

public void foo(int iterations) throws IOException {
  RandomAccessFile valueFile = new RandomAccessFile("valuefile.txt", "rw");
  for (int i = 0; i < iterations; i++) {
    valueFile.writeDouble(randomizer.nextDouble()*200);
  }

  for (int i = 0; i< iterations; i++) {
    double total = 0;
    valueFile.seek(0);
    // Presumably you'd read the contents here?
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public synchronized void writeDouble(long seek, double value) throws IOException {
  super.seek(seek);
  super.writeDouble(value);
  buffer.clear();
}

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

public void write(RandomAccessFile file) throws IOException {
  file.writeInt(account);
  byte b1[] = new byte[15];
  // set firstname to b1
  file.write(b1);
  byte b2[] = new byte[15];
  // set lastname to b2
  file.write(b2);
  double balance =123.1;
  file.writeDouble(balance);
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

@Override
public Bytes writeDouble(long offset, double d) {
 checkWrite(offset, DOUBLE);
 try {
  seekToOffset(offset);
  randomAccessFile.writeDouble(d);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

代码示例来源:origin: io.atomix/catalyst-buffer

@Override
public Bytes writeDouble(long offset, double d) {
 checkWrite(offset, DOUBLE);
 try {
  seekToOffset(offset);
  randomAccessFile.writeDouble(d);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

代码示例来源:origin: io.atomix.catalyst/catalyst-buffer

@Override
public Bytes writeDouble(long offset, double d) {
 checkWrite(offset, DOUBLE);
 try {
  seekToOffset(offset);
  randomAccessFile.writeDouble(d);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

代码示例来源:origin: atomix/catalyst

@Override
public Bytes writeDouble(long offset, double d) {
 checkWrite(offset, DOUBLE);
 try {
  seekToOffset(offset);
  randomAccessFile.writeDouble(d);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

代码示例来源:origin: io.atomix/atomix-storage

@Override
public Bytes writeDouble(int offset, double d) {
 checkWrite(offset, DOUBLE);
 try {
  seekToOffset(offset);
  randomAccessFile.writeDouble(d);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

RandomAccessFile f = new RandomAccessFile("theRandomeAccessFile", "rw");
 f.writeInt(1);
 f.writeDouble(2.34);
 f.writeUTF("SomeString");
 f.writeChar('C');
 f.seek(0);
 System.err.println(f.readInt());
 System.err.println(f.readDouble());
 System.err.println(f.readUTF());
 System.err.println(f.readChar());

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public void writeDouble(double v) throws IOException {
  try {
    getRaf().writeDouble(v);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: org.apache.activemq/activemq-kahadb-store

@Override
public void writeDouble(double v) throws IOException {
  try {
    getRaf().writeDouble(v);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public void writeDouble(double v) throws IOException {
  try {
    getRaf().writeDouble(v);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

代码示例来源:origin: octo-online/reactive-audit

@Test(expected = FileReactiveAuditException.class)
public void writeDouble()
    throws IOException
{
  ReactiveAudit.off.commit();
  try (RandomAccessFile rw = newRandomAccessFile())
  {
    TestTools.strict.commit();
    rw.writeDouble(0);
  }
}

相关文章