# Class NamedInputStream

java.lang.Object
com.snmp4j.smi.NamedInputStream

public class NamedInputStream extends Object
The NamedInputStream class represents an input stream with a name to identify the stream. `SmiManager` uses NamedInputStreams when compiling MIB specifications into its internal MIB repository cache.

The `InputStream` returned by `getInputStream()` must be closed after the `SmiManager.compile(NamedInputStream)` or `SmiManager.compile(NamedInputStream[], CompilationMonitor, boolean, boolean, boolean)` methods have been called.

Author:
  Frank Fock

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `NamedInputStream.ZipFormat`
  A supported ZIP file format

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NamedInputStream(File file)`
  Creates a NamedInputStream from the specified file.
  `NamedInputStream(InputStream inputStream, String name)`
  Creates a NamedInputStream from an `InputStream` and an identifying name.
  `NamedInputStream(InputStream inputStream, String name, NamedInputStream.ZipFormat zipFormat)`
  Creates a NamedInputStream from an `InputStream` and an identifying name.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `InputStream`
  `getInputStream()`
  Gets the `InputStream`.
  `String`
  `getName()`
  Gets the name of the input stream.
  `NamedInputStream.ZipFormat`
  `getZipFormat()`
  Gets the compression format of the stream.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NamedInputStream

    public NamedInputStream(File file) throws FileNotFoundException
    Creates a NamedInputStream from the specified file.
    Parameters:
      `file` - the file to create a named input stream for.
    Throws:
      `FileNotFoundException` - if the file cannot be found.

  - ### NamedInputStream

    public NamedInputStream(InputStream inputStream, String name)
    Creates a NamedInputStream from an `InputStream` and an identifying name.
    Parameters:
      `inputStream` - the `InputStream` reference. It will/should not be closed by users of this NamedInputStream.
      `name` - a unique name of the stream (i.e., a file name).

  - ### NamedInputStream

    public NamedInputStream(InputStream inputStream, String name, NamedInputStream.ZipFormat zipFormat)
    Creates a NamedInputStream from an `InputStream` and an identifying name.
    Parameters:
      `inputStream` - the `InputStream` reference. It will/should not be closed by users of this NamedInputStream.
      `name` - a unique name of the stream (i.e., a file name).
      `zipFormat` - the compression and archive format of the `inputStream`.

- ## Method Details

  - ### getInputStream

    public InputStream getInputStream()
    Gets the `InputStream`. Callers should not close it. Closing the stream should be done by the creator of this NamedInputStream.
    Returns:
      the input stream.

  - ### getName

    public String getName()
    Gets the name of the input stream.
    Returns:
      a name for the input stream.

  - ### getZipFormat

    public NamedInputStream.ZipFormat getZipFormat()
    Gets the compression format of the stream. For uncompressed streams `NamedInputStream.ZipFormat.none` will be returned.
    Returns:
      the `NamedInputStream.ZipFormat` of this input stream.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`