private void ensureCommentMode ( ) throws IOException { switch ( this . mode ) { case MODE_START_LINE : writeIndent ( ) ; this . prevLineCommentsStartPosition = this . linePosition ; this . write ( this . prefixComment ) ; changeMode ( MODE_COMMENTS ) ; break ; case MODE_VALUES : { this . prevLineCommentsStartPosition = this . linePosition ; this . write ( this . prefixComment ) ; changeMode ( MODE_COMMENTS ) ; } break ; case MODE_COMMENTS : { BR ( ) ; writeIndent ( ) ; while ( this . linePosition < this . prevLineCommentsStartPosition ) { this . write ( ' ' ) ; } this . write ( this . prefixComment ) ; } break ; default : throw new Error ( "Unexpected state" ) ; } }
Ensure the comment mode .