net.percederberg.mibble
Class MibWriter

java.lang.Object
  extended by net.percederberg.mibble.MibWriter

public class MibWriter
extends java.lang.Object

A MIB output stream writer. This class contains a pretty printer for a loaded MIB. All macros and data are printed in SMIv2 format, and no translation from SMIv1 to SMIv2 takes place. The optional SMIv1 backward compability flag may be set, which should allow SMIv1 MIB:s to be printed correctly (but still without any translation).

Since:
2.6

Constructor Summary
MibWriter(java.io.OutputStream os)
          Creates a new MIB writer.
MibWriter(java.io.Writer os)
          Creates a new MIB writer without any print margin.
MibWriter(java.io.Writer os, int margin)
          Creates a new MIB writer.
 
Method Summary
 void close()
          Closes the underlying output stream.
 void print(Mib mib)
          Prints the specified MIB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MibWriter

public MibWriter(java.io.OutputStream os)
Creates a new MIB writer. When using this constructor, please make sure that the output stream can handle text output.

Parameters:
os - the underlying output stream to use

MibWriter

public MibWriter(java.io.Writer os)
Creates a new MIB writer without any print margin.

Parameters:
os - the underlying writer to use

MibWriter

public MibWriter(java.io.Writer os,
                 int margin)
Creates a new MIB writer. By specifying a non-zero print margin, all comments and descriptions in the MIB may be subject to reformatting if the output lines become too long. For the best printing results, the source MIB file should be edited manually instead of attempting to correct the print margin automatically here.

Parameters:
os - the underlying writer to use
margin - the print margin, or zero (0) for none
Method Detail

close

public void close()
Closes the underlying output stream. No further print methods in this class should be called after this.


print

public void print(Mib mib)
Prints the specified MIB.

Parameters:
mib - the MIB to print