@Override public void write(String str, int off, int len) throws IOException { checkWriteBOM(); super.write(str, off, len); } }
/** * Tests {@link BOMWriter}. * * @throws IOException should not happen */ @Test public void testBOMWriter() throws IOException { String testString = "This is a test"; ByteArrayOutputStream baos; BOMWriter bomWriter; BOMInputStream bomIn; for (BOM bom : SUPPORTED_BOMS) { baos = new ByteArrayOutputStream(); bomWriter = new BOMWriter(baos, bom.getEncoding()); bomWriter.write(testString); bomWriter.close(); bomIn = getBOMInputStream(baos.toByteArray()); assert bom.equals(bomIn.getBOM()); assertStreamEquals(testString.getBytes(bom.getEncoding()), bomIn); assertEOF(bomIn); } }
private void write(OutputStream out) throws IOException { textEditorImpl.write(new BOMWriter(out, textViewerDelegate.getEncoding())); }
@Override public void write(int c) throws IOException { checkWriteBOM(); super.write(c); }
@Override public void write(char[] cbuf, int off, int len) throws IOException { checkWriteBOM(); super.write(cbuf, off, len); }