if((eInfo = (EncodingInfo)_encodings.get(DEFAULT_ENCODING)) != null) return eInfo; eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(DEFAULT_ENCODING), DEFAULT_ENCODING, LAST_PRINTABLE_UNICODE); _encodings.put(DEFAULT_ENCODING, eInfo); return eInfo; EncodingInfo.testJavaEncodingName(encoding); if((eInfo = (EncodingInfo)_encodings.get(encoding)) != null) return eInfo; for(; i<UNICODE_ENCODINGS.length; i++) { if(UNICODE_ENCODINGS[i].equalsIgnoreCase(encoding)) { eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(encoding), encoding, LAST_PRINTABLE_UNICODE); break; eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(encoding), encoding, DEFAULT_LAST_PRINTABLE); for(; i<UNICODE_ENCODINGS.length; i++) { if(UNICODE_ENCODINGS[i].equalsIgnoreCase(jName)) { eInfo = new EncodingInfo(encoding, jName, LAST_PRINTABLE_UNICODE); break; eInfo = new EncodingInfo(encoding, jName, DEFAULT_LAST_PRINTABLE);
/** * Sets the encoding for this output method with an <code>EncodingInfo</code> * instance. */ public void setEncoding(EncodingInfo encInfo) { _encoding = encInfo.getIANAName(); _encodingInfo = encInfo; }
/** * Checks whether the specified character is printable or not in this encoding. * * @param ch a code point (0-0x10ffff) */ public boolean isPrintable(char ch) { if (ch <= this.lastPrintable) { return true; } return isPrintable0(ch); }
protected void printEscaped( String source ) throws IOException { int length = source.length(); for ( int i = 0 ; i < length ; ++i ) { int ch = source.charAt(i); if (!XML11Char.isXML11Valid(ch)) { if (++i <length) { surrogates(ch, source.charAt(i)); } else { fatalError("The character '"+(char)ch+"' is an invalid XML character"); } continue; } if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028){ printHex(ch); } else if (ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '"') { _printer.printText("""); } else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) { _printer.printText((char) ch); } else { printHex(ch); } } }
_writer = _encodingInfo.getWriter(_output);
protected void printEscaped(String source) throws IOException { int length = source.length(); for (int i = 0; i < length; ++i) { int ch = source.charAt(i); if (!XMLChar.isValid(ch)) { if (++i < length) { surrogates(ch, source.charAt(i)); } else { fatalError("The character '" + (char) ch + "' is an invalid XML character"); } continue; } // escape NL, CR, TAB if (ch == '\n' || ch == '\r' || ch == '\t') { printHex(ch); } else if (ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '"') { _printer.printText("""); } else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) { _printer.printText((char) ch); } else { printHex(ch); } } }
_writer = _encodingInfo.getWriter(_output);
protected void printEscaped( String source ) throws IOException { int length = source.length(); for ( int i = 0 ; i < length ; ++i ) { int ch = source.charAt(i); if (!XML11Char.isXML11Valid(ch)) { if (++i <length) { surrogates(ch, source.charAt(i)); } else { fatalError("The character '"+(char)ch+"' is an invalid XML character"); } continue; } if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028){ printHex(ch); } else if (ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '"') { _printer.printText("""); } else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) { _printer.printText((char) ch); } else { printHex(ch); } } }
if((eInfo = (EncodingInfo)_encodings.get(DEFAULT_ENCODING)) != null) return eInfo; eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(DEFAULT_ENCODING), DEFAULT_ENCODING, LAST_PRINTABLE_UNICODE); _encodings.put(DEFAULT_ENCODING, eInfo); return eInfo; EncodingInfo.testJavaEncodingName(encoding); if((eInfo = (EncodingInfo)_encodings.get(encoding)) != null) return eInfo; for(; i<UNICODE_ENCODINGS.length; i++) { if(UNICODE_ENCODINGS[i].equalsIgnoreCase(encoding)) { eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(encoding), encoding, LAST_PRINTABLE_UNICODE); break; eInfo = new EncodingInfo(EncodingMap.getJava2IANAMapping(encoding), encoding, DEFAULT_LAST_PRINTABLE); for(; i<UNICODE_ENCODINGS.length; i++) { if(UNICODE_ENCODINGS[i].equalsIgnoreCase(jName)) { eInfo = new EncodingInfo(encoding, jName, LAST_PRINTABLE_UNICODE); break; eInfo = new EncodingInfo(encoding, jName, DEFAULT_LAST_PRINTABLE);
/** * Sets the encoding for this output method with an <code>EncodingInfo</code> * instance. */ public void setEncoding(EncodingInfo encInfo) { _encoding = encInfo.getIANAName(); _encodingInfo = encInfo; }
/** * Checks whether the specified character is printable or not in this encoding. * * @param ch a code point (0-0x10ffff) */ public boolean isPrintable(char ch) { if (ch <= this.lastPrintable) { return true; } return isPrintable0(ch); }
protected void printEscaped(String source) throws IOException { int length = source.length(); for (int i = 0; i < length; ++i) { int ch = source.charAt(i); if (!XMLChar.isValid(ch)) { if (++i < length) { surrogates(ch, source.charAt(i)); } else { fatalError("The character '" + (char) ch + "' is an invalid XML character"); } continue; } // escape NL, CR, TAB if (ch == '\n' || ch == '\r' || ch == '\t') { printHex(ch); } else if (ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '"') { _printer.printText("""); } else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) { _printer.printText((char) ch); } else { printHex(ch); } } }
/** print text data */ protected void printXMLChar( int ch) throws IOException { if (ch == '\r') { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( ch == '\n' || ch == '\t' || ( ch >= ' ' && _encodingInfo.isPrintable((char)ch))) { _printer.printText((char)ch); } else { printHex(ch); } }
/** print text data */ protected void printXMLChar( int ch) throws IOException { if (ch == '\r') { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( ch == '\n' || ch == '\t' || ( ch >= ' ' && _encodingInfo.isPrintable((char)ch))) { _printer.printText((char)ch); } else { printHex(ch); } }
protected final void printXMLChar( int ch ) throws IOException { if (ch == '\r' || ch == 0x0085 || ch == 0x2028) { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char)ch); } else { printHex(ch); } }
if (_encodingInfo.isPrintable((char) ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char) ch);
if (_encodingInfo.isPrintable((char) ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char) ch);
protected final void printXMLChar( int ch ) throws IOException { if (ch == '\r' || ch == 0x0085 || ch == 0x2028) { printHex(ch); } else if ( ch == '<') { _printer.printText("<"); } else if (ch == '&') { _printer.printText("&"); } else if (ch == '>'){ // character sequence "]]>" can't appear in content, therefore // we should escape '>' _printer.printText(">"); } else if ( _encodingInfo.isPrintable((char)ch) && XML11Char.isXML11ValidLiteral(ch)) { _printer.printText((char)ch); } else { printHex(ch); } }
if ( ( ch >= ' ' && _encodingInfo.isPrintable((char)ch) && ch != 0xF7 ) || ch == '\n' || ch == '\r' || ch == '\t' ) { _printer.printText((char)ch);
if ( ( ch >= ' ' && _encodingInfo.isPrintable((char)ch) && ch != 0xF7 ) || ch == '\n' || ch == '\r' || ch == '\t' ) { _printer.printText((char)ch);