Skip navigation links
org.netbeans.api.io 1.6.1

I/O API and SPI
Official

See: Description

I/O API and SPI 
Package Description
org.netbeans.api.io  
org.netbeans.spi.io  
org.netbeans.spi.io.support  

NbInputOutputAPI

The module contains APIs for creating output panes (e.g. output tabs in Output Window in the IDE) and for writing data into them. It also supports some advanced techniques, e.g. color text, hyperlinks, code folding, scrolling to stored positions.

NbInputOutputSPI

SPI for providing custom implementations of output window is also included in this module, in package org.netbeans.spi.io

What is New (see all changes)?

Use Cases

Print a simple output to a new output tab

The basic use-case is printing a simple text, e.g. text output of an application, into a dedicated pane in the UI, e.g. a tab in Output Window in the IDE.

    InputOutput io = InputOutput.get("UseCase1", true);
    io.getOut().println("This is a simple output");
    io.getOut().close();
            
Print a line with hyperlink for invocation of arbitrary code

Hyperlinks can be also used to invoke some code when clicked.

    InputOutput io = InputOutput.get("UseCase3", true);
    io.getOut().print("A line containing a ");
    io.getOut().print("hyperlink", Hyperlink.from(new Runnable() {
        public void run() {
            System.gc();
        }
    }));
    io.getOut().println(" for invocation of custom code.");
    io.getOut().close();
            
Print color text

Print a color text. Users can select a predefined color for common cases (debug, warning, failure, success), or custom color specified as RGB value.

    InputOutput io = InputOutput.get("UseCase4", true);
    io.getOut().println("Let's print some info", OutputColor.debug());
    io.getOut().println("or warning with appropriate color", OutputColor.warning());
    io.getOut().println("Maybe also text with custom reddish color", OutputColor.rgb(255, 16, 16));
    io.getOut().close();
            
Reset an InputOutput to clear all previosly printed text

It is possible to reuse already created output pane and clear all the previously printed text if it is not needed any more.

    InputOutput io = InputOutput.get("UseCase5", true);
    io.getOut().println("Let's print some text");
    io.getErr().println("and reset the pane immediately.");
    io.reset();
    io.getOut().println("The pane is now empty and we can reuse it simply");
    io.getOut().close();
            

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
NbInputOutputAPIExportedOfficial .../org/netbeans/api/io/package-summary.html

The module contains APIs for creating output panes (e.g. output tabs in Output Window in the IDE) and for writing data into them. It also supports some advanced techniques, e.g. color text, hyperlinks, code folding, scrolling to stored positions.

NbInputOutputSPIExportedOfficial .../org/netbeans/spi/io/package-summary.html

SPI for providing custom implementations of output window is also included in this module, in package org.netbeans.spi.io

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans Mercurial repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

Normal module dependency is enough.

Availability of some implementation of the SPI is guaranteed by "OpenIDE-Module-Needs: org.netbeans.spi.io.InputOutputProvider" in the manifest of this module.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.api.io 1.6.1