コード例 #1
0
  /**
   * Create a new {@link OutputManager} for generating Java source files into a given package.
   *
   * @param baseDirectoryName for the generated source code.
   * @param packageName for the generated source code relative to the baseDirectoryName.
   */
  public PackageOutputManager(final String baseDirectoryName, final String packageName)
      throws IOException {
    Verify.notNull(baseDirectoryName, "baseDirectoryName");
    Verify.notNull(packageName, "packageName");

    final String dirName =
        (baseDirectoryName.endsWith("" + File.separatorChar)
                ? baseDirectoryName
                : baseDirectoryName + File.separatorChar)
            + packageName.replace('.', File.separatorChar);

    outputDir = new File(dirName);
    if (!outputDir.exists()) {
      if (!outputDir.mkdirs()) {
        throw new IllegalStateException("Unable to create directory: " + dirName);
      }
    }
  }
コード例 #2
0
  public int serialize() throws IOException {
    Verify.notNull(ir, "ir");

    write(buffer, serializeFrame());

    serializeTokenList(ir.messageHeader().tokens());

    for (final List<Token> tokenList : ir.messages()) {
      serializeTokenList(tokenList);
    }

    return totalSize;
  }