<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>3.2</version>
+ <version>3.3</version>
<configuration>
<generateReports>true</generateReports>
<locales>ja</locales>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.6</version>
+ <version>2.7</version>
<configuration>
<linkOnly>true</linkOnly>
<offline>true</offline>
<module name="RegexpHeader">
<property name="header" value="^/\*$\n^ \*( .*)?$\n^ \*/$\n" />
<property name="multiLines" value="2" />
+ <property name="fileExtensions" value="java" />
</module>
<!-- Miscellaneous -->
- <module name="NewlineAtEndOfFile" />
+ <module name="NewlineAtEndOfFile">
+ <property name="fileExtensions" value="java" />
+ </module>
<module name="Translation" />
import javax.xml.bind.DatatypeConverter;
/**
- * XMLエクスポータの半実装。
+ * Appendable実装に依存したXMLエクスポータの半実装。
* UCS4は未サポート。
*/
abstract class AbstractXmlExporter implements XmlExporter{
/**
* {@inheritDoc}
+ * @param ch {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ */
+ @Override
+ public abstract Appendable append(char ch) throws IOException;
+
+ /**
+ * {@inheritDoc}
+ * @param seq {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ */
+ @Override
+ public abstract Appendable append(CharSequence seq) throws IOException;
+
+ /**
+ * {@inheritDoc}
+ * @param seq {@inheritDoc}
+ * @param start {@inheritDoc}
+ * @param end {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ */
+ @Override
+ public abstract Appendable append(CharSequence seq, int start, int end)
+ throws IOException;
+
+ /**
+ * {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
@Override
@Override
public abstract void close() throws IOException;
+
/**
* {@inheritDoc}
* @param ch {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
@Override
- public abstract XmlExporter putRawCh(char ch)
- throws IOException;
+ public XmlExporter putRawCh(char ch) throws IOException{
+ append(ch);
+ return this;
+ }
/**
* {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
@Override
- public abstract XmlExporter putRawText(CharSequence seq)
- throws IOException;
-
+ public XmlExporter putRawText(CharSequence seq)
+ throws IOException{
+ append(seq);
+ return this;
+ }
/**
* {@inheritDoc}
package jp.sourceforge.mikutoga.xml;
-import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.Charset;
/**
* Appendable用XMLエクスポータ実装。
*/
public class BasicXmlExporter extends AbstractXmlExporter{
- /** デフォルトエンコーディング。 */
- private static final Charset CS_UTF8 = Charset.forName("UTF-8");
-
-
- private final Appendable appendable;
+ private Appendable appendable = null;
/**
* コンストラクタ。
- * 文字エンコーディングはUTF-8が用いられる。
- * @param stream 出力ストリーム
*/
- public BasicXmlExporter(OutputStream stream){
- this(stream, CS_UTF8);
+ public BasicXmlExporter(){
+ super();
return;
}
+
/**
- * コンストラクタ。
- * @param stream 出力ストリーム
- * @param charSet 文字エンコーディング指定
+ * 出力先アペンダを指定する。
+ * @param app 出力先
+ * @throws NullPointerException 引数がnull
*/
- public BasicXmlExporter(OutputStream stream, Charset charSet){
- this(
- new BufferedWriter(
- new OutputStreamWriter(stream, charSet)
- )
- );
+ public void setAppendable(Appendable app) throws NullPointerException{
+ if(app == null) throw new NullPointerException();
+
+ this.appendable = app;
+
return;
}
/**
- * コンストラクタ。
- * @param appendable 文字列出力
+ * {@inheritDoc}
+ * @param ch {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
*/
- public BasicXmlExporter(Appendable appendable){
- super();
- this.appendable = appendable;
- return;
+ @Override
+ public Appendable append(char ch) throws IOException{
+ return this.appendable.append(ch);
}
-
/**
* {@inheritDoc}
- * @param ch {@inheritDoc}
+ * @param seq {@inheritDoc}
* @return {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
@Override
- public BasicXmlExporter putRawCh(char ch) throws IOException{
- this.appendable.append(ch);
- return this;
+ public Appendable append(CharSequence seq) throws IOException{
+ return this.appendable.append(seq);
}
/**
* {@inheritDoc}
* @param seq {@inheritDoc}
+ * @param start {@inheritDoc}
+ * @param end {@inheritDoc}
* @return {@inheritDoc}
* @throws IOException {@inheritDoc}
*/
@Override
- public BasicXmlExporter putRawText(CharSequence seq) throws IOException{
- this.appendable.append(seq);
- return this;
+ public Appendable append(CharSequence seq, int start, int end)
+ throws IOException{
+ return this.appendable.append(seq, start, end);
}
/**
/**
* コンストラクタ。
- * @param proxy 委譲先
+ * @param delegate 委譲先
*/
- public ProxyXmlExporter(XmlExporter proxy){
+ public ProxyXmlExporter(XmlExporter delegate){
super();
- this.delegate = proxy;
+ this.delegate = delegate;
return;
}
* @throws IOException {@inheritDoc}
*/
@Override
- public XmlExporter putRawCh(char ch) throws IOException{
- return this.delegate.putRawCh(ch);
+ public Appendable append(char ch) throws IOException{
+ return this.delegate.append(ch);
}
/**
* @throws IOException {@inheritDoc}
*/
@Override
- public XmlExporter putRawText(CharSequence seq) throws IOException{
- return this.delegate.putRawText(seq);
+ public Appendable append(CharSequence seq) throws IOException{
+ return this.delegate.append(seq);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @param seq {@inheritDoc}
+ * @param start {@inheritDoc}
+ * @param end {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ */
+ @Override
+ public Appendable append(CharSequence seq, int start, int end)
+ throws IOException{
+ return this.delegate.append(seq, start, end);
}
/**
/**
* {@inheritDoc}
+ * @param ch {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ */
+ @Override
+ public XmlExporter putRawCh(char ch) throws IOException{
+ return this.delegate.putRawCh(ch);
+ }
+
+ /**
+ * {@inheritDoc}
+ * @param seq {@inheritDoc}
+ * @return {@inheritDoc}
+ * @throws IOException {@inheritDoc}
+ */
+ @Override
+ public XmlExporter putRawText(CharSequence seq) throws IOException{
+ return this.delegate.putRawText(seq);
+ }
+
+ /**
+ * {@inheritDoc}
* @return {@inheritDoc}
*/
@Override
/**
* XMLエクスポータ基本機能のセット。
*/
-public interface XmlExporter extends Flushable, Closeable{
+public interface XmlExporter extends Appendable, Flushable, Closeable{
/**
- * 1文字出力する。
+ * 1文字を生出力する。
* @param ch 文字
* @return this本体
* @throws IOException 出力エラー
XmlExporter putRawCh(char ch) throws IOException;
/**
- * 文字列を出力する。
+ * 文字列を生出力する。
* @param seq 文字列
* @return this本体
* @throws IOException 出力エラー
XmlExporter putCloseEmpty() throws IOException;
/**
- * int値をXMLスキーマ準拠の形式で出力する。
+ * xsd:int値をXMLスキーマ準拠の形式で出力する。
* @param iVal int値
* @return this本体
* @throws IOException 出力エラー
- * @see java.lang.Integer#toString(int)
- * @see <a href="http://www.w3.org/TR/xmlschema11-2/#integer">
- * XML Schema 1.1 Datatypes integer
+ * @see <a href="http://www.w3.org/TR/xmlschema11-2/#int">
+ * XML Schema 1.1 Datatypes int
* </a>
*/
XmlExporter putXsdInt(int iVal) throws IOException;
/**
- * float値をXMLスキーマ準拠の形式で出力する。
+ * xsd:float値をXMLスキーマ準拠の形式で出力する。
* @param fVal float値
* @return this本体
* @throws IOException 出力エラー