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

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

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

RandomAccessFile.writeChars介绍

[英]Writes big-endian 16-bit characters from str to this file, starting at the current file pointer.
[中]从当前文件指针开始,将str中的大端16位字符写入该文件。

代码示例

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

@Override
public void writeChars(String s) throws IOException {
  try {
    getRaf().writeChars(s);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

@Before
 public void setup() throws IOException {
 // needed to satisfy the framework only - input ignored in mapper
 String dir = DIR.getRoot().getPath();
 File infile = new File(dir + "/in");
 RandomAccessFile file = new RandomAccessFile(infile, "rw");
 // add some data so framework actually calls our mapper
 file.writeChars("aa bb cc\ndd ee ff\n");
 file.close();
}

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

public void writeChars(String s)	throws IOException { delegate.writeChars(s); }

代码示例来源:origin: org.jetbrains.intellij.deps/commons-vfs2

@Override
public void writeChars(final String s) throws IOException
{
  raf.writeChars(s);
}

代码示例来源:origin: io.scif/scifio

@Override
public void writeChars(final String s) throws IOException {
  raf.writeChars(s);
}

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

@Override
public void writeChars(String s) throws IOException {
 raf.writeChars(s);
}

代码示例来源:origin: com.github.abashev/commons-vfs2

@Override
public void writeChars(final String s) throws IOException {
  raf.writeChars(s);
}

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

@Override
public void writeChars(String s) throws IOException {
 raf.writeChars(s);
}

代码示例来源:origin: org.apache.commons/commons-vfs2

@Override
public void writeChars(final String s) throws IOException {
  raf.writeChars(s);
}

代码示例来源:origin: topjohnwu/libsu

@Override
public void writeChars(@NonNull String s) throws IOException {
  raf.writeChars(s);
}

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

private void writeData(RandomAccessFile f, String n) throws IOException {
 StringBuffer buf = null;

 if ( n != null )
   buf = new StringBuffer( n );
 else {
   buf = new StringBuffer( 20 );
   buf.setLength( 20 );
 }

 f.writeChars( buf.toString() );
}

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

private void writeData(RandomAccessFile f, String n) throws IOException {
StringBuffer buf = null;
if ( n != null )
  buf = new StringBuffer( n );
else
  buf = new StringBuffer( 20 );
  buf.setLength( 20 );
  f.writeChars( buf.toString() );

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

RandomAccessFile raf = new RandomAccessFile("filename.txt", "rw");
String tmp;
while (tmp = raf.readLine() != null) {
  // Store String data
}
// do some string conversion
raf.seek(0);
raf.writeChars("newString");

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

RandomAccessFile logfile;

public void initLogger(String logPath) {
  File fl = new File(logPath);
  long fileLength = fl.length();
  logfile = new RandomAccessFile(fl, "rw");
  logfile.seek(fileLength);
}

public void log(String text) throws IOException {
  logfile.writeChars(text);
  logfile.writeChar('\n');
}

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

@Override
public void writeChars(final String s) throws IOException {
  writer().writeChars(s);
}

代码示例来源:origin: scijava/scijava-common

@Override
public void writeChars(final String s) throws IOException {
  writer().writeChars(s);
}

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

@Override
public void writeChars(String s) throws IOException {
  try {
    getRaf().writeChars(s);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

@Override
public void writeChars(String s) throws IOException {
  try {
    getRaf().writeChars(s);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

@Override
public void writeChars(String s) throws IOException {
  try {
    getRaf().writeChars(s);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

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

相关文章