org.netbeans.api.mdr/1 1.4.22

org.netbeans.api.mdr
Class JMIStreamFactory

java.lang.Object
  extended by org.netbeans.api.mdr.JMIStreamFactory

public abstract class JMIStreamFactory
extends Object

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


Field Summary
static String EXT_CLASS
          Extension for Java bytecode files
static String EXT_JAVA
          Extension for Java source files
 
Constructor Summary
JMIStreamFactory()
           
 
Method Summary
 OutputStream createStream(List pkg, String className)
          Creates a new output stream based on a provided package name and class name.
abstract  OutputStream createStream(List pkg, String className, String extension)
          Creates a new output stream based on a provided package name, class name and extension for the returned stream should correspond to (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXT_JAVA

public static final String EXT_JAVA
Extension for Java source files

See Also:
Constant Field Values

EXT_CLASS

public static final String EXT_CLASS
Extension for Java bytecode files

See Also:
Constant Field Values
Constructor Detail

JMIStreamFactory

public JMIStreamFactory()
Method Detail

createStream

public OutputStream createStream(List pkg,
                                 String className)
                          throws IOException
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 createStream(List, String, String) with the last parameter set to EXT_JAVA.

Parameters:
pkg - Parsed package name.
className - Class name.
Returns:
Created stream, or null if nothing needs to be written for the class or interface.
Throws:
IOException - I/O error during stream creation.

createStream

public abstract OutputStream createStream(List pkg,
                                          String className,
                                          String extension)
                                   throws IOException
Creates a new output stream based on a provided package name, class name and extension for the returned stream should correspond to (e.g. EXT_CLASS to generate byte code or 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.

Parameters:
pkg - Parsed package name.
className - Class name.
extension - The type of file that should be generated.
Returns:
Created stream, or null if nothing needs to be written for the class or interface.
Throws:
IOException - I/O error during stream creation.

org.netbeans.api.mdr/1 1.4.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.