trait TableWriter extends AnyRef
Defines table writer.
Usage
Below is an example of how to create, configure, and use the default
TableWriter
.
// Build table with first row as table header val table = t2.TableBuilder() .add("#", "Effective Date", "Currency Code", "Exchange Rate") .add("1", "2021-01-04", "USD", "0.690236") .add("2", "2021-01-05", "USD", "0.690627") .add("3", "2021-01-06", "USD", "0.689332") .build() // Create table writer with supplied configuration val writer = t2.TableWriter( "ansiColorEnabled" -> "true", "tableBorderColor" -> "cyan", "tableHeaderColor" -> "black,yellowBackground", "bodyRuleColor" -> "yellow", "rowHeaderEnabled" -> "true", "rowHeaderColor" -> "bold,cyan", "columnRightAlign" -> "0,3" // Right align first and last columns ) // Write table to stdout writer.write(System.out, table)
The generated output would look something like the following if printed to a color-enabled terminal.
=================================================== # Effective Date Currency Code Exchange Rate --------------------------------------------------- 1 2021-01-04 USD 0.690236 2 2021-01-05 USD 0.690627 3 2021-01-06 USD 0.689332 ===================================================
The table writer can be configured for changing such things as cell padding, character used for table borders, and more.
- Alphabetic
- By Inheritance
- TableWriter
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
write(out: OutputStream, table: Table): Unit
Writes table to given output.
Writes table to given output.
- out
output stream
- table
input table