本文整理了Java中ucar.unidata.io.RandomAccessFile.write
方法的一些代码示例,展示了RandomAccessFile.write
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.write
方法的具体详情如下:
包路径:ucar.unidata.io.RandomAccessFile
类名称:RandomAccessFile
方法名:write
[英]Write a byte to the file. If the file has not been opened for writing, an IOException will be raised only when an attempt is made to write the buffer to the file.
Caveat: the effects of seek( )ing beyond the end of the file are undefined.
[中]向文件中写入一个字节。如果文件尚未打开进行写入,则仅当尝试将缓冲区写入文件时,才会引发IOException。
警告:seek()在文件末尾之外的作用尚未定义。
代码示例来源:origin: edu.ucar/netcdf
/**
* Writes a <code>boolean</code> to the file as a 1-byte value. The
* value <code>true</code> is written out as the value
* <code>(byte)1</code>; the value <code>false</code> is written out
* as the value <code>(byte)0</code>.
*
* @param v a <code>boolean</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeBoolean(boolean v) throws IOException {
write(v ? 1 : 0);
}
代码示例来源:origin: edu.ucar/cdm
private void writeString(String s) throws IOException {
// if (s.length() == 0)
// System.out.println("HEY");
byte[] b = s.getBytes(CDM.utf8Charset); // all strings are encoded in UTF-8 Unicode.
raf.writeInt(b.length);
raf.write(b);
pad(b.length, (byte) 0);
}
代码示例来源:origin: edu.ucar/cdm
/**
* Writes a <code>byte</code> to the file as a 1-byte value.
*
* @param v a <code>byte</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeByte(int v) throws IOException {
write(v);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Writes a <code>short</code> to the file as two bytes, high byte first.
*
* @param v a <code>short</code> to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeShort(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Writes a <code>char</code> to the file as a 2-byte value, high
* byte first.
*
* @param v a <code>char</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeChar(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Writes an <code>int</code> to the file as four bytes, high byte first.
*
* @param v an <code>int</code> to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeInt(int v) throws IOException {
write((v >>> 24) & 0xFF);
write((v >>> 16) & 0xFF);
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: Unidata/thredds
/**
* Writes a <code>byte</code> to the file as a 1-byte value.
*
* @param v a <code>byte</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeByte(int v) throws IOException {
write(v);
}
代码示例来源:origin: Unidata/thredds
/**
* Writes a <code>char</code> to the file as a 2-byte value, high
* byte first.
*
* @param v a <code>char</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeChar(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/cdm
/**
* Writes an <code>int</code> to the file as four bytes, high byte first.
*
* @param v an <code>int</code> to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeInt(int v) throws IOException {
write((v >>> 24) & 0xFF);
write((v >>> 16) & 0xFF);
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/unidataCommon
/**
* Writes a <code>byte</code> to the file as a 1-byte value.
*
* @param v a <code>byte</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeByte(int v) throws IOException {
write(v);
}
代码示例来源:origin: edu.ucar/cdm
/**
* Writes a <code>char</code> to the file as a 2-byte value, high
* byte first.
*
* @param v a <code>char</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeChar(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/unidataCommon
/**
* Writes a <code>short</code> to the file as two bytes, high byte first.
*
* @param v a <code>short</code> to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeShort(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/unidataCommon
/**
* Writes a <code>char</code> to the file as a 2-byte value, high
* byte first.
*
* @param v a <code>char</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeChar(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Writes a <code>byte</code> to the file as a 1-byte value.
*
* @param v a <code>byte</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeByte(int v) throws IOException {
write(v);
}
代码示例来源:origin: edu.ucar/cdm
/**
* Writes a <code>boolean</code> to the file as a 1-byte value. The
* value <code>true</code> is written out as the value
* <code>(byte)1</code>; the value <code>false</code> is written out
* as the value <code>(byte)0</code>.
*
* @param v a <code>boolean</code> value to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeBoolean(boolean v) throws IOException {
write(v ? 1 : 0);
}
代码示例来源:origin: edu.ucar/cdm
/**
* Writes a <code>short</code> to the file as two bytes, high byte first.
*
* @param v a <code>short</code> to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeShort(int v) throws IOException {
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: Unidata/thredds
/**
* Writes an <code>int</code> to the file as four bytes, high byte first.
*
* @param v an <code>int</code> to be written.
* @throws IOException if an I/O error occurs.
*/
public final void writeInt(int v) throws IOException {
write((v >>> 24) & 0xFF);
write((v >>> 16) & 0xFF);
write((v >>> 8) & 0xFF);
write((v) & 0xFF);
}
代码示例来源:origin: edu.ucar/netcdf
private void pad(int nbytes, byte fill) throws IOException {
int pad = padding(nbytes);
for (int i = 0; i < pad; i++)
raf.write(fill);
}
代码示例来源:origin: edu.ucar/cdm
private void pad(int nbytes, byte fill) throws IOException {
int pad = padding(nbytes);
for (int i = 0; i < pad; i++)
raf.write(fill);
}
代码示例来源:origin: Unidata/thredds
private void pad(int nbytes, byte fill) throws IOException {
int pad = padding(nbytes);
for (int i = 0; i < pad; i++)
raf.write(fill);
}
内容来源于网络,如有侵权,请联系作者删除!