Пример #1
0
 /**
  * Generates a serial attribute inside a file description.
  *
  * @param buffer - where to place the description
  */
 private static void generateSerialAttr(StringBuffer buffer) throws Exception {
   addIndent(buffer, FOLDER_INDENT + 2);
   buffer
       .append("<attr name=\"NetBeansAttrSerial\" serialvalue=\"")
       .append(SerialData.getSerialDataString())
       .append("\"/>");
   buffer.append('\n');
 }
Пример #2
0
 /**
  * Generates file start inside a folder description.
  *
  * @param buffer - where to place the description
  */
 private static void addFileHeader(StringBuffer buffer, ResourceComposer composer) {
   addIndent(buffer, FOLDER_INDENT + 1);
   buffer.append("<file name=\"");
   composer.assemblyResourceString(buffer);
   buffer.append("\" url=\"");
   composer.assemblyResourceString(buffer);
   buffer.append("\">").append('\n');
 }
Пример #3
0
 /**
  * Generates i-th String attribute inside a file description.
  *
  * @param buffer - where to place the description
  */
 private static void generateStringAttr(StringBuffer buffer, int i, int paddingSize) {
   addIndent(buffer, FOLDER_INDENT + 2);
   buffer.append("<attr name=\"key_");
   Utilities.appendNDigits(i, paddingSize, buffer);
   buffer.append("\" stringvalue=\"val_");
   Utilities.appendNDigits(i, paddingSize, buffer);
   buffer.append("\"/>");
   buffer.append('\n');
 }
Пример #4
0
  /**
   * Generates an XML file that describes a filesystem structure.
   *
   * @return a String that is an xml document describing a filesystem
   */
  public static String generate(ResourceComposer composer) throws Exception {
    StringBuffer buffer = new StringBuffer(50000);
    buffer.append(HEADER).append('\n');
    buffer.append("<filesystem>").append('\n');
    generateFolder(buffer, composer);
    buffer.append("</filesystem>").append('\n');

    return buffer.toString();
  }
Пример #5
0
 /**
  * Generates an XML description of a folder inside a filesystem structure.
  *
  * @param buffer - where to place the description
  */
 private static final void generateFolder(StringBuffer buffer, ResourceComposer composer)
     throws Exception {
   buffer.append(FOLDER_START1);
   int base = composer.getFileBase();
   if (base != 0) {
     buffer.append(base);
   }
   buffer.append(FOLDER_START2);
   generateFiles(buffer, composer);
   buffer.append(FOLDER_END);
 }
Пример #6
0
 /**
  * Generates an XML description of a file inside a folder structure.
  *
  * @param buffer - where to place the description
  */
 private static void generateOneFile(StringBuffer buffer, ResourceComposer composer)
     throws Exception {
   buffer.append('\n');
   addFileHeader(buffer, composer);
   generateAttributes(buffer, composer.getPaddingSize());
   addFileEnd(buffer);
 }
Пример #7
0
 /**
  * Assembly fileBase (e.g. 13) with name (e.g. JavaSrc) and ext (e.g. .java) into sbuffer. Do
  * not forget to take into account paddingSize. Result could be e.g. JavaSrc0675.java, with
  * paddingSize 4 and fileBase 675.
  */
 public void assemblyResourceString(StringBuffer sbuffer) {
   sbuffer.append(resName);
   Utilities.appendNDigits(getFileBase(), getPaddingSize(), sbuffer);
   sbuffer.append(resExt);
 }
Пример #8
0
 /**
  * Adds indent
  *
  * @param buffer - where to place the description
  */
 private static void addIndent(StringBuffer buffer, int howMuch) {
   for (int i = 0; i < howMuch; i++) {
     buffer.append(INDENT_STEP);
   }
 }
Пример #9
0
 /**
  * Generates file end inside a folder description.
  *
  * @param buffer - where to place the description
  */
 private static void addFileEnd(StringBuffer buffer) {
   addIndent(buffer, FOLDER_INDENT + 1);
   buffer.append("</file>");
   buffer.append('\n');
 }