當前位置: 首頁>>代碼示例>>Java>>正文


Java FilterWriter類代碼示例

本文整理匯總了Java中java.io.FilterWriter的典型用法代碼示例。如果您正苦於以下問題:Java FilterWriter類的具體用法?Java FilterWriter怎麽用?Java FilterWriter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FilterWriter類屬於java.io包,在下文中一共展示了FilterWriter類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getWriter

import java.io.FilterWriter; //導入依賴的package包/類
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());
		}
	};
}
 
開發者ID:fluentxml4j,項目名稱:fluentxml4j,代碼行數:26,代碼來源:XmlResult.java

示例2: openWriter

import java.io.FilterWriter; //導入依賴的package包/類
@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;
                }

            });
        }
    };
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:ToolBox.java

示例3: FilterWriter

import java.io.FilterWriter; //導入依賴的package包/類
/**
 * @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
    }
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:23,代碼來源:FilterWriterTest.java

示例4: createWriter

import java.io.FilterWriter; //導入依賴的package包/類
@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];
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:Dom4JDriver.java

示例5: test_ConstructorLjava_io_Writer

import java.io.FilterWriter; //導入依賴的package包/類
public void test_ConstructorLjava_io_Writer() {

        FilterWriter myWriter = null;

        called = true;

        try {
            myWriter = new MyFilterWriter(null);
            fail("NullPointerException expected.");
        } catch (NullPointerException e) {
            // expected
        }
    }
 
開發者ID:Sellegit,項目名稱:j2objc,代碼行數:14,代碼來源:OldFilterWriterTest.java

示例6: createWriter

import java.io.FilterWriter; //導入依賴的package包/類
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];
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:14,代碼來源:Dom4JDriver.java

示例7: create

import java.io.FilterWriter; //導入依賴的package包/類
@Override public Writer create(Writer delegate) throws Exception {
    return new FilterWriter(delegate) {};
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:4,代碼來源:WriterTesterTest.java


注:本文中的java.io.FilterWriter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。