Package org.bytemechanics.commons.string
Class Figlet
- java.lang.Object
-
- org.bytemechanics.commons.string.Figlet
-
public class Figlet extends Object
- Since:
- 1.3.0
- Author:
- afarre
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Figlet.NoFigletFontFormatException
Exception to report that provided font url is not valid
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String[]
fillColumn(String _column)
int
length(String _phrase)
Calculate the length of the banner without compressionint
length(String _phrase, boolean _compressed)
Calculate the length of the bannerString
line(String _phrase, boolean _compressed, char _filler)
Returns an string with the same length of the _phrase but filled with _fillerString
line(String _phrase, char _filler)
Returns an string with the same length of the _phrase but filled with _filler without compressionString
print(String _phrase)
Returns an string that represents the _phrase using the loaded fontString
print(String _phrase, boolean _compressed)
Returns an string that represents the _phrase using the loaded fontprotected String[]
render(char _character, boolean _compressed)
Renderizes any character if compressed is true removes first and last columnprotected String[]
render(String _phrase, boolean _compressed)
Renderizes the given phrase if compressed is true then each character is renderized without the first and the last columnprotected String[]
renderCharacter(char _character, boolean _compressed)
Renderizes a printable character if compressed is true removes first and last columnprotected String[]
renderTab()
Renderizes a tab character
-
-
-
Constructor Detail
-
Figlet
public Figlet(Path _figletFontFile, Charset _charset) throws IOException
- Throws:
IOException
-
Figlet
public Figlet(InputStream _inputStream, Charset _charset) throws IOException
- Throws:
IOException
-
-
Method Detail
-
renderTab
protected String[] renderTab()
Renderizes a tab character- Returns:
- list of string lines with the tab escape character
-
renderCharacter
protected String[] renderCharacter(char _character, boolean _compressed)
Renderizes a printable character if compressed is true removes first and last column- Parameters:
_character
- character to render_compressed
- compressing flag (remove first and last columns)- Returns:
- list of string that represents the scanlines of the given character
-
render
protected String[] render(char _character, boolean _compressed)
Renderizes any character if compressed is true removes first and last column- Parameters:
_character
- character to render_compressed
- compressing flag (remove first and last columns)- Returns:
- list of string that represents the scanlines of the given character
-
render
protected String[] render(String _phrase, boolean _compressed)
Renderizes the given phrase if compressed is true then each character is renderized without the first and the last column- Parameters:
_phrase
- phrase to render_compressed
- compressing flag (remove first and last columns)- Returns:
- list of string that represents the scanlines of the given phrase
-
print
public String print(String _phrase, boolean _compressed)
Returns an string that represents the _phrase using the loaded font- Parameters:
_phrase
- phrase to represent_compressed
- compressing flag (remove first and last columns)- Returns:
- string that represents the phrase with the provided font
-
print
public String print(String _phrase)
Returns an string that represents the _phrase using the loaded font- Parameters:
_phrase
- phrase to represent- Returns:
- string that represents the phrase with the provided font
-
length
public int length(String _phrase, boolean _compressed)
Calculate the length of the banner- Parameters:
_phrase
- phrase to calculate length_compressed
- if phrase must be considered compressed- Returns:
- the length of the banner
-
length
public int length(String _phrase)
Calculate the length of the banner without compression- Parameters:
_phrase
- phrase to calculate length- Returns:
- the length of the banner
-
line
public String line(String _phrase, boolean _compressed, char _filler)
Returns an string with the same length of the _phrase but filled with _filler- Parameters:
_phrase
- phrase to represent_compressed
- if phrase must be considered compressed_filler
- character to fill the same phrase length in the returned string- Returns:
- string with the same length of the phrase corresponding banner but with only onle line filled with _filler
-
line
public String line(String _phrase, char _filler)
Returns an string with the same length of the _phrase but filled with _filler without compression- Parameters:
_phrase
- phrase to represent_filler
- character to fill the same phrase length in the returned string- Returns:
- string with the same length of the phrase corresponding banner but with only onle line filled with _filler
-
-