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());
}
};
}
java类java.io.FilterWriter的实例源码
XmlResult.java 文件源码
项目:fluentxml4j
阅读 24
收藏 0
点赞 0
评论 0
ToolBox.java 文件源码
项目:openjdk-jdk10
阅读 33
收藏 0
点赞 0
评论 0
@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;
}
});
}
};
}
ToolBox.java 文件源码
项目:openjdk9
阅读 33
收藏 0
点赞 0
评论 0
@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;
}
});
}
};
}
FilterWriterTest.java 文件源码
项目:In-the-Box-Fork
阅读 20
收藏 0
点赞 0
评论 0
/**
* @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
}
}
Dom4JDriver.java 文件源码
项目:lams
阅读 27
收藏 0
点赞 0
评论 0
@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];
}
OldFilterWriterTest.java 文件源码
项目:j2objc
阅读 23
收藏 0
点赞 0
评论 0
public void test_ConstructorLjava_io_Writer() {
FilterWriter myWriter = null;
called = true;
try {
myWriter = new MyFilterWriter(null);
fail("NullPointerException expected.");
} catch (NullPointerException e) {
// expected
}
}
Dom4JDriver.java 文件源码
项目:xstream
阅读 23
收藏 0
点赞 0
评论 0
@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];
}
Dom4JDriver.java 文件源码
项目:QuizUpWinner
阅读 24
收藏 0
点赞 0
评论 0
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];
}
WriterTesterTest.java 文件源码
项目:cn1
阅读 26
收藏 0
点赞 0
评论 0
@Override public Writer create(Writer delegate) throws Exception {
return new FilterWriter(delegate) {};
}
WriterTesterTest.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
@Override public Writer create(Writer delegate) throws Exception {
return new FilterWriter(delegate) {};
}