/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import com.sun.javadoc.*; import org.clearsilver.HDF; import org.clearsilver.CS; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.IOException; import java.util.ArrayList; public class ClearPage { /* public ClearPage() { String templ = "templates/index.cs"; String filename = "docs/index.html"; data.setValue("A.B.C", "1"); data.setValue("A.B.D", "2"); } */ public static ArrayList hdfFiles = new ArrayList(); private static ArrayList mTemplateDirs = new ArrayList(); private static boolean mTemplateDirSet = false; public static String outputDir = "docs"; public static String htmlDir = null; public static String toroot = null; public static void addTemplateDir(String dir) { mTemplateDirSet = true; mTemplateDirs.add(dir); File hdfFile = new File(dir, "data.hdf"); if (hdfFile.canRead()) { hdfFiles.add(hdfFile.getPath()); } } private static int countSlashes(String s) { final int N = s.length(); int slashcount = 0; for (int i=0; i 0) { toroot = ""; for (int i=0; i maxsize ? maxsize : (int)sizel; byte[] buf = new byte[size]; while (true) { try { size = in.read(buf); } catch (IOException e) { System.err.println(from.getAbsolutePath() + ": error reading file"); break; } if (size > 0) { try { out.write(buf, 0, size); } catch (IOException e) { System.err.println(from.getAbsolutePath() + ": error writing file"); } } else { break; } } try { in.close(); } catch (IOException e) { } try { out.close(); } catch (IOException e) { } } /** Takes a string that ends w/ .html and changes the .html to htmlExtension */ public static String outputFilename(String htmlFile) { if (!DroidDoc.htmlExtension.equals(".html") && htmlFile.endsWith(".html")) { return htmlFile.substring(0, htmlFile.length()-5) + DroidDoc.htmlExtension; } else { return htmlFile; } } }