@Test public void testWriteChars() throws Exception { RandomAccessFile file = file(); BufferedFileOutput buf = manage(new BufferedFileOutput(file, 100)); buf.writeChars("Hello, world!"); buf.flush(); file.seek(0); String expect = "Hello, world!"; for (char e : expect.toCharArray()) { char c = file.readChar(); assertThat(c, is(e)); } eof(file); }
@Override public void writeChars(String s) throws IOException { for (int i = 0, n = s.length(); i < n; i++) { writeChar(s.charAt(i)); } }
BufferedFileOutput implements RandomAccess, DataOutput, Flushable, Closeable { @Override public void writeChars(String s) throws IOException { for (int i = 0, n = s.length(); i < n; i++) { writeChar(s.charAt(i)); } } }
BufferedFileOutput implements RandomAccess, DataOutput, Flushable, Closeable { @Override public void writeChars(String s) throws IOException { for (int i = 0, n = s.length(); i < n; i++) { writeChar(s.charAt(i)); } } BufferedFileOutput(RandomAccessFile file, int bufferSize);  BufferedFileOutput(RandomAccessFile file, byte[] buffer); }
BufferedFileOutput implements RandomAccess, DataOutput, Flushable, Closeable { @Override public void writeChars(String s) throws IOException { for (int i = 0, n = s.length(); i < n; i++) { writeChar(s.charAt(i)); } } BufferedFileOutput(RandomAccessFile file, int bufferSize);  BufferedFileOutput(RandomAccessFile file, byte[] buffer); void sync(); void seek(long position); long getPosition(); long getSize(); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void writeBoolean(boolean v); @Override void writeByte(int v); @Override void writeShort(int v); @Override void writeChar(int v); @Override void writeInt(int v); @Override void writeLong(long v); @Override void writeFloat(float v); @Override void writeDouble(double v); @Override void writeBytes(String s); @Override void writeChars(String s); @Override void writeUTF(String s); @Override void flush(); @Override void close(); }
BufferedFileOutput implements RandomAccess, DataOutput, Flushable, Closeable { @Override public void writeChars(String s) throws IOException { for (int i = 0, n = s.length(); i < n; i++) { writeChar(s.charAt(i)); } } BufferedFileOutput(RandomAccessFile file, int bufferSize);  BufferedFileOutput(RandomAccessFile file, byte[] buffer); void sync(); void seek(long position); long getPosition(); long getSize(); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void writeBoolean(boolean v); @Override void writeByte(int v); @Override void writeShort(int v); @Override void writeChar(int v); @Override void writeInt(int v); @Override void writeLong(long v); @Override void writeFloat(float v); @Override void writeDouble(double v); @Override void writeBytes(String s); @Override void writeChars(String s); @Override void writeUTF(String s); @Override void flush(); @Override void close();  }