本文整理了Java中java.io.RandomAccessFile.writeShort
方法的一些代码示例,展示了RandomAccessFile.writeShort
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.writeShort
方法的具体详情如下:
包路径:java.io.RandomAccessFile
类名称:RandomAccessFile
方法名:writeShort
[英]Writes a big-endian 16-bit short to this file, starting at the current file pointer. Only the two least significant bytes of the integer valare written.
[中]从当前文件指针开始,向该文件写入一个16位的大端短字符。只写入整数的两个最低有效字节。
代码示例来源:origin: robovm/robovm
/**
* 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 {@code val}
* are written, with the high byte first.
*
* @param val
* the char to write to this file.
* @throws IOException
* if an I/O error occurs while writing to this file.
* @see #readChar()
*/
public final void writeChar(int val) throws IOException {
writeShort(val);
}
代码示例来源:origin: atomix/atomix
@Override
public Bytes writeShort(int offset, short s) {
checkWrite(offset, SHORT);
try {
seekToOffset(offset);
randomAccessFile.writeShort(s);
} catch (IOException e) {
throw new RuntimeException(e);
}
return this;
}
代码示例来源:origin: apache/activemq
@Override
public void writeShort(int i) throws IOException {
try {
getRaf().writeShort(i);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: stackoverflow.com
randomAccessWriter.writeBytes("fmt ");
randomAccessWriter.writeInt(Integer.reverseBytes(16)); // Sub-chunk size, 16 for PCM
randomAccessWriter.writeShort(Short.reverseBytes((short) 1)); // AudioFormat, 1 for PCM
randomAccessWriter.writeShort(Short.reverseBytes(nChannels));// Number of channels, 1 for mono, 2 for stereo
randomAccessWriter.writeShort(Short.reverseBytes((short)(nChannels*bSamples/8))); // Block align, NumberOfChannels*BitsPerSample/8
randomAccessWriter.writeShort(Short.reverseBytes(bSamples)); // Bits per sample
randomAccessWriter.writeBytes("data");
randomAccessWriter.writeInt(0); // Data chunk size not known yet, write 0
代码示例来源:origin: i2p/i2p.i2p
public void writeShort(int v) throws IOException { delegate.writeShort(v); }
public void writeChar(int v) throws IOException { delegate.writeChar(v); }
代码示例来源:origin: geotools/geotools
raf.writeByte((Byte) value);
} else if (binding == Short.class || binding == short.class) {
raf.writeShort((Short) value);
} else if (binding == Integer.class || binding == int.class) {
raf.writeInt((Integer) value);
代码示例来源:origin: edu.ucar/jj2000
/** Write an ICCDateTime to a file. */
public void write (RandomAccessFile raf) throws IOException {
raf.writeShort(wYear);
raf.writeShort(wMonth);
raf.writeShort(wDay);
raf.writeShort(wHours);
raf.writeShort(wMinutes);
raf.writeShort(wSeconds); }
代码示例来源:origin: org.jetbrains.intellij.deps/commons-vfs2
@Override
public void writeShort(final int v) throws IOException
{
raf.writeShort(v);
}
代码示例来源:origin: de.sciss/scisslib
protected final void writeLittleShort( int i )
throws IOException
{
raf.writeShort( (i >> 8) | ((i & 0xFF) << 8) );
}
代码示例来源:origin: waterguo/antsdb
synchronized public void log(int streamId, ByteBuffer buf) throws IOException {
this.raf.writeShort(MAGIC);
this.raf.writeInt(streamId);
this.raf.writeInt(buf.remaining());
this.raf.getChannel().write(buf);
}
代码示例来源:origin: dcm4che/dcm4che
private void writeFileSetConsistencyFlag(int flag) throws IOException {
raf.seek(firstRecordPos - 14);
raf.writeShort(flag);
setFileSetConsistencyFlag(flag);
}
代码示例来源:origin: stackoverflow.com
File myFile = new File (filename);
//Create the accessor with read-write access.
RandomAccessFile accessor = new RandomAccessFile (myFile, "rws");
int lastNumBytes = 26;
long startingPosition = accessor.length() - lastNumBytes;
accessor.seek(startingPosition);
accessor.writeInt(x);
accessor.writeShort(y);
accessor.writeByte(z);
accessor.close();
代码示例来源:origin: org.eobjects.metamodel-extras/MetaModel-extras-dbase
public DBT_fpt(DBF iDBF, String name, boolean destroy) throws IOException,
xBaseJException {
super(iDBF, name, destroy, DBF.FOXPRO_WITH_MEMO);
nextBlock = 8;
file.writeInt(nextBlock);
file.writeByte(0);
file.writeByte(0);
memoBlockSize = 64;
file.writeShort(memoBlockSize);
for (int i = 0; i < 504; i += 4)
file.writeInt(0);
}
代码示例来源:origin: io.atomix/atomix-buffer
@Override
public Bytes writeShort(int offset, short s) {
checkWrite(offset, SHORT);
try {
seekToOffset(offset);
randomAccessFile.writeShort(s);
} catch (IOException e) {
throw new RuntimeException(e);
}
return this;
}
代码示例来源:origin: io.atomix/atomix-storage
@Override
public Bytes writeShort(int offset, short s) {
checkWrite(offset, SHORT);
try {
seekToOffset(offset);
randomAccessFile.writeShort(s);
} catch (IOException e) {
throw new RuntimeException(e);
}
return this;
}
代码示例来源:origin: org.onosproject/onlab-thirdparty
@Override
public Bytes writeShort(long offset, short s) {
checkWrite(offset, SHORT);
try {
seekToOffset(offset);
randomAccessFile.writeShort(s);
} catch (IOException e) {
throw new RuntimeException(e);
}
return this;
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public void writeShort(int i) throws IOException {
try {
getRaf().writeShort(i);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: org.checkerframework/checker-qual7
/**
* Writes an unsigned short to the RandomAccessFile f. This method is a wrapper around {@link
* java.io.RandomAccessFile#writeShort(int) writeShort(int)}, but assumes the input should be
* interpreted as unsigned.
*/
@SuppressWarnings("signedness")
public static void writeUnsignedShort(RandomAccessFile f, @Unsigned short s)
throws IOException {
f.writeShort(toUnsignedInt(s));
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public void writeShort(int i) throws IOException {
try {
getRaf().writeShort(i);
} catch (IOException ioe) {
handleException();
throw ioe;
}
}
代码示例来源:origin: octo-online/reactive-audit
@Test(expected = FileReactiveAuditException.class)
public void writeShort()
throws IOException
{
ReactiveAudit.off.commit();
try (RandomAccessFile rw = newRandomAccessFile())
{
TestTools.strict.commit();
rw.writeShort(0);
}
}
内容来源于网络,如有侵权,请联系作者删除!