Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
org.fusesource.jansi:jansi
Advanced tools
Jansi is a java library for generating and interpreting ANSI escape sequences.
Jansi is a small java library that allows you to use ANSI escape codes to format your console output which works even on Windows.
It also provides the required JNI libraries:
Most unix terminals support rendering ANSI escape codes when Java sends them
via System.out
, but when this is done on Windows, they don't get interpreted
and you get garbage on the console.
Furthermore, even when on Unix, when process output is being redirected to a file, you typically don't want to output escape codes to the file since most file viewers and editors will not properly display the escape codes.
Jansi detects and abstracts the ANSI support provided by the attached terminal. When your Java application uses Jansi, it can always assume that standard out and error streams support ANSI sequences. Depending on the platform and if the application output is attached to a real terminal, Jansi will do one of the following with the ANSI escape codes that it receives:
Enabling the Jansi ANSI support into your application is as simple as doing a simple static method call:
import org.fusesource.jansi.AnsiConsole;
...
AnsiConsole.systemInstall();
Disabling it is also done via a static method:
AnsiConsole.systemUninstall();
It is safe to call those methods multiple times, they keep track of how many
times systemInstall()
has been called and only uninstalls when the
systemUninstall()
method is called a corresponding number of times.
Using the Ansi escape sequence builder:
import static org.fusesource.jansi.Ansi.*;
import static org.fusesource.jansi.Ansi.Color.*;
...
System.out.println( ansi().eraseScreen().fg(RED).a("Hello").fg(GREEN).a(" World").reset() );
The above will clear the screen, write Hello
in red and World
in green,
then reset the color attributes so that subsequent data printed to the stream
uses the default colors.
But there is an even simpler way to accomplish the above using the render
method:
System.out.println( ansi().eraseScreen().render("@|red Hello|@ @|green World|@") );
FAQs
Jansi is a java library for generating and interpreting ANSI escape sequences.
We found that org.fusesource.jansi:jansi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.