Facilitator of reading and writing on the console.
Complete and easy-to-use console, featuring logging, read and write operations on the console, as well as text file display operations.
- Add one of the options below to the pom.xml file:
<dependency>
<groupId>io.github.wniemiec-io-java</groupId>
<artifactId>consolex</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>wniemiec.io.java</groupId>
<artifactId>consolex</artifactId>
<version>LATEST</version>
</dependency>
- Run
$ mvn install
- Use it
[...]
import wniemiec.io.java.Consolex;
[...]
String line = "hello world";
Consolex.writeHeader(line);
Consolex.writeLine("Simple console message");
Consolex.writeError("Error message");
Consolex.writeWarning("Warning message");
Consolex.writeInfo("Info message");
Consolex.writeDebug("Debug message");
System.out.println( Consolex.getHistory() );
[...]
| Property | Parameter type | Return type | Description | Default parameter value |
|---|---|---|---|---|
| readLine | void |
String |
Reads a line from console | - |
| writeLine | line: Object |
void |
Write a line on the console, putting a line break at the end | - |
| writeLines | `lines: (Object... | List)` | void |
Write lines on the console, putting a line break at the end of each line |
| write | content: Object |
void |
Writes a content on the console without putting a line break at the end of each line | - |
| writeFileLines | file: Path |
void |
Write lines from a text file to the console | - |
| writeFileLinesWithEnumeration | file: Path |
void |
Write lines from a text file to the console. Besides, it shows the line number of each line on the left | - |
| writeDiv | symbol: String |
void |
Writes a division line | "-" |
| writeHeader | title: Object, symbol: String |
void |
Writes a title between two dividers | - , "-" |
| writeError | message: Object |
void |
Displays an error message. | - |
| writeWarning | message: Object |
void |
Displays a warning message. | - |
| writeInfo | message: Object |
void |
Displays an info message. - | |
| writeDebug | message: Object |
void |
Displays a debug message. | - |
| clearHistory | void |
void |
Clears the history of messages sent to the console | - |
| dumpTo | file: Path |
void |
Exports the history of messages sent to the console to a file | - |
| getHistory | void |
List<String> |
Gets messages sent to the console | - |
| setMarginLeft | margin: int |
void |
Defines the distance between messages and the log level tag | - |
| setLoggerLevel | level: LogLevel |
void |
Sets log level. The level defines what type of message will be displayed | - |
| getLoggerLevel | void |
LogLevel |
Gets current log level. The level defines what type of message will be displayed | - |
Details about each version are documented in the releases section.
See the documentation on how you can contribute to the project here.
| Name | Type | Description |
|---|---|---|
| dist | Directory |
Released versions |
| docs | Directory |
Documentation files |
| src | Directory |
Source files |
