/**
* Writes a string to the file as a sequence of characters. Each
* character is written to the data output stream as if by the
* <code>writeChar</code> method. The write starts at the current
* position of the file pointer.
*
* @param s a <code>String</code> value to be written.
* @exception IOException if an I/O error occurs.
* @see java.io.RandomAccessFile#writeChar(int)
*/
public final void writeChars(String s) throws IOException {
int clen = s.length();
int blen = 2*clen;
byte[] b = new byte[blen];
char[] c = new char[clen];
s.getChars(0, clen, c, 0);
for (int i = 0, j = 0; i < clen; i++) {
// Pay attention to the following lines!!!!!!!!!!!!!
b[j++] = (byte)(c[i] >>> 8); // 高8位
b[j++] = (byte)(c[i] >>> 0); // 低8位
}
writeBytes(b, 0, blen);
}from RandomAccessFile.java
* Writes a string to the file as a sequence of characters. Each
* character is written to the data output stream as if by the
* <code>writeChar</code> method. The write starts at the current
* position of the file pointer.
*
* @param s a <code>String</code> value to be written.
* @exception IOException if an I/O error occurs.
* @see java.io.RandomAccessFile#writeChar(int)
*/
public final void writeChars(String s) throws IOException {
int clen = s.length();
int blen = 2*clen;
byte[] b = new byte[blen];
char[] c = new char[clen];
s.getChars(0, clen, c, 0);
for (int i = 0, j = 0; i < clen; i++) {
// Pay attention to the following lines!!!!!!!!!!!!!
b[j++] = (byte)(c[i] >>> 8); // 高8位
b[j++] = (byte)(c[i] >>> 0); // 低8位
}
writeBytes(b, 0, blen);
}from RandomAccessFile.java
另外这个问题该怎么解决?