/[classpath]/gjdoc/src/gnu/classpath/tools/gjdoc/RootDocImpl.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/gjdoc/RootDocImpl.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by julian, Tue Nov 23 15:19:33 2004 UTC revision 1.9 by julian, Tue Nov 23 17:19:48 2004 UTC
# Line 251  public class RootDocImpl extends DocImpl Line 251  public class RootDocImpl extends DocImpl
251    
252        loadScheduledClasses(parser);        loadScheduledClasses(parser);
253    
254          resolveComments();
255    
256        //--- Resolve pending references in all ClassDocImpls        //--- Resolve pending references in all ClassDocImpls
257    
258        printNotice("Resolving references in classes...");        printNotice("Resolving references in classes...");
# Line 382  public class RootDocImpl extends DocImpl Line 384  public class RootDocImpl extends DocImpl
384              rc.setPackageDirectory(packageDirectory);              rc.setPackageDirectory(packageDirectory);
385              if (null!=packageDocFile && packageDocFile.exists()) {              if (null!=packageDocFile && packageDocFile.exists()) {
386                 try {                 try {
387                    long packageDocSize=packageDocFile.length();                    rc.setRawCommentText(readHtmlBody(packageDocFile));
                   char[] packageDocBuf=new char[(int)(packageDocSize)];  
                   FileReader fr=new FileReader(packageDocFile);  
                   int index = 0;  
                   int i = fr.read(packageDocBuf, index, (int)packageDocSize);  
                   while (i > 0) {  
                      index += i;  
                      packageDocSize -= i;  
                      i = fr.read(packageDocBuf, index, (int)packageDocSize);  
                   }  
                   fr.close();  
   
                   // We only need the part between the begin and end body tag.  
                   String html = new String(packageDocBuf);  
                   int start = html.indexOf("<body");  
                   if (start == -1)  
                      start = html.indexOf("<BODY");  
                   int end = html.indexOf("</body>");  
                   if (end == -1)  
                      end = html.indexOf("</BODY>");  
                   if (start != -1 && end != -1) {  
                      // Start is end of body tag.  
                      start = html.indexOf('>', start) + 1;  
                      if (start != -1 && start < end)  
                         html = html.substring(start, end);  
                   }  
                   rc.setRawCommentText(html.trim());  
388                 }                 }
389                 catch (IOException e) {                 catch (IOException e) {
390                    printWarning("Error while reading documentation for package "+packageName+": "+e.getMessage());                    printWarning("Error while reading documentation for package "+packageName+": "+e.getMessage());
# Line 753  public class RootDocImpl extends DocImpl Line 729  public class RootDocImpl extends DocImpl
729     {     {
730        super(null);        super(null);
731     }     }
732    
733       public static String readHtmlBody(File file)
734          throws IOException
735       {
736          FileReader fr=new FileReader(file);
737          long size = file.length();
738          char[] packageDocBuf=new char[(int)(size)];
739          int index = 0;
740          int i = fr.read(packageDocBuf, index, (int)size);
741          while (i > 0) {
742             index += i;
743             size -= i;
744             i = fr.read(packageDocBuf, index, (int)size);
745          }
746          fr.close();
747    
748          // We only need the part between the begin and end body tag.
749          String html = new String(packageDocBuf);
750          int start = html.indexOf("<body");
751          if (start == -1)
752             start = html.indexOf("<BODY");
753          int end = html.indexOf("</body>");
754          if (end == -1)
755             end = html.indexOf("</BODY>");
756          if (start != -1 && end != -1) {
757             // Start is end of body tag.
758             start = html.indexOf('>', start) + 1;
759             if (start != -1 && start < end)
760                html = html.substring(start, end);
761          }
762          html = html.trim();
763          System.err.println("readHtmlBody returns '" + html + "'");
764          return html;
765       }
766  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26