/** * Returns the maximum allowed character code that should be allowed * unescaped which defaults to 127 in US-ASCII (7 bit) or * 255 in ISO-* (8 bit). */ protected int defaultMaximumAllowedCharacter() { String encoding = format.getEncoding(); if (encoding != null) { if (encoding.equals("US-ASCII")) { return 127; } } // no encoding for things like ISO-*, UTF-8 or UTF-16 return -1; }
public void setOutputStream(OutputStream out) throws UnsupportedEncodingException { this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; }
public HierarchicalStreamWriter createWriter(final OutputStream out) { final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null; final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null; final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out); return createWriter(writer); }
public XMLWriter(OutputStream out) throws UnsupportedEncodingException { this.format = DEFAULT_FORMAT; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter( System.out, format.getEncoding() ); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
/** * <p> * This will write the declaration to the given Writer. * Assumes XML version 1.0 since we don't directly know. * </p> */ protected void writeDeclaration() throws IOException { String encoding = format.getEncoding(); // Only print of declaration is not suppressed if (! format.isSuppressDeclaration()) { // Assume 1.0 version if (encoding.equals("UTF8")) { writer.write("<?xml version=\"1.0\""); if (!format.isOmitEncoding()) { writer.write(" encoding=\"UTF-8\""); } writer.write("?>"); } else { writer.write("<?xml version=\"1.0\""); if (! format.isOmitEncoding()) { writer.write(" encoding=\"" + encoding + "\""); } writer.write("?>"); } if (format.isNewLineAfterDeclaration()) { println(); } } }
/** * Returns the maximum allowed character code that should be allowed * unescaped which defaults to 127 in US-ASCII (7 bit) or 255 in ISO- (8 * bit). * * @return DOCUMENT ME! */ protected int defaultMaximumAllowedCharacter() { String encoding = format.getEncoding(); if (encoding != null) { if (encoding.equals("US-ASCII")) { return 127; } } // no encoding for things like ISO-*, UTF-8 or UTF-16 return -1; }
public void setOutputStream(OutputStream out) throws UnsupportedEncodingException { this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; }
public XMLWriter(OutputStream out) throws UnsupportedEncodingException { this.format = DEFAULT_FORMAT; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(System.out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
String encoding = format.getEncoding();
public void setOutputStream(OutputStream out) throws UnsupportedEncodingException { this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; }
@SuppressWarnings("resource") @Override public HierarchicalStreamWriter createWriter(final OutputStream out) { final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null; final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null; final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out); return createWriter(writer); }
public HierarchicalStreamWriter createWriter(final OutputStream out) { final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null; final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null; final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out); return createWriter(writer); }
public XMLWriter(OutputStream out) throws UnsupportedEncodingException { this.format = DEFAULT_FORMAT; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(System.out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }