alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

package org.netbeans.api.mdr;

import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

/** Class used by JMI mapper to obtain output streams for generating JMI interfaces.
 * Subclasses should implement the {@link #createStream(List, String, String)}
 * method to create/open an output stream based on a provided package name, class
 * name and file extension.
 *
 */
public abstract class JMIStreamFactory {

    /** Extension for Java source files  */
    public static final String EXT_JAVA = "java"; //NOI18N

    /** Extension for Java bytecode files  */
    public static final String EXT_CLASS = "class"; //NOI18N

    /** Creates a new output stream based on a provided package name and class name.
     * Assumes that the data generated will be Java source code (e.g. creates FileOutputStream
     * for a file with "java" extension). Calling this method has the same effect
     * as calling {@link #createStream(List, String, String)} with the last parameter
     * set to EXT_JAVA.
     * @param pkg Parsed package name.
     * @param className Class name.
     * @throws IOException I/O error during stream creation.
     * @return Created stream, or null if nothing needs to be written
     *         for the class or interface.
     *
     */
    public OutputStream createStream(List pkg, String className) throws IOException {
        return createStream(pkg, className, EXT_JAVA);
    }

    /** Creates a new output stream based on a provided package name, class name and
     * extension for the returned stream should correspond to  (e.g.
     * {@link #EXT_CLASS} to generate byte code or {@link #EXT_JAVA} to generate
     * source code). The stream factory can return null to indicate
     * that nothing needs to be written for the given class or interface. For
     * example, if the stream factory is able to determine that the destination
     * file already exists and is up to date, then null could be
     * returned so that the file is not needlessly rewritten.
     * @param pkg Parsed package name.
     * @param className Class name.
     * @param extension The type of file that should be generated.
     * @throws IOException I/O error during stream creation.
     * @return Created stream, or null if nothing needs to be written
     *         for the class or interface.
     *
     */
    public abstract OutputStream createStream(List pkg, String className, String extension) throws IOException;
}

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.