langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/RawHtml.java
changeset 36500 d31e4986dc8b
parent 35426 374342e56a56
child 40303 96a1226aca18
equal deleted inserted replaced
36499:9d823cc0fe98 36500:d31e4986dc8b
     1 /*
     1 /*
     2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    51     /**
    51     /**
    52      * Constructor to construct a RawHtml object.
    52      * Constructor to construct a RawHtml object.
    53      *
    53      *
    54      * @param rawHtml raw HTML text to be added
    54      * @param rawHtml raw HTML text to be added
    55      */
    55      */
    56     public RawHtml(String rawHtml) {
    56     public RawHtml(CharSequence rawHtml) {
    57         rawHtmlContent = nullCheck(rawHtml);
    57         rawHtmlContent = rawHtml.toString();
    58     }
    58     }
    59 
    59 
    60     /**
    60     /**
    61      * This method is not supported by the class.
    61      * This method is not supported by the class.
    62      *
    62      *
    75      * @param stringContent string content that needs to be added
    75      * @param stringContent string content that needs to be added
    76      * @throws DocletAbortException this method will always throw a
    76      * @throws DocletAbortException this method will always throw a
    77      *                              DocletAbortException because it
    77      *                              DocletAbortException because it
    78      *                              is not supported.
    78      *                              is not supported.
    79      */
    79      */
    80     public void addContent(String stringContent) {
    80     @Override
       
    81     public void addContent(CharSequence stringContent) {
    81         throw new DocletAbortException("not supported");
    82         throw new DocletAbortException("not supported");
    82     }
    83     }
    83 
    84 
    84     /**
    85     /**
    85      * {@inheritDoc}
    86      * {@inheritDoc}
   101     @Override
   102     @Override
   102     public int charCount() {
   103     public int charCount() {
   103         return charCount(rawHtmlContent);
   104         return charCount(rawHtmlContent);
   104     }
   105     }
   105 
   106 
   106     static int charCount(String htmlText) {
   107     static int charCount(CharSequence htmlText) {
   107         State state = State.TEXT;
   108         State state = State.TEXT;
   108         int count = 0;
   109         int count = 0;
   109         for (int i = 0; i < htmlText.length(); i++) {
   110         for (int i = 0; i < htmlText.length(); i++) {
   110             char c = htmlText.charAt(i);
   111             char c = htmlText.charAt(i);
   111             switch (state) {
   112             switch (state) {