Java 类java.io.FilterWriter 实例源码
项目:fluentxml4j
文件:XmlResult.java
public Writer getWriter()
{
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
return new FilterWriter(new OutputStreamWriter(bytesOut, UTF8))
{
@Override
public void flush() throws IOException
{
super.flush();
publishData();
}
@Override
public void close() throws IOException
{
super.close();
publishData();
}
private void publishData()
{
XmlResult.this.dataHolder = new BytesDataHolder(bytesOut.toByteArray());
}
};
}
项目:openjdk-jdk10
文件:ToolBox.java
@Override
public Writer openWriter() {
return new FilterWriter(new StringWriter()) {
@Override
public void close() throws IOException {
out.close();
String text = ((StringWriter) out).toString();
save(location, name, new Content() {
@Override
public byte[] getBytes() {
return text.getBytes();
}
@Override
public String getString() {
return text;
}
});
}
};
}
项目:openjdk9
文件:ToolBox.java
@Override
public Writer openWriter() {
return new FilterWriter(new StringWriter()) {
@Override
public void close() throws IOException {
out.close();
String text = ((StringWriter) out).toString();
save(location, name, new Content() {
@Override
public byte[] getBytes() {
return text.getBytes();
}
@Override
public String getString() {
return text;
}
});
}
};
}
项目:In-the-Box-Fork
文件:FilterWriterTest.java
/**
* @tests java.io.FilterWriter#FilterReader(java.io.Reader)
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies constructor FilterWriter(java.io.Writer).",
method = "FilterWriter",
args = {java.io.Writer.class}
)
public void test_ConstructorLjava_io_Writer() {
FilterWriter myWriter = null;
called = true;
try {
myWriter = new MyFilterWriter(null);
fail("NullPointerException expected.");
} catch (NullPointerException e) {
// expected
}
}
项目:lams
文件:Dom4JDriver.java
@Override
public HierarchicalStreamWriter createWriter(final Writer out) {
final HierarchicalStreamWriter[] writer = new HierarchicalStreamWriter[1];
final FilterWriter filter = new FilterWriter(out) {
@Override
public void close() {
writer[0].close();
}
};
writer[0] = new Dom4JXmlWriter(new XMLWriter(filter, outputFormat), getNameCoder());
return writer[0];
}
项目:j2objc
文件:OldFilterWriterTest.java
public void test_ConstructorLjava_io_Writer() {
FilterWriter myWriter = null;
called = true;
try {
myWriter = new MyFilterWriter(null);
fail("NullPointerException expected.");
} catch (NullPointerException e) {
// expected
}
}
项目:xstream
文件:Dom4JDriver.java
@Override
public HierarchicalStreamWriter createWriter(final Writer out) {
final HierarchicalStreamWriter[] writer = new HierarchicalStreamWriter[1];
final FilterWriter filter = new FilterWriter(out) {
@Override
public void close() {
writer[0].close();
}
};
writer[0] = new Dom4JXmlWriter(new XMLWriter(filter, outputFormat), getNameCoder());
return writer[0];
}
项目:QuizUpWinner
文件:Dom4JDriver.java
public HierarchicalStreamWriter createWriter(Writer paramWriter)
{
final HierarchicalStreamWriter[] arrayOfHierarchicalStreamWriter = new HierarchicalStreamWriter[1];
arrayOfHierarchicalStreamWriter[0] = new Dom4JXmlWriter(new XMLWriter(new FilterWriter(paramWriter)
{
public void close()
{
arrayOfHierarchicalStreamWriter[0].close();
}
}
, this.outputFormat), getNameCoder());
return arrayOfHierarchicalStreamWriter[0];
}
项目:cn1
文件:WriterTesterTest.java
@Override public Writer create(Writer delegate) throws Exception {
return new FilterWriter(delegate) {};
}
项目:freeVM
文件:WriterTesterTest.java
@Override public Writer create(Writer delegate) throws Exception {
return new FilterWriter(delegate) {};
}