/** * Called to print a line consisting of the text accumulated so * far. This is equivalent to calling {@link #printSpace} but * forcing the line to print and starting a new line ({@link * #printSpace} will only start a new line if the current line * is long enough). */ public void breakLine() { breakLine( false ); }
/** * Called by the root element to leave DTD mode and if any * DTD parts were printer, will return a string with their * textual content. */ public String leaveDTD() { // Only works if we're going out of DTD mode. if ( _writer == _dtdWriter ) { _line.append( _text ); _text = new StringBuffer( 20 ); flushLine( false ); _writer = _docWriter; return _dtdWriter.toString(); } else return null; }
_printer = new IndentPrinter( _writer, _format ); } else { _indenting = false;
_printer = new IndentPrinter( _writer, _format ); } else { _indenting = false;
/** * Called by the root element to leave DTD mode and if any * DTD parts were printer, will return a string with their * textual content. */ public String leaveDTD() { // Only works if we're going out of DTD mode. if ( _writer == _dtdWriter ) { _line.append( _text ); _text = new StringBuffer( 20 ); flushLine( false ); _writer = _docWriter; return _dtdWriter.toString(); } else return null; }
/** * Called to print a line consisting of the text accumulated so * far. This is equivalent to calling {@link #printSpace} but * forcing the line to print and starting a new line ({@link * #printSpace} will only start a new line if the current line * is long enough). */ public void breakLine() { breakLine( false ); }
/** * Called by any of the DTD handlers to enter DTD mode. * Once entered, all output will be accumulated in a string * that can be printed as part of the document's DTD. * This method may be called any number of time but will only * have affect the first time it's called. To exist DTD state * and get the accumulated DTD, call {@link #leaveDTD}. */ public void enterDTD() { // Can only enter DTD state once. Once we're out of DTD // state, can no longer re-enter it. if ( _dtdWriter == null ) { _line.append( _text ); _text = new StringBuffer( 20 ); flushLine( false ); _dtdWriter = new StringWriter(); _docWriter = _writer; _writer = _dtdWriter; } }
/** * Flush the output stream. Must be called when done printing * the document, otherwise some text might be buffered. */ public void flush() { if ( _line.length() > 0 || _text.length() > 0 ) breakLine(); try { _writer.flush(); } catch ( IOException except ) { // We don't throw an exception, but hold it // until the end of the document. if ( _exception == null ) _exception = except; } }
/** * Called by any of the DTD handlers to enter DTD mode. * Once entered, all output will be accumulated in a string * that can be printed as part of the document's DTD. * This method may be called any number of time but will only * have affect the first time it's called. To exist DTD state * and get the accumulated DTD, call {@link #leaveDTD}. */ public void enterDTD() { // Can only enter DTD state once. Once we're out of DTD // state, can no longer re-enter it. if ( _dtdWriter == null ) { _line.append( _text ); _text = new StringBuffer( 20 ); flushLine( false ); _dtdWriter = new StringWriter(); _docWriter = _writer; _writer = _dtdWriter; } }
/** * Flush the output stream. Must be called when done printing * the document, otherwise some text might be buffered. */ public void flush() { if ( _line.length() > 0 || _text.length() > 0 ) breakLine(); try { _writer.flush(); } catch ( IOException except ) { // We don't throw an exception, but hold it // until the end of the document. if ( _exception == null ) _exception = except; } }
public void breakLine( boolean preserveSpace ) { // Equivalent to calling printSpace and forcing a flushLine. if ( _text.length() > 0 ) { while ( _spaces > 0 ) { _line.append( ' ' ); --_spaces; } _line.append( _text ); _text = new StringBuffer( 20 ); } flushLine( preserveSpace ); try { // Print line and new line, then zero the line contents. _writer.write( _format.getLineSeparator() ); } catch ( IOException except ) { // We don't throw an exception, but hold it // until the end of the document. if ( _exception == null ) _exception = except; } }
public void breakLine( boolean preserveSpace ) { // Equivalent to calling printSpace and forcing a flushLine. if ( _text.length() > 0 ) { while ( _spaces > 0 ) { _line.append( ' ' ); --_spaces; } _line.append( _text ); _text = new StringBuffer( 20 ); } flushLine( preserveSpace ); try { // Print line and new line, then zero the line contents. _writer.write( _format.getLineSeparator() ); } catch ( IOException except ) { // We don't throw an exception, but hold it // until the end of the document. if ( _exception == null ) _exception = except; } }
flushLine( false ); try {