Package com.oss.asn1

Interface Printable


public interface Printable
This interface allows you to override the standard methods that are used to print the values of ASN.1 types. Whenever the subclass of AbstractData implements the Printable interface, its print(int, PrintWriter) method is called to print the value of the type.
Since:
ASN.1/Java 1.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    This mode indicates the customized print method has been called after the invocation of the default printing routine.
    static final int
    This mode indicates the customized print method has been called before the invocation of the default printing routine.
    static final int
    This result code instructs the DataPrinter to invoke the default print method for the value after return from the customized print routine.
    static final int
    This result code indicates that the value has been printed by the customized print routine and invocation of the default print method for the value is not required.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    print(int mode, PrintWriter s)
    Prints the data value.
  • Field Details

    • CONTINUE

      static final int CONTINUE
      This result code instructs the DataPrinter to invoke the default print method for the value after return from the customized print routine.
      See Also:
    • DONE

      static final int DONE
      This result code indicates that the value has been printed by the customized print routine and invocation of the default print method for the value is not required.
      See Also:
    • BEFORE

      static final int BEFORE
      This mode indicates the customized print method has been called before the invocation of the default printing routine.
      See Also:
    • AFTER

      static final int AFTER
      This mode indicates the customized print method has been called after the invocation of the default printing routine.
      See Also:
  • Method Details

    • print

      int print(int mode, PrintWriter s) throws UserPrintFailedException
      Prints the data value. This method is invoked at most twice: before the invocation of the default printing routine (the mode parameter is set to BEFORE by the caller) and, optionally, after the default value notation has been printed (the caller sets the mode parameter to AFTER on this second call). The second invocation does not occur if the first call to the customized print routine returned the DONE result code. Extra caution should be taken when the customized print method calls the toString() method of AbstractData. Since the toString() implicitly calls the customized print method, an infinite recursion might occur. It is strongly recommended that the customized print method not print any newline characters, since it can cause havoc to the formatting style.
      Parameters:
      mode - either BEFORE or AFTER
      s - PrintWriter to print the value.
      Returns:
      the result code, either CONTINUE or DONE. The caller ignores the result code when it invokes the customized print method with mode argument set to AFTER.
      Throws:
      UserPrintFailedException - thrown if the customized method fails.