diff --git a/readline/src/main/java/org/aesh/readline/CompositeSuggestionProvider.java b/readline/src/main/java/org/aesh/readline/CompositeSuggestionProvider.java index 33f88f66..62885418 100644 --- a/readline/src/main/java/org/aesh/readline/CompositeSuggestionProvider.java +++ b/readline/src/main/java/org/aesh/readline/CompositeSuggestionProvider.java @@ -5,8 +5,14 @@ */ public class CompositeSuggestionProvider implements SuggestionProvider { + /** Field. */ private final SuggestionProvider[] providers; + /** + * Constructor. + * + * @param providers the suggestion providers to chain + */ public CompositeSuggestionProvider(SuggestionProvider... providers) { this.providers = providers; } diff --git a/readline/src/main/java/org/aesh/readline/action/KeyMappingTrie.java b/readline/src/main/java/org/aesh/readline/action/KeyMappingTrie.java index 48391caf..254d1890 100644 --- a/readline/src/main/java/org/aesh/readline/action/KeyMappingTrie.java +++ b/readline/src/main/java/org/aesh/readline/action/KeyMappingTrie.java @@ -33,6 +33,10 @@ */ public class KeyMappingTrie { + /** Constructor. */ + public KeyMappingTrie() { + } + private final TrieNode root = new TrieNode(); // Pre-computed single-byte lookups for fast path diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/BeginningOfHistory.java b/readline/src/main/java/org/aesh/readline/action/mappings/BeginningOfHistory.java index 649bda94..addd0d31 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/BeginningOfHistory.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/BeginningOfHistory.java @@ -28,6 +28,10 @@ */ public class BeginningOfHistory implements Action { + /** Constructor. */ + public BeginningOfHistory() { + } + @Override public String name() { return "beginning-of-history"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearch.java b/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearch.java index 27cda7bc..12f169a3 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearch.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearch.java @@ -30,6 +30,10 @@ */ public class CharacterSearch implements ActionEvent { + /** Constructor. */ + public CharacterSearch() { + } + private boolean waitingForInput = false; private int searchChar = -1; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearchBackward.java b/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearchBackward.java index b2fc8404..5c3f8823 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearchBackward.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/CharacterSearchBackward.java @@ -30,6 +30,10 @@ */ public class CharacterSearchBackward implements ActionEvent { + /** Constructor. */ + public CharacterSearchBackward() { + } + private boolean waitingForInput = false; private int searchChar = -1; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/DeleteCharOrList.java b/readline/src/main/java/org/aesh/readline/action/mappings/DeleteCharOrList.java index ded6523b..ef068aa3 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/DeleteCharOrList.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/DeleteCharOrList.java @@ -31,6 +31,10 @@ */ public class DeleteCharOrList implements Action { + /** Constructor. */ + public DeleteCharOrList() { + } + @Override public String name() { return "delete-char-or-list"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/DeleteHorizontalSpace.java b/readline/src/main/java/org/aesh/readline/action/mappings/DeleteHorizontalSpace.java index a87995ad..31bd0d83 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/DeleteHorizontalSpace.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/DeleteHorizontalSpace.java @@ -28,6 +28,10 @@ */ public class DeleteHorizontalSpace implements Action { + /** Constructor. */ + public DeleteHorizontalSpace() { + } + @Override public String name() { return "delete-horizontal-space"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/EndOfHistory.java b/readline/src/main/java/org/aesh/readline/action/mappings/EndOfHistory.java index 202f47a7..1e84bf1b 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/EndOfHistory.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/EndOfHistory.java @@ -28,6 +28,10 @@ */ public class EndOfHistory implements Action { + /** Constructor. */ + public EndOfHistory() { + } + @Override public String name() { return "end-of-history"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/ExchangePointAndMark.java b/readline/src/main/java/org/aesh/readline/action/mappings/ExchangePointAndMark.java index 1dd6e083..b4a0cc25 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/ExchangePointAndMark.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/ExchangePointAndMark.java @@ -29,6 +29,10 @@ */ public class ExchangePointAndMark implements Action { + /** Constructor. */ + public ExchangePointAndMark() { + } + @Override public String name() { return "exchange-point-and-mark"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchBackward.java b/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchBackward.java index d46fad8f..5aa55932 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchBackward.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchBackward.java @@ -32,6 +32,10 @@ */ public class HistorySearchBackward implements Action { + /** Constructor. */ + public HistorySearchBackward() { + } + private int searchIndex = -1; @Override diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchForward.java b/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchForward.java index ebcec558..bdbfa6d8 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchForward.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/HistorySearchForward.java @@ -32,6 +32,10 @@ */ public class HistorySearchForward implements Action { + /** Constructor. */ + public HistorySearchForward() { + } + private int searchIndex = -1; @Override diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/InsertComment.java b/readline/src/main/java/org/aesh/readline/action/mappings/InsertComment.java index 75d40b48..f43cd9e6 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/InsertComment.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/InsertComment.java @@ -29,6 +29,10 @@ */ public class InsertComment implements Action { + /** Constructor. */ + public InsertComment() { + } + @Override public String name() { return "insert-comment"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/KillRegion.java b/readline/src/main/java/org/aesh/readline/action/mappings/KillRegion.java index f4e8ab7d..6816b131 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/KillRegion.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/KillRegion.java @@ -31,6 +31,10 @@ */ public class KillRegion implements Action { + /** Constructor. */ + public KillRegion() { + } + @Override public String name() { return "kill-region"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalForwardSearchHistory.java b/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalForwardSearchHistory.java index 1d4582bf..ccc5e32e 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalForwardSearchHistory.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalForwardSearchHistory.java @@ -29,8 +29,10 @@ */ public class NonIncrementalForwardSearchHistory extends NonIncrementalSearchHistory { + /** Search prompt. */ private static final int[] PROMPT = Parser.toCodePoints("(forward-search): "); + /** Constructor. */ public NonIncrementalForwardSearchHistory() { super(SearchDirection.FORWARD, PROMPT); } diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalReverseSearchHistory.java b/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalReverseSearchHistory.java index 80c25bc9..8898605e 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalReverseSearchHistory.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/NonIncrementalReverseSearchHistory.java @@ -29,8 +29,10 @@ */ public class NonIncrementalReverseSearchHistory extends NonIncrementalSearchHistory { + /** Search prompt. */ private static final int[] PROMPT = Parser.toCodePoints("(reverse-search): "); + /** Constructor. */ public NonIncrementalReverseSearchHistory() { super(SearchDirection.REVERSE, PROMPT); } diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/OverwriteMode.java b/readline/src/main/java/org/aesh/readline/action/mappings/OverwriteMode.java index b21e521d..e919e8b1 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/OverwriteMode.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/OverwriteMode.java @@ -29,6 +29,10 @@ */ public class OverwriteMode implements Action { + /** Constructor. */ + public OverwriteMode() { + } + @Override public String name() { return "overwrite-mode"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/PossibleCompletions.java b/readline/src/main/java/org/aesh/readline/action/mappings/PossibleCompletions.java index e08a08e2..1e905dc8 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/PossibleCompletions.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/PossibleCompletions.java @@ -27,6 +27,10 @@ */ public class PossibleCompletions implements Action { + /** Constructor. */ + public PossibleCompletions() { + } + @Override public String name() { return "possible-completions"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/QuotedInsert.java b/readline/src/main/java/org/aesh/readline/action/mappings/QuotedInsert.java index 076cfb3e..60559cba 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/QuotedInsert.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/QuotedInsert.java @@ -30,6 +30,10 @@ */ public class QuotedInsert implements ActionEvent { + /** Constructor. */ + public QuotedInsert() { + } + private boolean waitingForInput = false; private int[] storedKey = null; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/RedrawCurrentLine.java b/readline/src/main/java/org/aesh/readline/action/mappings/RedrawCurrentLine.java index 7c77d29f..be445226 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/RedrawCurrentLine.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/RedrawCurrentLine.java @@ -27,6 +27,10 @@ */ public class RedrawCurrentLine implements Action { + /** Constructor. */ + public RedrawCurrentLine() { + } + @Override public String name() { return "redraw-current-line"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/RevertLine.java b/readline/src/main/java/org/aesh/readline/action/mappings/RevertLine.java index c71d69ea..76d1502f 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/RevertLine.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/RevertLine.java @@ -29,6 +29,10 @@ */ public class RevertLine implements Action { + /** Constructor. */ + public RevertLine() { + } + @Override public String name() { return "revert-line"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/SetMark.java b/readline/src/main/java/org/aesh/readline/action/mappings/SetMark.java index 26ec9ead..acc067ff 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/SetMark.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/SetMark.java @@ -28,6 +28,10 @@ */ public class SetMark implements Action { + /** Constructor. */ + public SetMark() { + } + @Override public String name() { return "set-mark"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/TildeExpand.java b/readline/src/main/java/org/aesh/readline/action/mappings/TildeExpand.java index cbe48fa3..4f29377d 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/TildeExpand.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/TildeExpand.java @@ -30,6 +30,10 @@ */ public class TildeExpand implements Action { + /** Constructor. */ + public TildeExpand() { + } + @Override public String name() { return "tilde-expand"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/TransposeChars.java b/readline/src/main/java/org/aesh/readline/action/mappings/TransposeChars.java index 2c95721a..9ca46c21 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/TransposeChars.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/TransposeChars.java @@ -30,6 +30,10 @@ */ public class TransposeChars implements Action { + /** Constructor. */ + public TransposeChars() { + } + @Override public String name() { return "transpose-chars"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/TransposeWords.java b/readline/src/main/java/org/aesh/readline/action/mappings/TransposeWords.java index 6eaa5425..c179b42e 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/TransposeWords.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/TransposeWords.java @@ -30,6 +30,10 @@ */ public class TransposeWords implements Action { + /** Constructor. */ + public TransposeWords() { + } + @Override public String name() { return "transpose-words"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/UnixFilenameRubout.java b/readline/src/main/java/org/aesh/readline/action/mappings/UnixFilenameRubout.java index 34968157..e927fa0b 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/UnixFilenameRubout.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/UnixFilenameRubout.java @@ -31,6 +31,10 @@ */ public class UnixFilenameRubout implements Action { + /** Constructor. */ + public UnixFilenameRubout() { + } + @Override public String name() { return "unix-filename-rubout"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/YankLastArg.java b/readline/src/main/java/org/aesh/readline/action/mappings/YankLastArg.java index 644f0ff5..9e331ce7 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/YankLastArg.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/YankLastArg.java @@ -30,6 +30,10 @@ */ public class YankLastArg implements Action { + /** Constructor. */ + public YankLastArg() { + } + @Override public String name() { return "yank-last-arg"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/YankNthArg.java b/readline/src/main/java/org/aesh/readline/action/mappings/YankNthArg.java index c7d2efa7..78deb70c 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/YankNthArg.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/YankNthArg.java @@ -31,6 +31,10 @@ */ public class YankNthArg implements Action { + /** Constructor. */ + public YankNthArg() { + } + @Override public String name() { return "yank-nth-arg"; diff --git a/readline/src/main/java/org/aesh/readline/action/mappings/YankPop.java b/readline/src/main/java/org/aesh/readline/action/mappings/YankPop.java index 98d06fe0..b557a906 100644 --- a/readline/src/main/java/org/aesh/readline/action/mappings/YankPop.java +++ b/readline/src/main/java/org/aesh/readline/action/mappings/YankPop.java @@ -28,6 +28,10 @@ */ public class YankPop implements Action { + /** Constructor. */ + public YankPop() { + } + private int killRingIndex = 0; @Override diff --git a/readline/src/main/java/org/aesh/readline/paste/PasteManager.java b/readline/src/main/java/org/aesh/readline/paste/PasteManager.java index 224c9f80..4dc38109 100644 --- a/readline/src/main/java/org/aesh/readline/paste/PasteManager.java +++ b/readline/src/main/java/org/aesh/readline/paste/PasteManager.java @@ -57,6 +57,11 @@ public void setClipboardWriter(Consumer clipboardWriter) { this.clipboardWriter = clipboardWriter; } + /** + * Add text to the paste stack. + * + * @param buffer the text to add + */ public void addText(int[] buffer) { checkSize(); pasteStack.add(buffer); diff --git a/terminal-api/src/main/java/org/aesh/terminal/AbstractConnection.java b/terminal-api/src/main/java/org/aesh/terminal/AbstractConnection.java index 0dfe679d..6374939a 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/AbstractConnection.java +++ b/terminal-api/src/main/java/org/aesh/terminal/AbstractConnection.java @@ -37,12 +37,23 @@ */ public abstract class AbstractConnection implements Connection { + /** Field. */ protected EventDecoder eventDecoder; + /** Field. */ protected Consumer stdout; + /** Field. */ protected Consumer sizeHandler; + /** Field. */ protected Consumer closeHandler; + /** Field. */ protected Attributes attributes; + /** Field. */ protected volatile boolean reading; + + /** Constructor. */ + protected AbstractConnection() { + } + private TerminalFeatures terminalFeatures; @Override diff --git a/terminal-api/src/main/java/org/aesh/terminal/Device.java b/terminal-api/src/main/java/org/aesh/terminal/Device.java index c6304e0e..e97075cc 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/Device.java +++ b/terminal-api/src/main/java/org/aesh/terminal/Device.java @@ -59,6 +59,11 @@ enum OscCode { this.code = code; } + /** + * Method. + * + * @return the value + */ public int getCode() { return code; } @@ -203,14 +208,30 @@ enum TerminalType { this.supportsSynchronizedOutput = supportsSynchronizedOutput; } + /** + * Method. + * + * @return the value + */ public String getIdentifier() { return identifier; } + /** + * Method. + * + * @return the supported codes + */ public Set getSupportedCodes() { return supportedCodes; } + /** + * Method. + * + * @param code the code to check + * @return the value + */ public boolean supports(OscCode code) { return supportedCodes.contains(code); } diff --git a/terminal-api/src/main/java/org/aesh/terminal/DeviceAttributes.java b/terminal-api/src/main/java/org/aesh/terminal/DeviceAttributes.java index 1fb9209b..f917ed11 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/DeviceAttributes.java +++ b/terminal-api/src/main/java/org/aesh/terminal/DeviceAttributes.java @@ -84,6 +84,11 @@ public enum Feature { this.code = code; } + /** + * Method. + * + * @return the value + */ public int getCode() { return code; } @@ -108,18 +113,31 @@ public static Feature fromCode(int code) { * Terminal type identifiers from DA2 response. */ public enum TerminalType { + /** Vt100. */ VT100(0, "VT100"), + /** Vt220. */ VT220(1, "VT220"), + /** Vt240. */ VT240(2, "VT240"), + /** Vt330. */ VT330(18, "VT330"), + /** Vt340. */ VT340(19, "VT340"), + /** Vt320. */ VT320(24, "VT320"), + /** Vt382. */ VT382(32, "VT382"), + /** Vt420. */ VT420(41, "VT420"), + /** Vt510. */ VT510(61, "VT510"), + /** Vt520. */ VT520(64, "VT520"), + /** Vt525. */ VT525(65, "VT525"), + /** Xterm. */ XTERM(0, "xterm"), // xterm uses 0 but different version format + /** Unknown. */ UNKNOWN(-1, "Unknown"); private final int code; @@ -130,10 +148,20 @@ public enum TerminalType { this.name = name; } + /** + * Method. + * + * @return the value + */ public int getCode() { return code; } + /** + * Method. + * + * @return the value + */ public String getName() { return name; } @@ -554,6 +582,11 @@ public String getCapabilitySummary(Device.TerminalType envType) { } @Override + /** + * Method. + * + * @return the value + */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("DeviceAttributes{"); diff --git a/terminal-api/src/main/java/org/aesh/terminal/TerminalFeatures.java b/terminal-api/src/main/java/org/aesh/terminal/TerminalFeatures.java index c2a1b05e..1f59c94a 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/TerminalFeatures.java +++ b/terminal-api/src/main/java/org/aesh/terminal/TerminalFeatures.java @@ -71,6 +71,11 @@ public class TerminalFeatures { private final Connection connection; + /** + * Constructor. + * + * @param connection the connection + */ public TerminalFeatures(Connection connection) { this.connection = connection; } diff --git a/terminal-api/src/main/java/org/aesh/terminal/utils/ANSIBuilder.java b/terminal-api/src/main/java/org/aesh/terminal/utils/ANSIBuilder.java index b4ba06f1..bb80e132 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/utils/ANSIBuilder.java +++ b/terminal-api/src/main/java/org/aesh/terminal/utils/ANSIBuilder.java @@ -184,224 +184,488 @@ private ANSIBuilder applySemantic(SemanticColor color, String text) { // ==================== Semantic Color Overrides ==================== - /** Overrides the error color code. @see #semanticCode(SemanticColor, int) */ + /** + * Overrides the error color code. @see #semanticCode(SemanticColor, int) + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder errorCode(int code) { return semanticCode(SemanticColor.ERROR, code); } - /** Overrides the success color code. */ + /** + * Overrides the success color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder successCode(int code) { return semanticCode(SemanticColor.SUCCESS, code); } - /** Overrides the warning color code. */ + /** + * Overrides the warning color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder warningCode(int code) { return semanticCode(SemanticColor.WARNING, code); } - /** Overrides the info color code. */ + /** + * Overrides the info color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder infoCode(int code) { return semanticCode(SemanticColor.INFO, code); } - /** Overrides the debug color code. */ + /** + * Overrides the debug color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder debugCode(int code) { return semanticCode(SemanticColor.DEBUG, code); } - /** Overrides the trace color code. */ + /** + * Overrides the trace color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder traceCode(int code) { return semanticCode(SemanticColor.TRACE, code); } - /** Overrides the timestamp color code. */ + /** + * Overrides the timestamp color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder timestampCode(int code) { return semanticCode(SemanticColor.TIMESTAMP, code); } - /** Overrides the message color code. */ + /** + * Overrides the message color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder messageCode(int code) { return semanticCode(SemanticColor.MESSAGE, code); } - /** Overrides the category color code. */ + /** + * Overrides the category color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder categoryCode(int code) { return semanticCode(SemanticColor.CATEGORY, code); } - /** Overrides the thread name color code. */ + /** + * Overrides the thread name color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder threadNameCode(int code) { return semanticCode(SemanticColor.THREAD_NAME, code); } - /** Overrides the fatal color code. */ + /** + * Overrides the fatal color code. + * + * @param code ANSI color code + * @return this builder + */ public ANSIBuilder fatalCode(int code) { return semanticCode(SemanticColor.FATAL, code); } // ==================== RGB Semantic Color Overrides ==================== - /** Overrides the error color using RGB values (true color). RGB overrides take precedence over code overrides. */ + /** + * Overrides the error color using RGB values (true color). RGB overrides take precedence over code overrides. + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder errorRgb(int r, int g, int b) { return semanticRgb(SemanticColor.ERROR, r, g, b); } - /** Overrides the error color using a hex color value (e.g., "#FF5733" or "FF5733"). */ + /** + * Overrides the error color using a hex color value (e.g., "#FF5733" or "FF5733"). + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder errorHex(String hex) { return semanticHex(SemanticColor.ERROR, hex); } - /** Overrides the error color using HSL values. */ + /** + * Overrides the error color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder errorHsl(float h, float s, float l) { return semanticHsl(SemanticColor.ERROR, h, s, l); } - /** Overrides the success color using RGB values (true color). */ + /** + * Overrides the success color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder successRgb(int r, int g, int b) { return semanticRgb(SemanticColor.SUCCESS, r, g, b); } - /** Overrides the success color using a hex color value. */ + /** + * Overrides the success color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder successHex(String hex) { return semanticHex(SemanticColor.SUCCESS, hex); } - /** Overrides the success color using HSL values. */ + /** + * Overrides the success color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder successHsl(float h, float s, float l) { return semanticHsl(SemanticColor.SUCCESS, h, s, l); } - /** Overrides the warning color using RGB values (true color). */ + /** + * Overrides the warning color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder warningRgb(int r, int g, int b) { return semanticRgb(SemanticColor.WARNING, r, g, b); } - /** Overrides the warning color using a hex color value. */ + /** + * Overrides the warning color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder warningHex(String hex) { return semanticHex(SemanticColor.WARNING, hex); } - /** Overrides the warning color using HSL values. */ + /** + * Overrides the warning color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder warningHsl(float h, float s, float l) { return semanticHsl(SemanticColor.WARNING, h, s, l); } - /** Overrides the info color using RGB values (true color). */ + /** + * Overrides the info color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder infoRgb(int r, int g, int b) { return semanticRgb(SemanticColor.INFO, r, g, b); } - /** Overrides the info color using a hex color value. */ + /** + * Overrides the info color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder infoHex(String hex) { return semanticHex(SemanticColor.INFO, hex); } - /** Overrides the info color using HSL values. */ + /** + * Overrides the info color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder infoHsl(float h, float s, float l) { return semanticHsl(SemanticColor.INFO, h, s, l); } - /** Overrides the debug color using RGB values (true color). */ + /** + * Overrides the debug color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder debugRgb(int r, int g, int b) { return semanticRgb(SemanticColor.DEBUG, r, g, b); } - /** Overrides the debug color using a hex color value. */ + /** + * Overrides the debug color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder debugHex(String hex) { return semanticHex(SemanticColor.DEBUG, hex); } - /** Overrides the debug color using HSL values. */ + /** + * Overrides the debug color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder debugHsl(float h, float s, float l) { return semanticHsl(SemanticColor.DEBUG, h, s, l); } - /** Overrides the trace color using RGB values (true color). */ + /** + * Overrides the trace color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder traceRgb(int r, int g, int b) { return semanticRgb(SemanticColor.TRACE, r, g, b); } - /** Overrides the trace color using a hex color value. */ + /** + * Overrides the trace color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder traceHex(String hex) { return semanticHex(SemanticColor.TRACE, hex); } - /** Overrides the trace color using HSL values. */ + /** + * Overrides the trace color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder traceHsl(float h, float s, float l) { return semanticHsl(SemanticColor.TRACE, h, s, l); } - /** Overrides the timestamp color using RGB values (true color). */ + /** + * Overrides the timestamp color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder timestampRgb(int r, int g, int b) { return semanticRgb(SemanticColor.TIMESTAMP, r, g, b); } - /** Overrides the timestamp color using a hex color value. */ + /** + * Overrides the timestamp color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder timestampHex(String hex) { return semanticHex(SemanticColor.TIMESTAMP, hex); } - /** Overrides the timestamp color using HSL values. */ + /** + * Overrides the timestamp color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder timestampHsl(float h, float s, float l) { return semanticHsl(SemanticColor.TIMESTAMP, h, s, l); } - /** Overrides the message color using RGB values (true color). */ + /** + * Overrides the message color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder messageRgb(int r, int g, int b) { return semanticRgb(SemanticColor.MESSAGE, r, g, b); } - /** Overrides the message color using a hex color value. */ + /** + * Overrides the message color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder messageHex(String hex) { return semanticHex(SemanticColor.MESSAGE, hex); } - /** Overrides the message color using HSL values. */ + /** + * Overrides the message color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder messageHsl(float h, float s, float l) { return semanticHsl(SemanticColor.MESSAGE, h, s, l); } - /** Overrides the category color using RGB values (true color). */ + /** + * Overrides the category color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder categoryRgb(int r, int g, int b) { return semanticRgb(SemanticColor.CATEGORY, r, g, b); } - /** Overrides the category color using a hex color value. */ + /** + * Overrides the category color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder categoryHex(String hex) { return semanticHex(SemanticColor.CATEGORY, hex); } - /** Overrides the category color using HSL values. */ + /** + * Overrides the category color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder categoryHsl(float h, float s, float l) { return semanticHsl(SemanticColor.CATEGORY, h, s, l); } - /** Overrides the thread name color using RGB values (true color). */ + /** + * Overrides the thread name color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder threadNameRgb(int r, int g, int b) { return semanticRgb(SemanticColor.THREAD_NAME, r, g, b); } - /** Overrides the thread name color using a hex color value. */ + /** + * Overrides the thread name color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder threadNameHex(String hex) { return semanticHex(SemanticColor.THREAD_NAME, hex); } - /** Overrides the thread name color using HSL values. */ + /** + * Overrides the thread name color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder threadNameHsl(float h, float s, float l) { return semanticHsl(SemanticColor.THREAD_NAME, h, s, l); } - /** Overrides the fatal color using RGB values (true color). */ + /** + * Overrides the fatal color using RGB values (true color). + * + * @param r red component + * @param g green component + * @param b blue component + * @return this builder + */ public ANSIBuilder fatalRgb(int r, int g, int b) { return semanticRgb(SemanticColor.FATAL, r, g, b); } - /** Overrides the fatal color using a hex color value. */ + /** + * Overrides the fatal color using a hex color value. + * + * @param hex color in hex format + * @return this builder + */ public ANSIBuilder fatalHex(String hex) { return semanticHex(SemanticColor.FATAL, hex); } - /** Overrides the fatal color using HSL values. */ + /** + * Overrides the fatal color using HSL values. + * + * @param h hue in degrees + * @param s saturation percentage + * @param l lightness percentage + * @return this builder + */ public ANSIBuilder fatalHsl(float h, float s, float l) { return semanticHsl(SemanticColor.FATAL, h, s, l); } @@ -1636,112 +1900,211 @@ private void validateRgb(int r, int g, int b) { // All semantic color methods delegate to applySemantic(). // Color priority: RGB override > code override > capability > default. - /** Sets the foreground color to the theme-appropriate error color (red). */ + /** + * Sets the foreground color to the theme-appropriate error color (red). + * + * @return this builder + */ public ANSIBuilder error() { return applySemantic(SemanticColor.ERROR); } - /** Appends text with error styling (red) and resets. */ + /** + * Appends text with error styling (red) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder error(String text) { return applySemantic(SemanticColor.ERROR, text); } - /** Sets the foreground color to the theme-appropriate success color (green). */ + /** + * Sets the foreground color to the theme-appropriate success color (green). + * + * @return this builder + */ public ANSIBuilder success() { return applySemantic(SemanticColor.SUCCESS); } - /** Appends text with success styling (green) and resets. */ + /** + * Appends text with success styling (green) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder success(String text) { return applySemantic(SemanticColor.SUCCESS, text); } - /** Sets the foreground color to the theme-appropriate warning color (yellow). */ + /** + * Sets the foreground color to the theme-appropriate warning color (yellow). + * + * @return this builder + */ public ANSIBuilder warning() { return applySemantic(SemanticColor.WARNING); } - /** Appends text with warning styling (yellow) and resets. */ + /** + * Appends text with warning styling (yellow) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder warning(String text) { return applySemantic(SemanticColor.WARNING, text); } - /** Sets the foreground color to the theme-appropriate info color (green). */ + /** + * Sets the foreground color to the theme-appropriate info color (green). + * + * @return this builder + */ public ANSIBuilder info() { return applySemantic(SemanticColor.INFO); } - /** Appends text with info styling (green) and resets. */ + /** + * Appends text with info styling (green) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder info(String text) { return applySemantic(SemanticColor.INFO, text); } - /** Sets the foreground color to the theme-appropriate debug color (cyan). */ + /** + * Sets the foreground color to the theme-appropriate debug color (cyan). + * + * @return this builder + */ public ANSIBuilder debug() { return applySemantic(SemanticColor.DEBUG); } - /** Appends text with debug styling and resets. */ + /** + * Appends text with debug styling and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder debug(String text) { return applySemantic(SemanticColor.DEBUG, text); } - /** Sets the foreground color to the theme-appropriate trace color (gray). */ + /** + * Sets the foreground color to the theme-appropriate trace color (gray). + * + * @return this builder + */ public ANSIBuilder trace() { return applySemantic(SemanticColor.TRACE); } - /** Appends text with trace styling and resets. */ + /** + * Appends text with trace styling and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder trace(String text) { return applySemantic(SemanticColor.TRACE, text); } - /** Sets the foreground color to the theme-appropriate timestamp color (gray). */ + /** + * Sets the foreground color to the theme-appropriate timestamp color (gray). + * + * @return this builder + */ public ANSIBuilder timestamp() { return applySemantic(SemanticColor.TIMESTAMP); } - /** Appends text with timestamp styling (gray) and resets. */ + /** + * Appends text with timestamp styling (gray) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder timestamp(String text) { return applySemantic(SemanticColor.TIMESTAMP, text); } - /** Sets the foreground color to the theme-appropriate message color. */ + /** + * Sets the foreground color to the theme-appropriate message color. + * + * @return this builder + */ public ANSIBuilder message() { return applySemantic(SemanticColor.MESSAGE); } - /** Appends text with message styling and resets. */ + /** + * Appends text with message styling and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder message(String text) { return applySemantic(SemanticColor.MESSAGE, text); } - /** Sets the foreground color to the theme-appropriate category color (blue). */ + /** + * Sets the foreground color to the theme-appropriate category color (blue). + * + * @return this builder + */ public ANSIBuilder category() { return applySemantic(SemanticColor.CATEGORY); } - /** Appends text with category styling (blue) and resets. */ + /** + * Appends text with category styling (blue) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder category(String text) { return applySemantic(SemanticColor.CATEGORY, text); } - /** Sets the foreground color to the theme-appropriate thread name color (green). */ + /** + * Sets the foreground color to the theme-appropriate thread name color (green). + * + * @return this builder + */ public ANSIBuilder threadName() { return applySemantic(SemanticColor.THREAD_NAME); } - /** Appends text with thread name styling (green) and resets. */ + /** + * Appends text with thread name styling (green) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder threadName(String text) { return applySemantic(SemanticColor.THREAD_NAME, text); } - /** Sets the foreground color to the theme-appropriate fatal color (red). */ + /** + * Sets the foreground color to the theme-appropriate fatal color (red). + * + * @return this builder + */ public ANSIBuilder fatal() { return applySemantic(SemanticColor.FATAL); } - /** Appends text with fatal styling (red) and resets. */ + /** + * Appends text with fatal styling (red) and resets. + * + * @param text the text to append + * @return this builder + */ public ANSIBuilder fatal(String text) { return applySemantic(SemanticColor.FATAL, text); } @@ -1982,16 +2345,27 @@ public int value() { * for resolving the theme-appropriate code at runtime. */ public enum SemanticColor { + /** Error color (red). */ ERROR(91, TerminalColorCapability::getSuggestedErrorCode), + /** Success color (green). */ SUCCESS(92, TerminalColorCapability::getSuggestedSuccessCode), + /** Warning color (yellow). */ WARNING(93, TerminalColorCapability::getSuggestedWarningCode), + /** Info color (green). */ INFO(92, TerminalColorCapability::getSuggestedInfoCode), + /** Debug color (cyan). */ DEBUG(96, TerminalColorCapability::getSuggestedDebugCode), + /** Trace color (gray). */ TRACE(90, TerminalColorCapability::getSuggestedTraceCode), + /** Timestamp color (gray). */ TIMESTAMP(252, TerminalColorCapability::getSuggestedTimestampCode), + /** Message color (white). */ MESSAGE(37, TerminalColorCapability::getSuggestedMessageCode), + /** Category color (blue). */ CATEGORY(94, TerminalColorCapability::getSuggestedCategoryCode), + /** Thread name color (green). */ THREAD_NAME(92, TerminalColorCapability::getSuggestedThreadNameCode), + /** Fatal color (red). */ FATAL(91, TerminalColorCapability::getSuggestedFatalCode); private final int defaultCode; @@ -2002,12 +2376,21 @@ public enum SemanticColor { this.capabilityGetter = capabilityGetter; } - /** Returns the default ANSI color code for this semantic color. */ + /** + * Returns the default ANSI color code for this semantic color. + * + * @return the default ANSI code + */ public int defaultCode() { return defaultCode; } - /** Returns the suggested ANSI code from the given capability. */ + /** + * Returns the suggested ANSI code from the given capability. + * + * @param cap the terminal color capability + * @return the suggested ANSI code + */ public int getFromCapability(TerminalColorCapability cap) { return capabilityGetter.applyAsInt(cap); } diff --git a/terminal-api/src/main/java/org/aesh/terminal/utils/HtmlAnsiOutputStream.java b/terminal-api/src/main/java/org/aesh/terminal/utils/HtmlAnsiOutputStream.java index 02c30c1c..4e12b5d0 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/utils/HtmlAnsiOutputStream.java +++ b/terminal-api/src/main/java/org/aesh/terminal/utils/HtmlAnsiOutputStream.java @@ -105,11 +105,17 @@ public class HtmlAnsiOutputStream extends OutputStream { private boolean inCsi; private boolean concealOn; + /** + * Constructor. + * + * @param out the output stream + */ public HtmlAnsiOutputStream(OutputStream out) { this.out = out; } @Override + /** Method. */ public void write(int data) throws IOException { if (inCsi) { escBuf.write(data); @@ -137,6 +143,7 @@ public void write(int data) throws IOException { } @Override + /** Method. */ public void write(byte[] b, int off, int len) throws IOException { for (int i = off; i < off + len; i++) { write(b[i] & 0xFF); @@ -144,11 +151,13 @@ public void write(byte[] b, int off, int len) throws IOException { } @Override + /** Method. */ public void flush() throws IOException { out.flush(); } @Override + /** Method. */ public void close() throws IOException { closeAttributes(); out.flush(); diff --git a/terminal-api/src/main/java/org/aesh/terminal/utils/InputReader.java b/terminal-api/src/main/java/org/aesh/terminal/utils/InputReader.java index 1ed96756..291c4d3b 100644 --- a/terminal-api/src/main/java/org/aesh/terminal/utils/InputReader.java +++ b/terminal-api/src/main/java/org/aesh/terminal/utils/InputReader.java @@ -49,7 +49,9 @@ public class InputReader extends Reader { private static final int DEFAULT_CAPACITY = 4096; + /** Field. */ public static final int EOF = -1; + /** Field. */ public static final int TIMEOUT = -2; private final LinkedBlockingQueue queue; @@ -200,6 +202,7 @@ public OptionalInt readCodePoint(long timeout, TimeUnit unit) throws IOException } @Override + /** Method. */ public boolean ready() throws IOException { ensureOpen(); return !queue.isEmpty(); @@ -210,6 +213,7 @@ public boolean ready() throws IOException { * char, then drains remaining available chars without blocking. */ @Override + /** Method. */ public int read(char[] cbuf, int off, int len) throws IOException { ensureOpen(); if (len == 0) { @@ -237,6 +241,7 @@ public int read(char[] cbuf, int off, int len) throws IOException { } @Override + /** Method. */ public void close() { if (closed) { return; diff --git a/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetBootstrap.java b/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetBootstrap.java index 83f8babb..1f8b270e 100644 --- a/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetBootstrap.java +++ b/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetBootstrap.java @@ -33,6 +33,10 @@ */ public abstract class TelnetBootstrap { + /** Constructor. */ + protected TelnetBootstrap() { + } + private String host = "localhost"; private int port = 4000; diff --git a/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetConnection.java b/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetConnection.java index 04310e13..8d110c6f 100644 --- a/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetConnection.java +++ b/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetConnection.java @@ -119,10 +119,27 @@ private void rawWrite(byte[] data, int offset, int length) { } } + /** + * Execute a task. + * + * @param task the task to execute + */ protected abstract void execute(Runnable task); + /** + * Schedule a task. + * + * @param task the task to schedule + * @param delay the delay + * @param unit the time unit + */ protected abstract void schedule(Runnable task, long delay, TimeUnit unit); + /** + * Send data. + * + * @param data the data to send + */ protected abstract void send(byte[] data); /** @@ -162,6 +179,7 @@ public final void write(byte[] data) { } } + /** Method. */ protected void onClose() { handler.onClose(); } @@ -249,6 +267,7 @@ protected void onOptionDont(byte optionCode) { * This method can be subclassed to handle an option. * * @param optionCode the option code + * @param parameters the option parameters */ protected void onOptionParameters(byte optionCode, byte[] parameters) { for (Option option : Option.values()) { diff --git a/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetHandler.java b/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetHandler.java index 03089ced..bc37dced 100644 --- a/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetHandler.java +++ b/terminal-telnet/src/main/java/org/aesh/terminal/telnet/TelnetHandler.java @@ -27,6 +27,10 @@ */ public class TelnetHandler { + /** Constructor. */ + public TelnetHandler() { + } + /** * The telnet connection opened. * diff --git a/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/AbstractExecPty.java b/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/AbstractExecPty.java index 4adb346a..a64613e9 100644 --- a/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/AbstractExecPty.java +++ b/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/AbstractExecPty.java @@ -45,6 +45,11 @@ public abstract class AbstractExecPty implements Pty { private final String name; + /** + * Constructor. + * + * @param name the pty name + */ protected AbstractExecPty(String name) { this.name = name; } @@ -183,6 +188,13 @@ static int doGetInt(String name, String cfg) throws IOException { throw new IOException("Unable to parse " + name); } + /** + * Execute a command. + * + * @param cmd the command to execute + * @return the command output + * @throws IOException if execution fails + */ protected static String exec(final String... cmd) throws IOException { assert cmd != null && !cmd[0].isEmpty(); try { diff --git a/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/WinConsoleNative.java b/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/WinConsoleNative.java index 80363bbd..1f0d8f63 100644 --- a/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/WinConsoleNative.java +++ b/terminal-tty/src/main/java/org/aesh/terminal/tty/impl/WinConsoleNative.java @@ -34,28 +34,63 @@ */ public final class WinConsoleNative { + /** Standard input handle identifier. */ public static final int STD_INPUT_HANDLE = -10; + /** Standard output handle identifier. */ public static final int STD_OUTPUT_HANDLE = -11; + /** Standard error handle identifier. */ public static final int STD_ERROR_HANDLE = -12; + /** Invalid handle sentinel value. */ public static final long INVALID_HANDLE = -1L; + /** + * Returns the handle for the specified standard device. + * + * @param nStdHandle the standard device identifier + * @return the device handle + */ public static native long getStdHandle(int nStdHandle); + /** + * Returns the current console mode for the given handle. + * + * @param handle the console handle + * @return the console mode flags + */ public static native int getConsoleMode(long handle); + /** + * Sets the console mode for the given handle. + * + * @param handle the console handle + * @param mode the console mode flags + * @return true if successful + */ public static native boolean setConsoleMode(long handle, int mode); + /** + * Returns the console output code page. + * + * @return the output code page identifier + */ public static native int getConsoleOutputCP(); + /** + * Returns the console size as {columns, rows}. + * + * @param handle the console handle + * @return array of {columns, rows} + */ public static native int[] getConsoleSize(long handle); - /** Event type constants matching Windows INPUT_RECORD.EventType */ + /** Event type constants matching Windows INPUT_RECORD.EventType. */ public static final int KEY_EVENT = 1; + /** Window buffer size event type. */ public static final int WINDOW_BUFFER_SIZE_EVENT = 4; - /** Console mode flag: enable virtual terminal processing on output handle */ + /** Console mode flag: enable virtual terminal processing on output handle. */ public static final int ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004; - /** Console mode flag: enable virtual terminal input on input handle */ + /** Console mode flag: enable virtual terminal input on input handle. */ public static final int ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200; /** @@ -64,9 +99,20 @@ public final class WinConsoleNative { * KEY_EVENT (1): {1, keyDown, repeatCount, vKeyCode, unicodeChar, controlKeyState} * WINDOW_BUFFER_SIZE_EVENT (4): {4, width, height} * Returns null for other event types or on error. + * + * @param handle the console input handle + * @return the event data array, or null */ public static native int[] readConsoleInputEvent(long handle); + /** + * Writes characters to the console. + * + * @param handle the console output handle + * @param buffer the characters to write + * @param length the number of characters to write + * @return true if successful + */ public static native boolean writeConsole(long handle, char[] buffer, int length); static { @@ -105,6 +151,7 @@ private static void loadLibrary() { } } + /** Constructor. */ private WinConsoleNative() { } } diff --git a/terminal-tty/src/main/java/org/aesh/terminal/tty/utils/ProcessHelper.java b/terminal-tty/src/main/java/org/aesh/terminal/tty/utils/ProcessHelper.java index 644da3e6..9c66b5dd 100644 --- a/terminal-tty/src/main/java/org/aesh/terminal/tty/utils/ProcessHelper.java +++ b/terminal-tty/src/main/java/org/aesh/terminal/tty/utils/ProcessHelper.java @@ -89,14 +89,29 @@ public static final class ProcessResult { this.output = output; } + /** + * Method. + * + * @return the result + */ public int exitCode() { return exitCode; } + /** + * Method. + * + * @return the result + */ public String output() { return output; } + /** + * Method. + * + * @return the result + */ public boolean success() { return exitCode == 0; }