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

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

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

RandomAccessFile.writeChar介绍

[英]Writes a big-endian 16-bit character to this file, starting at the current file pointer. Only the two least significant bytes of the integer valare written, with the high byte first.
[中]从当前文件指针开始,向该文件写入一个大端16位字符。只写入整数的两个最低有效字节,首先写入高字节。

代码示例

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

@Override
public Bytes writeChar(int offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

代码示例来源: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: apache/activemq

@Override
public void writeChar(int i) throws IOException {
  try {
    getRaf().writeChar(i);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

public void writeChar(int v)		throws IOException { delegate.writeChar(v); }
public void writeInt(int v)			throws IOException {  delegate.writeInt(v); }

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

@Override
public void writeChar(final int v) throws IOException
{
  raf.writeChar(v);
}

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

@Override
public void writeChar(final int v) throws IOException {
  raf.writeChar(v);
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.vfs

public void writeChar(int v) throws IOException
{
  raf.writeChar(v);
}

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

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

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

/**
 * Writes a
 * <code>char</code> to the file as a two-byte value, high byte first. The
 * write starts at the current position of the file pointer.
 *
 * @param v a <code>char</code> value to be written.
 * @exception IOException if an I/O error occurs.
 */
public synchronized final void writeChar(int v) throws IOException {
  resetPosition();
  raf.writeChar(v);
}

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

@Override
public Bytes writeChar(long offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

@Override
public Bytes writeChar(long offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

@Override
public Bytes writeChar(int offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

@Override
public Bytes writeChar(long offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

@Override
public Bytes writeChar(long offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

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

@Override
public Bytes writeChar(int offset, char c) {
 checkWrite(offset, CHARACTER);
 try {
  seekToOffset(offset);
  randomAccessFile.writeChar(c);
 } catch (IOException e) {
  throw new RuntimeException(e);
 }
 return this;
}

代码示例来源:origin: org.checkerframework/checker-qual7

/**
 * Writes an unsigned char to the RandomAccessFile f. This method is a wrapper around {@link
 * java.io.RandomAccessFile#writeChar(int) writeChar(int)}, but assumes the input should be
 * interpreted as unsigned.
 */
@SuppressWarnings("signedness")
public static void writeUnsignedChar(RandomAccessFile f, @Unsigned char c) throws IOException {
  f.writeChar(toUnsignedInt(c));
}

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

@Override
public void writeChar(int i) throws IOException {
  try {
    getRaf().writeChar(i);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

@Override
public void writeChar(int i) throws IOException {
  try {
    getRaf().writeChar(i);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

@Override
public void writeChar(int i) throws IOException {
  try {
    getRaf().writeChar(i);
  } catch (IOException ioe) {
    handleException();
    throw ioe;
  }
}

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

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

相关文章