repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.unicodeToString
public static String unicodeToString(String s) { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(s, "\\u"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() > 4) { sb.append((char) Intege...
java
public static String unicodeToString(String s) { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(s, "\\u"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() > 4) { sb.append((char) Intege...
[ "public", "static", "String", "unicodeToString", "(", "String", "s", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "s", ",", "\"\\\\u\"", ")", ";", "while", "(", "s...
Convert a string that is unicode form to a normal string. @param s The unicode form of a string, e.g. "\\u8001\\u9A6C" @return Normal string
[ "Convert", "a", "string", "that", "is", "unicode", "form", "to", "a", "normal", "string", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L656-L669
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.append
public static void append(StringBuilder buf, String s, int offset, int length) { synchronized (buf) { int end = offset + length; for (int i = offset; i < end; i++) { if (i >= s.length()) break; buf.append(s.charAt(i)); ...
java
public static void append(StringBuilder buf, String s, int offset, int length) { synchronized (buf) { int end = offset + length; for (int i = offset; i < end; i++) { if (i >= s.length()) break; buf.append(s.charAt(i)); ...
[ "public", "static", "void", "append", "(", "StringBuilder", "buf", ",", "String", "s", ",", "int", "offset", ",", "int", "length", ")", "{", "synchronized", "(", "buf", ")", "{", "int", "end", "=", "offset", "+", "length", ";", "for", "(", "int", "i"...
Append substring to StringBuilder @param buf StringBuilder to append to @param s String to append from @param offset The offset of the substring @param length The length of the substring
[ "Append", "substring", "to", "StringBuilder" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L735-L744
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.append
public static void append(StringBuilder buf, byte b, int base) { int bi = 0xff & b; int c = '0' + (bi / base) % base; if (c > '9') c = 'a' + (c - '0' - 10); buf.append((char) c); c = '0' + bi % base; if (c > '9') c = 'a' + (c - '0' - 10); ...
java
public static void append(StringBuilder buf, byte b, int base) { int bi = 0xff & b; int c = '0' + (bi / base) % base; if (c > '9') c = 'a' + (c - '0' - 10); buf.append((char) c); c = '0' + bi % base; if (c > '9') c = 'a' + (c - '0' - 10); ...
[ "public", "static", "void", "append", "(", "StringBuilder", "buf", ",", "byte", "b", ",", "int", "base", ")", "{", "int", "bi", "=", "0xff", "&", "b", ";", "int", "c", "=", "'", "'", "+", "(", "bi", "/", "base", ")", "%", "base", ";", "if", "...
append hex digit @param buf the buffer to append to @param b the byte to append @param base the base of the hex output (almost always 16).
[ "append", "hex", "digit" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L753-L763
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.toInt
public static int toInt(String string, int from) { int val = 0; boolean started = false; boolean minus = false; for (int i = from; i < string.length(); i++) { char b = string.charAt(i); if (b <= ' ') { if (started) bre...
java
public static int toInt(String string, int from) { int val = 0; boolean started = false; boolean minus = false; for (int i = from; i < string.length(); i++) { char b = string.charAt(i); if (b <= ' ') { if (started) bre...
[ "public", "static", "int", "toInt", "(", "String", "string", ",", "int", "from", ")", "{", "int", "val", "=", "0", ";", "boolean", "started", "=", "false", ";", "boolean", "minus", "=", "false", ";", "for", "(", "int", "i", "=", "from", ";", "i", ...
Convert String to an integer. Parses up to the first non-numeric character. If no number is found an IllegalArgumentException is thrown @param string A String containing an integer. @param from The index to start parsing from @return an int
[ "Convert", "String", "to", "an", "integer", ".", "Parses", "up", "to", "the", "first", "non", "-", "numeric", "character", ".", "If", "no", "number", "is", "found", "an", "IllegalArgumentException", "is", "thrown" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L773-L795
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.truncate
public static String truncate(String str, int maxSize) { if (str == null) { return null; } if (str.length() <= maxSize) { return str; } return str.substring(0, maxSize); }
java
public static String truncate(String str, int maxSize) { if (str == null) { return null; } if (str.length() <= maxSize) { return str; } return str.substring(0, maxSize); }
[ "public", "static", "String", "truncate", "(", "String", "str", ",", "int", "maxSize", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "str", ".", "length", "(", ")", "<=", "maxSize", ")", "{", "return", ...
Truncate a string to a max size. @param str the string to possibly truncate @param maxSize the maximum size of the string @return the truncated string. if <code>str</code> param is null, then the returned string will also be null.
[ "Truncate", "a", "string", "to", "a", "max", "size", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L1303-L1313
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java
URIUtils.parentPath
public static String parentPath(String p) { if (p == null || URIUtils.SLASH.equals(p)) return null; int slash = p.lastIndexOf('/', p.length() - 2); if (slash >= 0) return p.substring(0, slash + 1); return null; }
java
public static String parentPath(String p) { if (p == null || URIUtils.SLASH.equals(p)) return null; int slash = p.lastIndexOf('/', p.length() - 2); if (slash >= 0) return p.substring(0, slash + 1); return null; }
[ "public", "static", "String", "parentPath", "(", "String", "p", ")", "{", "if", "(", "p", "==", "null", "||", "URIUtils", ".", "SLASH", ".", "equals", "(", "p", ")", ")", "return", "null", ";", "int", "slash", "=", "p", ".", "lastIndexOf", "(", "'"...
Return the parent Path. Treat a URI like a directory path and return the parent directory. @param p the path to return a parent reference to @return the parent path of the URI
[ "Return", "the", "parent", "Path", ".", "Treat", "a", "URI", "like", "a", "directory", "path", "and", "return", "the", "parent", "directory", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L511-L518
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java
URIUtils.newURI
public static String newURI(String scheme, String server, int port, String path, String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query != null && query.length() > 0) builder.append('?').append(query); return builder.toStr...
java
public static String newURI(String scheme, String server, int port, String path, String query) { StringBuilder builder = newURIBuilder(scheme, server, port); builder.append(path); if (query != null && query.length() > 0) builder.append('?').append(query); return builder.toStr...
[ "public", "static", "String", "newURI", "(", "String", "scheme", ",", "String", "server", ",", "int", "port", ",", "String", "path", ",", "String", "query", ")", "{", "StringBuilder", "builder", "=", "newURIBuilder", "(", "scheme", ",", "server", ",", "por...
Create a new URI from the arguments, handling IPv6 host encoding and default ports @param scheme the URI scheme @param server the URI server @param port the URI port @param path the URI path @param query the URI query @return A String URI
[ "Create", "a", "new", "URI", "from", "the", "arguments", "handling", "IPv6", "host", "encoding", "and", "default", "ports" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L838-L844
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java
URIUtils.newURIBuilder
public static StringBuilder newURIBuilder(String scheme, String server, int port) { StringBuilder builder = new StringBuilder(); appendSchemeHostPort(builder, scheme, server, port); return builder; }
java
public static StringBuilder newURIBuilder(String scheme, String server, int port) { StringBuilder builder = new StringBuilder(); appendSchemeHostPort(builder, scheme, server, port); return builder; }
[ "public", "static", "StringBuilder", "newURIBuilder", "(", "String", "scheme", ",", "String", "server", ",", "int", "port", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "appendSchemeHostPort", "(", "builder", ",", "scheme", ...
Create a new URI StringBuilder from the arguments, handling IPv6 host encoding and default ports @param scheme the URI scheme @param server the URI server @param port the URI port @return a StringBuilder containing URI prefix
[ "Create", "a", "new", "URI", "StringBuilder", "from", "the", "arguments", "handling", "IPv6", "host", "encoding", "and", "default", "ports" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L856-L860
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java
URIUtils.appendSchemeHostPort
public static void appendSchemeHostPort(StringBuilder url, String scheme, String server, int port) { url.append(scheme).append("://").append(HostPort.normalizeHost(server)); if (port > 0) { switch (scheme) { case "http": if (port != 80) ...
java
public static void appendSchemeHostPort(StringBuilder url, String scheme, String server, int port) { url.append(scheme).append("://").append(HostPort.normalizeHost(server)); if (port > 0) { switch (scheme) { case "http": if (port != 80) ...
[ "public", "static", "void", "appendSchemeHostPort", "(", "StringBuilder", "url", ",", "String", "scheme", ",", "String", "server", ",", "int", "port", ")", "{", "url", ".", "append", "(", "scheme", ")", ".", "append", "(", "\"://\"", ")", ".", "append", ...
Append scheme, host and port URI prefix, handling IPv6 address encoding and default ports @param url StringBuilder to append to @param scheme the URI scheme @param server the URI server @param port the URI port
[ "Append", "scheme", "host", "and", "port", "URI", "prefix", "handling", "IPv6", "address", "encoding", "and", "default", "ports" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/URIUtils.java#L872-L891
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/websocket/decode/Parser.java
Parser.parsePayload
private boolean parsePayload(ByteBuffer buffer) { if (payloadLength == 0) { return true; } if (buffer.hasRemaining()) { // Create a small window of the incoming buffer to work with. // this should only show the payload itself, and not any more // ...
java
private boolean parsePayload(ByteBuffer buffer) { if (payloadLength == 0) { return true; } if (buffer.hasRemaining()) { // Create a small window of the incoming buffer to work with. // this should only show the payload itself, and not any more // ...
[ "private", "boolean", "parsePayload", "(", "ByteBuffer", "buffer", ")", "{", "if", "(", "payloadLength", "==", "0", ")", "{", "return", "true", ";", "}", "if", "(", "buffer", ".", "hasRemaining", "(", ")", ")", "{", "// Create a small window of the incoming bu...
Implementation specific parsing of a payload @param buffer the payload buffer @return true if payload is done reading, false if incomplete
[ "Implementation", "specific", "parsing", "of", "a", "payload" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/decode/Parser.java#L464-L509
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/retry/RetryStrategies.java
RetryStrategies.ifException
public static <V> Predicate<TaskContext<V>> ifException(Predicate<? super Exception> predicate) { return ctx -> predicate.test(ctx.getException()); }
java
public static <V> Predicate<TaskContext<V>> ifException(Predicate<? super Exception> predicate) { return ctx -> predicate.test(ctx.getException()); }
[ "public", "static", "<", "V", ">", "Predicate", "<", "TaskContext", "<", "V", ">", ">", "ifException", "(", "Predicate", "<", "?", "super", "Exception", ">", "predicate", ")", "{", "return", "ctx", "->", "predicate", ".", "test", "(", "ctx", ".", "getE...
If the task throws some exceptions, the task will be retried. @param predicate The exception predicate. @param <V> The return value type. @return The retry strategy predicate.
[ "If", "the", "task", "throws", "some", "exceptions", "the", "task", "will", "be", "retried", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/retry/RetryStrategies.java#L17-L19
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/retry/RetryStrategies.java
RetryStrategies.ifResult
public static <V> Predicate<TaskContext<V>> ifResult(Predicate<V> predicate) { return ctx -> predicate.test(ctx.getResult()); }
java
public static <V> Predicate<TaskContext<V>> ifResult(Predicate<V> predicate) { return ctx -> predicate.test(ctx.getResult()); }
[ "public", "static", "<", "V", ">", "Predicate", "<", "TaskContext", "<", "V", ">", ">", "ifResult", "(", "Predicate", "<", "V", ">", "predicate", ")", "{", "return", "ctx", "->", "predicate", ".", "test", "(", "ctx", ".", "getResult", "(", ")", ")", ...
If the task result satisfies condition, the task will be retried. @param predicate The result predicate. @param <V> The return value type. @return The retry strategy predicate.
[ "If", "the", "task", "result", "satisfies", "condition", "the", "task", "will", "be", "retried", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/retry/RetryStrategies.java#L28-L30
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java
QuoteUtil.dequote
public static String dequote(String str) { char start = str.charAt(0); if ((start == '\'') || (start == '\"')) { // possibly quoted char end = str.charAt(str.length() - 1); if (start == end) { // dequote return str.substring(1, str.leng...
java
public static String dequote(String str) { char start = str.charAt(0); if ((start == '\'') || (start == '\"')) { // possibly quoted char end = str.charAt(str.length() - 1); if (start == end) { // dequote return str.substring(1, str.leng...
[ "public", "static", "String", "dequote", "(", "String", "str", ")", "{", "char", "start", "=", "str", ".", "charAt", "(", "0", ")", ";", "if", "(", "(", "start", "==", "'", "'", ")", "||", "(", "start", "==", "'", "'", ")", ")", "{", "// possib...
Remove quotes from a string, only if the input string start with and end with the same quote character. @param str the string to remove surrounding quotes from @return the de-quoted string
[ "Remove", "quotes", "from", "a", "string", "only", "if", "the", "input", "string", "start", "with", "and", "end", "with", "the", "same", "quote", "character", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java#L184-L195
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java
QuoteUtil.quote
public static void quote(StringBuilder buf, String str) { buf.append('"'); escape(buf, str); buf.append('"'); }
java
public static void quote(StringBuilder buf, String str) { buf.append('"'); escape(buf, str); buf.append('"'); }
[ "public", "static", "void", "quote", "(", "StringBuilder", "buf", ",", "String", "str", ")", "{", "buf", ".", "append", "(", "'", "'", ")", ";", "escape", "(", "buf", ",", "str", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "}" ]
Simple quote of a string, escaping where needed. @param buf the StringBuilder to append to @param str the string to quote
[ "Simple", "quote", "of", "a", "string", "escaping", "where", "needed", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java#L230-L234
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java
QuoteUtil.splitAt
public static Iterator<String> splitAt(String str, String delims) { return new DeQuotingStringIterator(str.trim(), delims); }
java
public static Iterator<String> splitAt(String str, String delims) { return new DeQuotingStringIterator(str.trim(), delims); }
[ "public", "static", "Iterator", "<", "String", ">", "splitAt", "(", "String", "str", ",", "String", "delims", ")", "{", "return", "new", "DeQuotingStringIterator", "(", "str", ".", "trim", "(", ")", ",", "delims", ")", ";", "}" ]
Create an iterator of the input string, breaking apart the string at the provided delimiters, removing quotes and triming the parts of the string as needed. @param str the input string to split apart @param delims the delimiter characters to split the string on @return the iterator of the parts of the string, trimm...
[ "Create", "an", "iterator", "of", "the", "input", "string", "breaking", "apart", "the", "string", "at", "the", "provided", "delimiters", "removing", "quotes", "and", "triming", "the", "parts", "of", "the", "string", "as", "needed", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/utils/QuoteUtil.java#L276-L278
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java
HexUtils.bytesToHex
public static final String bytesToHex(byte[] bs, int off, int length) { if (bs.length <= off || bs.length < off + length) throw new IllegalArgumentException(); StringBuilder sb = new StringBuilder(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }
java
public static final String bytesToHex(byte[] bs, int off, int length) { if (bs.length <= off || bs.length < off + length) throw new IllegalArgumentException(); StringBuilder sb = new StringBuilder(length * 2); bytesToHexAppend(bs, off, length, sb); return sb.toString(); }
[ "public", "static", "final", "String", "bytesToHex", "(", "byte", "[", "]", "bs", ",", "int", "off", ",", "int", "length", ")", "{", "if", "(", "bs", ".", "length", "<=", "off", "||", "bs", ".", "length", "<", "off", "+", "length", ")", "throw", ...
Converts a byte array into a string of lower case hex chars. @param bs A byte array @param off The index of the first byte to read @param length The number of bytes to read. @return the string of hex chars.
[ "Converts", "a", "byte", "array", "into", "a", "string", "of", "lower", "case", "hex", "chars", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java#L19-L25
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java
HexUtils.hexToBytes
public static final void hexToBytes(String s, byte[] out, int off) throws NumberFormatException, IndexOutOfBoundsException { int slen = s.length(); if ((slen % 2) != 0) { s = '0' + s; } if (out.length < off + slen / 2) { throw new IndexOutOfBoundsExc...
java
public static final void hexToBytes(String s, byte[] out, int off) throws NumberFormatException, IndexOutOfBoundsException { int slen = s.length(); if ((slen % 2) != 0) { s = '0' + s; } if (out.length < off + slen / 2) { throw new IndexOutOfBoundsExc...
[ "public", "static", "final", "void", "hexToBytes", "(", "String", "s", ",", "byte", "[", "]", "out", ",", "int", "off", ")", "throws", "NumberFormatException", ",", "IndexOutOfBoundsException", "{", "int", "slen", "=", "s", ".", "length", "(", ")", ";", ...
Converts a String of hex characters into an array of bytes. @param s A string of hex characters (upper case or lower) of even length. @param out A byte array of length at least s.length()/2 + off @param off The first byte to write of the array
[ "Converts", "a", "String", "of", "hex", "characters", "into", "an", "array", "of", "bytes", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java#L60-L84
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java
HexUtils.hexToBits
public static void hexToBits(String s, BitSet ba, int length) { byte[] b = hexToBytes(s); bytesToBits(b, ba, length); }
java
public static void hexToBits(String s, BitSet ba, int length) { byte[] b = hexToBytes(s); bytesToBits(b, ba, length); }
[ "public", "static", "void", "hexToBits", "(", "String", "s", ",", "BitSet", "ba", ",", "int", "length", ")", "{", "byte", "[", "]", "b", "=", "hexToBytes", "(", "s", ")", ";", "bytesToBits", "(", "b", ",", "ba", ",", "length", ")", ";", "}" ]
Read a hex string of bits and write it into a bitset @param s hex string of the stored bits @param ba the bitset to store the bits in @param length the maximum number of bits to store
[ "Read", "a", "hex", "string", "of", "bits", "and", "write", "it", "into", "a", "bitset" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/codec/HexUtils.java#L134-L137
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/RandomUtils.java
RandomUtils.random
public static long random(long min, long max) { return Math.round(ThreadLocalRandom.current().nextDouble() * (max - min) + min); }
java
public static long random(long min, long max) { return Math.round(ThreadLocalRandom.current().nextDouble() * (max - min) + min); }
[ "public", "static", "long", "random", "(", "long", "min", ",", "long", "max", ")", "{", "return", "Math", ".", "round", "(", "ThreadLocalRandom", ".", "current", "(", ")", ".", "nextDouble", "(", ")", "*", "(", "max", "-", "min", ")", "+", "min", "...
Generates a random number from a specified range @param min The minimal number of the range @param max The maximal number of the range @return A random number from minimal number to maximal number, which contains minimal and maximal number.
[ "Generates", "a", "random", "number", "from", "a", "specified", "range" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/RandomUtils.java#L13-L16
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/RandomUtils.java
RandomUtils.randomSegment
public static int randomSegment(int[] probability) { int total = 0; for (int i = 0; i < probability.length; i++) { total += probability[i]; probability[i] = total; } int rand = (int) random(0, total - 1); for (int i = 0; i < probability.length; i++)...
java
public static int randomSegment(int[] probability) { int total = 0; for (int i = 0; i < probability.length; i++) { total += probability[i]; probability[i] = total; } int rand = (int) random(0, total - 1); for (int i = 0; i < probability.length; i++)...
[ "public", "static", "int", "randomSegment", "(", "int", "[", "]", "probability", ")", "{", "int", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "probability", ".", "length", ";", "i", "++", ")", "{", "total", "+=", "pro...
Returns the index of array that specifies probability. @param probability The element of array represents the probability. @return The index of array.
[ "Returns", "the", "index", "of", "array", "that", "specifies", "probability", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/RandomUtils.java#L40-L53
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/RandomUtils.java
RandomUtils.randomString
public static String randomString(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { int index = (int) random(0, ALL_CHAR.length() - 1); sb.append(ALL_CHAR.charAt(index)); } return sb.toString(); }
java
public static String randomString(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { int index = (int) random(0, ALL_CHAR.length() - 1); sb.append(ALL_CHAR.charAt(index)); } return sb.toString(); }
[ "public", "static", "String", "randomString", "(", "int", "length", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "index", "=...
Returns a random string. @param length The random string's length @return A random string.
[ "Returns", "a", "random", "string", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/RandomUtils.java#L61-L68
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ReflectUtils.java
ReflectUtils.set
public static void set(Object obj, String property, Object value) throws Throwable { getSetterMethod(obj.getClass(), property).invoke(obj, value); }
java
public static void set(Object obj, String property, Object value) throws Throwable { getSetterMethod(obj.getClass(), property).invoke(obj, value); }
[ "public", "static", "void", "set", "(", "Object", "obj", ",", "String", "property", ",", "Object", "value", ")", "throws", "Throwable", "{", "getSetterMethod", "(", "obj", ".", "getClass", "(", ")", ",", "property", ")", ".", "invoke", "(", "obj", ",", ...
Invokes a object's "setter" method by property name @param obj The instance of a object @param property The property name of this object @param value The parameter of "setter" method that you want to set @throws Throwable A runtime exception
[ "Invokes", "a", "object", "s", "setter", "method", "by", "property", "name" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ReflectUtils.java#L85-L87
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ReflectUtils.java
ReflectUtils.get
public static Object get(Object obj, String property) throws Throwable { return getGetterMethod(obj.getClass(), property).invoke(obj); }
java
public static Object get(Object obj, String property) throws Throwable { return getGetterMethod(obj.getClass(), property).invoke(obj); }
[ "public", "static", "Object", "get", "(", "Object", "obj", ",", "String", "property", ")", "throws", "Throwable", "{", "return", "getGetterMethod", "(", "obj", ".", "getClass", "(", ")", ",", "property", ")", ".", "invoke", "(", "obj", ")", ";", "}" ]
Invokes a object's "getter" method by property name @param obj The instance of a object @param property The property name of this object @return The value of this property @throws Throwable A runtime exception
[ "Invokes", "a", "object", "s", "getter", "method", "by", "property", "name" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ReflectUtils.java#L97-L99
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ReflectUtils.java
ReflectUtils.getInterfaceNames
public static String[] getInterfaceNames(Class<?> c) { Class<?>[] interfaces = c.getInterfaces(); List<String> names = new ArrayList<>(); for (Class<?> i : interfaces) { names.add(i.getName()); } return names.toArray(new String[0]); }
java
public static String[] getInterfaceNames(Class<?> c) { Class<?>[] interfaces = c.getInterfaces(); List<String> names = new ArrayList<>(); for (Class<?> i : interfaces) { names.add(i.getName()); } return names.toArray(new String[0]); }
[ "public", "static", "String", "[", "]", "getInterfaceNames", "(", "Class", "<", "?", ">", "c", ")", "{", "Class", "<", "?", ">", "[", "]", "interfaces", "=", "c", ".", "getInterfaces", "(", ")", ";", "List", "<", "String", ">", "names", "=", "new",...
Gets the all interface names of this class @param c The class of one object @return Returns the all interface names
[ "Gets", "the", "all", "interface", "names", "of", "this", "class" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ReflectUtils.java#L131-L138
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ConvertUtils.java
ConvertUtils.convert
@SuppressWarnings("unchecked") public static Object convert(Collection<?> collection, Class<?> arrayType) { int size = collection.size(); // Allocate a new Array Object newArray = Array.newInstance(Optional.ofNullable(arrayType) .filte...
java
@SuppressWarnings("unchecked") public static Object convert(Collection<?> collection, Class<?> arrayType) { int size = collection.size(); // Allocate a new Array Object newArray = Array.newInstance(Optional.ofNullable(arrayType) .filte...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Object", "convert", "(", "Collection", "<", "?", ">", "collection", ",", "Class", "<", "?", ">", "arrayType", ")", "{", "int", "size", "=", "collection", ".", "size", "(", ")", ";",...
Returns an array object, this method converts a collection object to an array object through the specified element type of the array. @param collection The collection that needs be converted @param arrayType The element type of an array @return a array object and the element is the parameter specified type.
[ "Returns", "an", "array", "object", "this", "method", "converts", "a", "collection", "object", "to", "an", "array", "object", "through", "the", "specified", "element", "type", "of", "the", "array", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ConvertUtils.java#L122-L141
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ConvertUtils.java
ConvertUtils.getCollectionObj
@SuppressWarnings("unchecked") public static Collection<Object> getCollectionObj(Class<?> clazz) { if (clazz.isInterface()) { if (clazz.isAssignableFrom(List.class)) return new ArrayList<>(); else if (clazz.isAssignableFrom(Set.class)) return new...
java
@SuppressWarnings("unchecked") public static Collection<Object> getCollectionObj(Class<?> clazz) { if (clazz.isInterface()) { if (clazz.isAssignableFrom(List.class)) return new ArrayList<>(); else if (clazz.isAssignableFrom(Set.class)) return new...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Collection", "<", "Object", ">", "getCollectionObj", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isInterface", "(", ")", ")", "{", "if", "(", "clazz", ...
Returns a collection object instance by class @param clazz The class object of a collection @return A collection object instance
[ "Returns", "a", "collection", "object", "instance", "by", "class" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ConvertUtils.java#L149-L173
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ResourceUtils.java
ResourceUtils.isJarURL
public static boolean isJarURL(URL url) { String protocol = url.getProtocol(); return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol) || URL_PROTOCOL_VFSZIP.equals(protocol) || URL_PROTOCOL_WSJAR.equals(protocol)); }
java
public static boolean isJarURL(URL url) { String protocol = url.getProtocol(); return (URL_PROTOCOL_JAR.equals(protocol) || URL_PROTOCOL_ZIP.equals(protocol) || URL_PROTOCOL_VFSZIP.equals(protocol) || URL_PROTOCOL_WSJAR.equals(protocol)); }
[ "public", "static", "boolean", "isJarURL", "(", "URL", "url", ")", "{", "String", "protocol", "=", "url", ".", "getProtocol", "(", ")", ";", "return", "(", "URL_PROTOCOL_JAR", ".", "equals", "(", "protocol", ")", "||", "URL_PROTOCOL_ZIP", ".", "equals", "(...
Determine whether the given URL points to a resource in a jar file, that is, has protocol "jar", "zip", "vfszip" or "wsjar". @param url the URL to check @return whether the URL has been identified as a JAR URL
[ "Determine", "whether", "the", "given", "URL", "points", "to", "a", "resource", "in", "a", "jar", "file", "that", "is", "has", "protocol", "jar", "zip", "vfszip", "or", "wsjar", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ResourceUtils.java#L272-L276
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ResourceUtils.java
ResourceUtils.isJarFileURL
public static boolean isJarFileURL(URL url) { return (URL_PROTOCOL_FILE.equals(url.getProtocol()) && url.getPath().toLowerCase().endsWith(JAR_FILE_EXTENSION)); }
java
public static boolean isJarFileURL(URL url) { return (URL_PROTOCOL_FILE.equals(url.getProtocol()) && url.getPath().toLowerCase().endsWith(JAR_FILE_EXTENSION)); }
[ "public", "static", "boolean", "isJarFileURL", "(", "URL", "url", ")", "{", "return", "(", "URL_PROTOCOL_FILE", ".", "equals", "(", "url", ".", "getProtocol", "(", ")", ")", "&&", "url", ".", "getPath", "(", ")", ".", "toLowerCase", "(", ")", ".", "end...
Determine whether the given URL points to a jar file itself, that is, has protocol "file" and ends with the ".jar" extension. @param url the URL to check @return whether the URL has been identified as a JAR file URL @since 4.1
[ "Determine", "whether", "the", "given", "URL", "points", "to", "a", "jar", "file", "itself", "that", "is", "has", "protocol", "file", "and", "ends", "with", "the", ".", "jar", "extension", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ResourceUtils.java#L286-L289
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/encode/Generator.java
Generator.data
public Pair<Integer, List<ByteBuffer>> data(DataFrame frame, int maxLength) { return dataGenerator.generate(frame, maxLength); }
java
public Pair<Integer, List<ByteBuffer>> data(DataFrame frame, int maxLength) { return dataGenerator.generate(frame, maxLength); }
[ "public", "Pair", "<", "Integer", ",", "List", "<", "ByteBuffer", ">", ">", "data", "(", "DataFrame", "frame", ",", "int", "maxLength", ")", "{", "return", "dataGenerator", ".", "generate", "(", "frame", ",", "maxLength", ")", ";", "}" ]
Encode data frame to binary codes @param frame DataFrame @param maxLength The max length of DataFrame @return A pair of encoding result. The first field is frame length which contains header frame and data frame. The second field is binary codes.
[ "Encode", "data", "frame", "to", "binary", "codes" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/encode/Generator.java#L68-L70
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java
MultiPartFormInputStream.getParsedParts
@Deprecated public Collection<Part> getParsedParts() { if (_parts == null) return Collections.emptyList(); Collection<List<Part>> values = _parts.values(); List<Part> parts = new ArrayList<>(); for (List<Part> o : values) { List<Part> asList = LazyList.getLis...
java
@Deprecated public Collection<Part> getParsedParts() { if (_parts == null) return Collections.emptyList(); Collection<List<Part>> values = _parts.values(); List<Part> parts = new ArrayList<>(); for (List<Part> o : values) { List<Part> asList = LazyList.getLis...
[ "@", "Deprecated", "public", "Collection", "<", "Part", ">", "getParsedParts", "(", ")", "{", "if", "(", "_parts", "==", "null", ")", "return", "Collections", ".", "emptyList", "(", ")", ";", "Collection", "<", "List", "<", "Part", ">", ">", "values", ...
Get the already parsed parts. @return the parts that were parsed
[ "Get", "the", "already", "parsed", "parts", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java#L309-L321
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java
MultiPartFormInputStream.deleteParts
public void deleteParts() { if (!_parsed) return; Collection<Part> parts; try { parts = getParts(); } catch (IOException e) { throw new RuntimeException(e); } MultiException err = null; for (Part p : parts) { try {...
java
public void deleteParts() { if (!_parsed) return; Collection<Part> parts; try { parts = getParts(); } catch (IOException e) { throw new RuntimeException(e); } MultiException err = null; for (Part p : parts) { try {...
[ "public", "void", "deleteParts", "(", ")", "{", "if", "(", "!", "_parsed", ")", "return", ";", "Collection", "<", "Part", ">", "parts", ";", "try", "{", "parts", "=", "getParts", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "thro...
Delete any tmp storage for parts, and clear out the parts list.
[ "Delete", "any", "tmp", "storage", "for", "parts", "and", "clear", "out", "the", "parts", "list", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java#L326-L351
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java
MultiPartFormInputStream.getParts
public Collection<Part> getParts() throws IOException { if (!_parsed) parse(); throwIfError(); Collection<List<Part>> values = _parts.values(); List<Part> parts = new ArrayList<>(); for (List<Part> o : values) { List<Part> asList = LazyList.getList(o, fal...
java
public Collection<Part> getParts() throws IOException { if (!_parsed) parse(); throwIfError(); Collection<List<Part>> values = _parts.values(); List<Part> parts = new ArrayList<>(); for (List<Part> o : values) { List<Part> asList = LazyList.getList(o, fal...
[ "public", "Collection", "<", "Part", ">", "getParts", "(", ")", "throws", "IOException", "{", "if", "(", "!", "_parsed", ")", "parse", "(", ")", ";", "throwIfError", "(", ")", ";", "Collection", "<", "List", "<", "Part", ">", ">", "values", "=", "_pa...
Parse, if necessary, the multipart data and return the list of Parts. @return the parts @throws IOException if unable to get the parts
[ "Parse", "if", "necessary", "the", "multipart", "data", "and", "return", "the", "list", "of", "Parts", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java#L359-L371
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java
MultiPartFormInputStream.getPart
public Part getPart(String name) throws IOException { if (!_parsed) parse(); throwIfError(); return _parts.getValue(name, 0); }
java
public Part getPart(String name) throws IOException { if (!_parsed) parse(); throwIfError(); return _parts.getValue(name, 0); }
[ "public", "Part", "getPart", "(", "String", "name", ")", "throws", "IOException", "{", "if", "(", "!", "_parsed", ")", "parse", "(", ")", ";", "throwIfError", "(", ")", ";", "return", "_parts", ".", "getValue", "(", "name", ",", "0", ")", ";", "}" ]
Get the named Part. @param name the part name @return the parts @throws IOException if unable to get the part
[ "Get", "the", "named", "Part", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java#L380-L385
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java
MultiPartFormInputStream.throwIfError
protected void throwIfError() throws IOException { if (_err != null) { _err.addSuppressed(new Throwable()); if (_err instanceof IOException) throw (IOException) _err; if (_err instanceof IllegalStateException) throw (IllegalStateException) _err...
java
protected void throwIfError() throws IOException { if (_err != null) { _err.addSuppressed(new Throwable()); if (_err instanceof IOException) throw (IOException) _err; if (_err instanceof IllegalStateException) throw (IllegalStateException) _err...
[ "protected", "void", "throwIfError", "(", ")", "throws", "IOException", "{", "if", "(", "_err", "!=", "null", ")", "{", "_err", ".", "addSuppressed", "(", "new", "Throwable", "(", ")", ")", ";", "if", "(", "_err", "instanceof", "IOException", ")", "throw...
Throws an exception if one has been latched. @throws IOException the exception (if present)
[ "Throws", "an", "exception", "if", "one", "has", "been", "latched", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java#L392-L401
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java
MultiPartFormInputStream.parse
protected void parse() { // have we already parsed the input? if (_parsed) return; _parsed = true; try { // initialize _parts = new MultiMap<>(); // if its not a multipart request, don't parse it if (_contentType == null || !_...
java
protected void parse() { // have we already parsed the input? if (_parsed) return; _parsed = true; try { // initialize _parts = new MultiMap<>(); // if its not a multipart request, don't parse it if (_contentType == null || !_...
[ "protected", "void", "parse", "(", ")", "{", "// have we already parsed the input?", "if", "(", "_parsed", ")", "return", ";", "_parsed", "=", "true", ";", "try", "{", "// initialize", "_parts", "=", "new", "MultiMap", "<>", "(", ")", ";", "// if its not a mul...
Parse, if necessary, the multipart stream.
[ "Parse", "if", "necessary", "the", "multipart", "stream", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartFormInputStream.java#L406-L498
train
hypercube1024/firefly
firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java
AbstractSecureSession.doHandshake
protected boolean doHandshake(ByteBuffer receiveBuffer) throws IOException { if (!session.isOpen()) { close(); return (initialHSComplete = false); } if (initialHSComplete) { return true; } switch (initialHSStatus) { case NOT_HANDS...
java
protected boolean doHandshake(ByteBuffer receiveBuffer) throws IOException { if (!session.isOpen()) { close(); return (initialHSComplete = false); } if (initialHSComplete) { return true; } switch (initialHSStatus) { case NOT_HANDS...
[ "protected", "boolean", "doHandshake", "(", "ByteBuffer", "receiveBuffer", ")", "throws", "IOException", "{", "if", "(", "!", "session", ".", "isOpen", "(", ")", ")", "{", "close", "(", ")", ";", "return", "(", "initialHSComplete", "=", "false", ")", ";", ...
The initial handshake is a procedure by which the two peers exchange communication parameters until an SecureSession is established. Application data can not be sent during this phase. @param receiveBuffer Encrypted message @return True means handshake success @throws IOException The I/O exception
[ "The", "initial", "handshake", "is", "a", "procedure", "by", "which", "the", "two", "peers", "exchange", "communication", "parameters", "until", "an", "SecureSession", "is", "established", ".", "Application", "data", "can", "not", "be", "sent", "during", "this",...
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java#L74-L104
train
hypercube1024/firefly
firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java
AbstractSecureSession.doTasks
protected SSLEngineResult.HandshakeStatus doTasks() { Runnable runnable; // We could run this in a separate thread, but do in the current for // now. while ((runnable = sslEngine.getDelegatedTask()) != null) { runnable.run(); } return sslEngine.getHandshakeSt...
java
protected SSLEngineResult.HandshakeStatus doTasks() { Runnable runnable; // We could run this in a separate thread, but do in the current for // now. while ((runnable = sslEngine.getDelegatedTask()) != null) { runnable.run(); } return sslEngine.getHandshakeSt...
[ "protected", "SSLEngineResult", ".", "HandshakeStatus", "doTasks", "(", ")", "{", "Runnable", "runnable", ";", "// We could run this in a separate thread, but do in the current for", "// now.", "while", "(", "(", "runnable", "=", "sslEngine", ".", "getDelegatedTask", "(", ...
Do all the outstanding handshake tasks in the current Thread. @return The result of handshake
[ "Do", "all", "the", "outstanding", "handshake", "tasks", "in", "the", "current", "Thread", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java#L302-L311
train
hypercube1024/firefly
firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java
AbstractSecureSession.read
@Override public ByteBuffer read(ByteBuffer receiveBuffer) throws IOException { if (!doHandshake(receiveBuffer)) return null; if (!initialHSComplete) throw new IllegalStateException("The initial handshake is not complete."); if (log.isDebugEnabled()) { l...
java
@Override public ByteBuffer read(ByteBuffer receiveBuffer) throws IOException { if (!doHandshake(receiveBuffer)) return null; if (!initialHSComplete) throw new IllegalStateException("The initial handshake is not complete."); if (log.isDebugEnabled()) { l...
[ "@", "Override", "public", "ByteBuffer", "read", "(", "ByteBuffer", "receiveBuffer", ")", "throws", "IOException", "{", "if", "(", "!", "doHandshake", "(", "receiveBuffer", ")", ")", "return", "null", ";", "if", "(", "!", "initialHSComplete", ")", "throw", "...
This method is used to decrypt data, it implied do handshake @param receiveBuffer Encrypted message @return plaintext @throws IOException sslEngine error during data read
[ "This", "method", "is", "used", "to", "decrypt", "data", "it", "implied", "do", "handshake" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java#L392-L458
train
hypercube1024/firefly
firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java
AbstractSecureSession.write
@Override public int write(ByteBuffer outAppBuf, Callback callback) throws IOException { if (!initialHSComplete) { IllegalStateException ex = new IllegalStateException("The initial handshake is not complete."); callback.failed(ex); throw ex; } int ret = 0...
java
@Override public int write(ByteBuffer outAppBuf, Callback callback) throws IOException { if (!initialHSComplete) { IllegalStateException ex = new IllegalStateException("The initial handshake is not complete."); callback.failed(ex); throw ex; } int ret = 0...
[ "@", "Override", "public", "int", "write", "(", "ByteBuffer", "outAppBuf", ",", "Callback", "callback", ")", "throws", "IOException", "{", "if", "(", "!", "initialHSComplete", ")", "{", "IllegalStateException", "ex", "=", "new", "IllegalStateException", "(", "\"...
This method is used to encrypt and flush to socket channel @param outAppBuf Plaintext message @return writen length @throws IOException sslEngine error during data write
[ "This", "method", "is", "used", "to", "encrypt", "and", "flush", "to", "socket", "channel" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-nettool/src/main/java/com/firefly/net/tcp/secure/AbstractSecureSession.java#L477-L551
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/core/AbstractApplicationContext.java
AbstractApplicationContext.beanDefinitionCheck
protected void beanDefinitionCheck() { for (int i = 0; i < beanDefinitions.size(); i++) { for (int j = i + 1; j < beanDefinitions.size(); j++) { BeanDefinition b1 = beanDefinitions.get(i); BeanDefinition b2 = beanDefinitions.get(j); // Two compo...
java
protected void beanDefinitionCheck() { for (int i = 0; i < beanDefinitions.size(); i++) { for (int j = i + 1; j < beanDefinitions.size(); j++) { BeanDefinition b1 = beanDefinitions.get(i); BeanDefinition b2 = beanDefinitions.get(j); // Two compo...
[ "protected", "void", "beanDefinitionCheck", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "beanDefinitions", ".", "size", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "i", "+", "1", ";", "j", "<", "beanDefi...
Bean definition conflict check
[ "Bean", "definition", "conflict", "check" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/core/AbstractApplicationContext.java#L96-L137
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/client/http2/SimpleHTTPClient.java
SimpleHTTPClient.registerHealthCheck
public void registerHealthCheck(Task task) { Optional.ofNullable(config.getHealthCheck()) .ifPresent(healthCheck -> healthCheck.register(task)); }
java
public void registerHealthCheck(Task task) { Optional.ofNullable(config.getHealthCheck()) .ifPresent(healthCheck -> healthCheck.register(task)); }
[ "public", "void", "registerHealthCheck", "(", "Task", "task", ")", "{", "Optional", ".", "ofNullable", "(", "config", ".", "getHealthCheck", "(", ")", ")", ".", "ifPresent", "(", "healthCheck", "->", "healthCheck", ".", "register", "(", "task", ")", ")", "...
Register an health check task. @param task The health check task.
[ "Register", "an", "health", "check", "task", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/client/http2/SimpleHTTPClient.java#L894-L897
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/client/http2/SimpleHTTPClient.java
SimpleHTTPClient.clearHealthCheck
public void clearHealthCheck(String name) { Optional.ofNullable(config.getHealthCheck()) .ifPresent(healthCheck -> healthCheck.clear(name)); }
java
public void clearHealthCheck(String name) { Optional.ofNullable(config.getHealthCheck()) .ifPresent(healthCheck -> healthCheck.clear(name)); }
[ "public", "void", "clearHealthCheck", "(", "String", "name", ")", "{", "Optional", ".", "ofNullable", "(", "config", ".", "getHealthCheck", "(", ")", ")", ".", "ifPresent", "(", "healthCheck", "->", "healthCheck", ".", "clear", "(", "name", ")", ")", ";", ...
Clear the health check task. @param name The task name.
[ "Clear", "the", "health", "check", "task", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/client/http2/SimpleHTTPClient.java#L904-L907
train
hypercube1024/firefly
firefly-db/src/main/java/com/firefly/db/namedparam/NamedParameterParser.java
NamedParameterParser.skipCommentsAndQuotes
private static int skipCommentsAndQuotes(char[] statement, int position) { for (int i = 0; i < START_SKIP.length; i++) { if (statement[position] == START_SKIP[i].charAt(0)) { boolean match = true; for (int j = 1; j < START_SKIP[i].length(); j++) { ...
java
private static int skipCommentsAndQuotes(char[] statement, int position) { for (int i = 0; i < START_SKIP.length; i++) { if (statement[position] == START_SKIP[i].charAt(0)) { boolean match = true; for (int j = 1; j < START_SKIP[i].length(); j++) { ...
[ "private", "static", "int", "skipCommentsAndQuotes", "(", "char", "[", "]", "statement", ",", "int", "position", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "START_SKIP", ".", "length", ";", "i", "++", ")", "{", "if", "(", "statement",...
Skip over comments and quoted names present in an SQL statement @param statement character array containing SQL statement @param position current position of statement @return next position to process after any comments or quotes are skipped
[ "Skip", "over", "comments", "and", "quoted", "names", "present", "in", "an", "SQL", "statement" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/namedparam/NamedParameterParser.java#L164-L204
train
hypercube1024/firefly
firefly-db/src/main/java/com/firefly/db/namedparam/NamedParameterParser.java
NamedParameterParser.isParameterSeparator
private static boolean isParameterSeparator(char c) { if (Character.isWhitespace(c)) { return true; } for (char separator : PARAMETER_SEPARATORS) { if (c == separator) { return true; } } return false; }
java
private static boolean isParameterSeparator(char c) { if (Character.isWhitespace(c)) { return true; } for (char separator : PARAMETER_SEPARATORS) { if (c == separator) { return true; } } return false; }
[ "private", "static", "boolean", "isParameterSeparator", "(", "char", "c", ")", "{", "if", "(", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "return", "true", ";", "}", "for", "(", "char", "separator", ":", "PARAMETER_SEPARATORS", ")", "{", ...
Determine whether a parameter name ends at the current position, that is, whether the given character qualifies as a separator.
[ "Determine", "whether", "a", "parameter", "name", "ends", "at", "the", "current", "position", "that", "is", "whether", "the", "given", "character", "qualifies", "as", "a", "separator", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/namedparam/NamedParameterParser.java#L210-L220
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/decode/HttpParser.java
HttpParser.complianceViolation
protected boolean complianceViolation(HttpComplianceSection violation, String reason) { if (_compliances.contains(violation)) return true; if (reason == null) reason = violation.description; if (_complianceHandler != null) _complianceHandler.onComplianceViolat...
java
protected boolean complianceViolation(HttpComplianceSection violation, String reason) { if (_compliances.contains(violation)) return true; if (reason == null) reason = violation.description; if (_complianceHandler != null) _complianceHandler.onComplianceViolat...
[ "protected", "boolean", "complianceViolation", "(", "HttpComplianceSection", "violation", ",", "String", "reason", ")", "{", "if", "(", "_compliances", ".", "contains", "(", "violation", ")", ")", "return", "true", ";", "if", "(", "reason", "==", "null", ")", ...
Check RFC compliance violation @param violation The compliance section violation @param reason The reason for the violation @return True if the current compliance level is set so as to Not allow this violation
[ "Check", "RFC", "compliance", "violation" ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/decode/HttpParser.java#L304-L313
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/websocket/model/UpgradeRequestAdapter.java
UpgradeRequestAdapter.setSubProtocols
@Override public void setSubProtocols(String... protocols) { subProtocols.clear(); Collections.addAll(subProtocols, protocols); }
java
@Override public void setSubProtocols(String... protocols) { subProtocols.clear(); Collections.addAll(subProtocols, protocols); }
[ "@", "Override", "public", "void", "setSubProtocols", "(", "String", "...", "protocols", ")", "{", "subProtocols", ".", "clear", "(", ")", ";", "Collections", ".", "addAll", "(", "subProtocols", ",", "protocols", ")", ";", "}" ]
Set Sub Protocol request list. @param protocols the sub protocols desired
[ "Set", "Sub", "Protocol", "request", "list", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/model/UpgradeRequestAdapter.java#L292-L296
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.getFieldNamesCollection
public Set<String> getFieldNamesCollection() { final Set<String> set = new HashSet<>(_size); for (HttpField f : this) { if (f != null) set.add(f.getName()); } return set; }
java
public Set<String> getFieldNamesCollection() { final Set<String> set = new HashSet<>(_size); for (HttpField f : this) { if (f != null) set.add(f.getName()); } return set; }
[ "public", "Set", "<", "String", ">", "getFieldNamesCollection", "(", ")", "{", "final", "Set", "<", "String", ">", "set", "=", "new", "HashSet", "<>", "(", "_size", ")", ";", "for", "(", "HttpField", "f", ":", "this", ")", "{", "if", "(", "f", "!="...
Get Collection of header names. @return the unique set of field names.
[ "Get", "Collection", "of", "header", "names", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L77-L84
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.getLongField
public long getLongField(String name) throws NumberFormatException { HttpField field = getField(name); return field == null ? -1L : field.getLongValue(); }
java
public long getLongField(String name) throws NumberFormatException { HttpField field = getField(name); return field == null ? -1L : field.getLongValue(); }
[ "public", "long", "getLongField", "(", "String", "name", ")", "throws", "NumberFormatException", "{", "HttpField", "field", "=", "getField", "(", "name", ")", ";", "return", "field", "==", "null", "?", "-", "1L", ":", "field", ".", "getLongValue", "(", ")"...
Get a header as an long value. Returns the value of an integer field or -1 if not found. The case of the field name is ignored. @param name the case-insensitive field name @return the value of the field as a long @throws NumberFormatException If bad long found
[ "Get", "a", "header", "as", "an", "long", "value", ".", "Returns", "the", "value", "of", "an", "integer", "field", "or", "-", "1", "if", "not", "found", ".", "The", "case", "of", "the", "field", "name", "is", "ignored", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L617-L620
train
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java
HttpFields.putLongField
public void putLongField(HttpHeader name, long value) { String v = Long.toString(value); put(name, v); }
java
public void putLongField(HttpHeader name, long value) { String v = Long.toString(value); put(name, v); }
[ "public", "void", "putLongField", "(", "HttpHeader", "name", ",", "long", "value", ")", "{", "String", "v", "=", "Long", ".", "toString", "(", "value", ")", ";", "put", "(", "name", ",", "v", ")", ";", "}" ]
Sets the value of an long field. @param name the field name @param value the field long value
[ "Sets", "the", "value", "of", "an", "long", "field", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/HttpFields.java#L651-L654
train
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/ClassUtils.java
ClassUtils.getAllInterfacesAsSet
public static Set<Class<?>> getAllInterfacesAsSet(Object instance) { Assert.notNull(instance, "Instance must not be null"); return getAllInterfacesForClassAsSet(instance.getClass()); }
java
public static Set<Class<?>> getAllInterfacesAsSet(Object instance) { Assert.notNull(instance, "Instance must not be null"); return getAllInterfacesForClassAsSet(instance.getClass()); }
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "getAllInterfacesAsSet", "(", "Object", "instance", ")", "{", "Assert", ".", "notNull", "(", "instance", ",", "\"Instance must not be null\"", ")", ";", "return", "getAllInterfacesForClassAsSet", "(", ...
Return all interfaces that the given instance implements as Set, including ones implemented by superclasses. @param instance the instance to analyze for interfaces @return all interfaces that the given instance implements as Set
[ "Return", "all", "interfaces", "that", "the", "given", "instance", "implements", "as", "Set", "including", "ones", "implemented", "by", "superclasses", "." ]
ed3fc75b7c54a65b1e7d8141d01b49144bb423a3
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ClassUtils.java#L1053-L1056
train
OpenSextant/SolrTextTagger
src/main/java/org/opensextant/solrtexttagger/TagLL.java
TagLL.removeLL
public void removeLL() { if (head[0] == this) head[0] = nextTag; if (prevTag != null) { prevTag.nextTag = nextTag; } if (nextTag != null) { nextTag.prevTag = prevTag; } }
java
public void removeLL() { if (head[0] == this) head[0] = nextTag; if (prevTag != null) { prevTag.nextTag = nextTag; } if (nextTag != null) { nextTag.prevTag = prevTag; } }
[ "public", "void", "removeLL", "(", ")", "{", "if", "(", "head", "[", "0", "]", "==", "this", ")", "head", "[", "0", "]", "=", "nextTag", ";", "if", "(", "prevTag", "!=", "null", ")", "{", "prevTag", ".", "nextTag", "=", "nextTag", ";", "}", "if...
Removes this tag from the chain, connecting prevTag and nextTag. Does not modify "this" object's pointers, so the caller can refer to nextTag after removing it.
[ "Removes", "this", "tag", "from", "the", "chain", "connecting", "prevTag", "and", "nextTag", ".", "Does", "not", "modify", "this", "object", "s", "pointers", "so", "the", "caller", "can", "refer", "to", "nextTag", "after", "removing", "it", "." ]
e7ae82b94f1490fa1b7882ada09b57071094b0a5
https://github.com/OpenSextant/SolrTextTagger/blob/e7ae82b94f1490fa1b7882ada09b57071094b0a5/src/main/java/org/opensextant/solrtexttagger/TagLL.java#L107-L116
train
OpenSextant/SolrTextTagger
src/main/java/org/opensextant/solrtexttagger/TermPrefixCursor.java
TermPrefixCursor.postingsEnumToIntsRef
private IntsRef postingsEnumToIntsRef(PostingsEnum postingsEnum, Bits liveDocs) throws IOException { // (The cache can have empty IntsRefs) //lookup prefixBuf in a cache if (docIdsCache != null) { docIds = docIdsCache.get(prefixBuf); if (docIds != null) { return docIds; } } ...
java
private IntsRef postingsEnumToIntsRef(PostingsEnum postingsEnum, Bits liveDocs) throws IOException { // (The cache can have empty IntsRefs) //lookup prefixBuf in a cache if (docIdsCache != null) { docIds = docIdsCache.get(prefixBuf); if (docIds != null) { return docIds; } } ...
[ "private", "IntsRef", "postingsEnumToIntsRef", "(", "PostingsEnum", "postingsEnum", ",", "Bits", "liveDocs", ")", "throws", "IOException", "{", "// (The cache can have empty IntsRefs)", "//lookup prefixBuf in a cache", "if", "(", "docIdsCache", "!=", "null", ")", "{", "do...
Returns an IntsRef either cached or reading postingsEnum. Not null. @param postingsEnum
[ "Returns", "an", "IntsRef", "either", "cached", "or", "reading", "postingsEnum", ".", "Not", "null", "." ]
e7ae82b94f1490fa1b7882ada09b57071094b0a5
https://github.com/OpenSextant/SolrTextTagger/blob/e7ae82b94f1490fa1b7882ada09b57071094b0a5/src/main/java/org/opensextant/solrtexttagger/TermPrefixCursor.java#L151-L181
train
OpenSextant/SolrTextTagger
src/main/java/org/opensextant/solrtexttagger/TaggerRequestHandler.java
TaggerRequestHandler.setTopInitArgsAsInvariants
private void setTopInitArgsAsInvariants(SolrQueryRequest req) { // First convert top level initArgs to SolrParams HashMap<String,String> map = new HashMap<>(initArgs.size()); for (int i=0; i<initArgs.size(); i++) { Object val = initArgs.getVal(i); if (val != null && !(val instanceof NamedList)) ...
java
private void setTopInitArgsAsInvariants(SolrQueryRequest req) { // First convert top level initArgs to SolrParams HashMap<String,String> map = new HashMap<>(initArgs.size()); for (int i=0; i<initArgs.size(); i++) { Object val = initArgs.getVal(i); if (val != null && !(val instanceof NamedList)) ...
[ "private", "void", "setTopInitArgsAsInvariants", "(", "SolrQueryRequest", "req", ")", "{", "// First convert top level initArgs to SolrParams", "HashMap", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<>", "(", "initArgs", ".", "size", "(", ")", ...
This request handler supports configuration options defined at the top level as well as those in typical Solr 'defaults', 'appends', and 'invariants'. The top level ones are treated as invariants.
[ "This", "request", "handler", "supports", "configuration", "options", "defined", "at", "the", "top", "level", "as", "well", "as", "those", "in", "typical", "Solr", "defaults", "appends", "and", "invariants", ".", "The", "top", "level", "ones", "are", "treated"...
e7ae82b94f1490fa1b7882ada09b57071094b0a5
https://github.com/OpenSextant/SolrTextTagger/blob/e7ae82b94f1490fa1b7882ada09b57071094b0a5/src/main/java/org/opensextant/solrtexttagger/TaggerRequestHandler.java#L372-L385
train
xdtianyu/PhoneNumber
phone-number/src/main/java/org/xdty/phone/number/util/Utils.java
Utils.unzip
public void unzip(String zipFile, String location) throws IOException { final int BUFFER_SIZE = 10240; int size; byte[] buffer = new byte[BUFFER_SIZE]; try { if (!location.endsWith("/")) { location += "/"; } File f = new File(location)...
java
public void unzip(String zipFile, String location) throws IOException { final int BUFFER_SIZE = 10240; int size; byte[] buffer = new byte[BUFFER_SIZE]; try { if (!location.endsWith("/")) { location += "/"; } File f = new File(location)...
[ "public", "void", "unzip", "(", "String", "zipFile", ",", "String", "location", ")", "throws", "IOException", "{", "final", "int", "BUFFER_SIZE", "=", "10240", ";", "int", "size", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "BUFFER_SIZE", "...
Unzip a zip file. Will overwrite existing files. @param zipFile Full path of the zip file you'd like to unzip. @param location Full path of the directory you'd like to unzip to (will be created if it doesn't exist). @throws IOException
[ "Unzip", "a", "zip", "file", ".", "Will", "overwrite", "existing", "files", "." ]
5e9646ec84f4b390313e84a5214bd59c35b1adc5
https://github.com/xdtianyu/PhoneNumber/blob/5e9646ec84f4b390313e84a5214bd59c35b1adc5/phone-number/src/main/java/org/xdty/phone/number/util/Utils.java#L90-L145
train
solita/clamav-java
src/main/java/fi/solita/clamav/ClamAVClient.java
ClamAVClient.ping
public boolean ping() throws IOException { try (Socket s = new Socket(hostName,port); OutputStream outs = s.getOutputStream()) { s.setSoTimeout(timeout); outs.write(asBytes("zPING\0")); outs.flush(); byte[] b = new byte[PONG_REPLY_LEN]; InputStream inputStream = s.getInputStream(); ...
java
public boolean ping() throws IOException { try (Socket s = new Socket(hostName,port); OutputStream outs = s.getOutputStream()) { s.setSoTimeout(timeout); outs.write(asBytes("zPING\0")); outs.flush(); byte[] b = new byte[PONG_REPLY_LEN]; InputStream inputStream = s.getInputStream(); ...
[ "public", "boolean", "ping", "(", ")", "throws", "IOException", "{", "try", "(", "Socket", "s", "=", "new", "Socket", "(", "hostName", ",", "port", ")", ";", "OutputStream", "outs", "=", "s", ".", "getOutputStream", "(", ")", ")", "{", "s", ".", "set...
Run PING command to clamd to test it is responding. @return true if the server responded with proper ping reply.
[ "Run", "PING", "command", "to", "clamd", "to", "test", "it", "is", "responding", "." ]
4ff23d37fb0763862db76f2f3389f3e45e80dd09
https://github.com/solita/clamav-java/blob/4ff23d37fb0763862db76f2f3389f3e45e80dd09/src/main/java/fi/solita/clamav/ClamAVClient.java#L52-L67
train
solita/clamav-java
src/main/java/fi/solita/clamav/ClamAVClient.java
ClamAVClient.isCleanReply
public static boolean isCleanReply(byte[] reply) { String r = new String(reply, StandardCharsets.US_ASCII); return (r.contains("OK") && !r.contains("FOUND")); }
java
public static boolean isCleanReply(byte[] reply) { String r = new String(reply, StandardCharsets.US_ASCII); return (r.contains("OK") && !r.contains("FOUND")); }
[ "public", "static", "boolean", "isCleanReply", "(", "byte", "[", "]", "reply", ")", "{", "String", "r", "=", "new", "String", "(", "reply", ",", "StandardCharsets", ".", "US_ASCII", ")", ";", "return", "(", "r", ".", "contains", "(", "\"OK\"", ")", "&&...
Interpret the result from a ClamAV scan, and determine if the result means the data is clean @param reply The reply from the server after scanning @return true if no virus was found according to the clamd reply message
[ "Interpret", "the", "result", "from", "a", "ClamAV", "scan", "and", "determine", "if", "the", "result", "means", "the", "data", "is", "clean" ]
4ff23d37fb0763862db76f2f3389f3e45e80dd09
https://github.com/solita/clamav-java/blob/4ff23d37fb0763862db76f2f3389f3e45e80dd09/src/main/java/fi/solita/clamav/ClamAVClient.java#L133-L136
train
solita/clamav-java
src/main/java/fi/solita/clamav/ClamAVClient.java
ClamAVClient.readAll
private static byte[] readAll(InputStream is) throws IOException { ByteArrayOutputStream tmp = new ByteArrayOutputStream(); byte[] buf = new byte[2000]; int read = 0; do { read = is.read(buf); tmp.write(buf, 0, read); } while ((read > 0) && (is.available() > 0)); return tmp.toByteAr...
java
private static byte[] readAll(InputStream is) throws IOException { ByteArrayOutputStream tmp = new ByteArrayOutputStream(); byte[] buf = new byte[2000]; int read = 0; do { read = is.read(buf); tmp.write(buf, 0, read); } while ((read > 0) && (is.available() > 0)); return tmp.toByteAr...
[ "private", "static", "byte", "[", "]", "readAll", "(", "InputStream", "is", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "tmp", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "byte", "[", "]", "buf", "=", "new", "byte", "[", "2000", "]"...
reads all available bytes from the stream
[ "reads", "all", "available", "bytes", "from", "the", "stream" ]
4ff23d37fb0763862db76f2f3389f3e45e80dd09
https://github.com/solita/clamav-java/blob/4ff23d37fb0763862db76f2f3389f3e45e80dd09/src/main/java/fi/solita/clamav/ClamAVClient.java#L152-L162
train
jaydeepw/audio-wife
libAudioWife/app/src/main/java/nl/changer/audiowife/AudioWife.java
AudioWife.setViewsVisibility
private void setViewsVisibility() { if (mSeekBar != null) { mSeekBar.setVisibility(View.VISIBLE); } if (mPlaybackTime != null) { mPlaybackTime.setVisibility(View.VISIBLE); } if (mRunTime != null) { mRunTime.setVisibility(View.VISIBLE); } if (mTotalTime != null) { mTotalTime.setVisibility(V...
java
private void setViewsVisibility() { if (mSeekBar != null) { mSeekBar.setVisibility(View.VISIBLE); } if (mPlaybackTime != null) { mPlaybackTime.setVisibility(View.VISIBLE); } if (mRunTime != null) { mRunTime.setVisibility(View.VISIBLE); } if (mTotalTime != null) { mTotalTime.setVisibility(V...
[ "private", "void", "setViewsVisibility", "(", ")", "{", "if", "(", "mSeekBar", "!=", "null", ")", "{", "mSeekBar", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "if", "(", "mPlaybackTime", "!=", "null", ")", "{", "mPlaybackTime", ".",...
Ensure the views are visible before playing the audio.
[ "Ensure", "the", "views", "are", "visible", "before", "playing", "the", "audio", "." ]
e5cf4d1306ff742e9c7fc0e3d990792f0b4e56d9
https://github.com/jaydeepw/audio-wife/blob/e5cf4d1306ff742e9c7fc0e3d990792f0b4e56d9/libAudioWife/app/src/main/java/nl/changer/audiowife/AudioWife.java#L182-L207
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityLoggingFactory.java
SecurityLoggingFactory.getControllerInstance
public synchronized static final IntervalLoggerController getControllerInstance() { IntervalLoggerController ic = null; // If no controller, create a bew instance. if( instance == null ) { instance = new DefaultIntervalLoggerController(); ic = new IntervalLoggerControllerWrapper( instance ); }else...
java
public synchronized static final IntervalLoggerController getControllerInstance() { IntervalLoggerController ic = null; // If no controller, create a bew instance. if( instance == null ) { instance = new DefaultIntervalLoggerController(); ic = new IntervalLoggerControllerWrapper( instance ); }else...
[ "public", "synchronized", "static", "final", "IntervalLoggerController", "getControllerInstance", "(", ")", "{", "IntervalLoggerController", "ic", "=", "null", ";", "// If no controller, create a bew instance.", "if", "(", "instance", "==", "null", ")", "{", "instance", ...
Return a single instance of the IntervalLoggerController. @return IntervalLoggerController instance to use.
[ "Return", "a", "single", "instance", "of", "the", "IntervalLoggerController", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityLoggingFactory.java#L21-L41
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/Utils.java
Utils.toSHA
public static String toSHA(byte[] input) { try { MessageDigest md = MessageDigest.getInstance("SHA-256"); return byteArray2Hex(md.digest(input)); } catch (NoSuchAlgorithmException nsae) { // this code should never be reached! } return null; }
java
public static String toSHA(byte[] input) { try { MessageDigest md = MessageDigest.getInstance("SHA-256"); return byteArray2Hex(md.digest(input)); } catch (NoSuchAlgorithmException nsae) { // this code should never be reached! } return null; }
[ "public", "static", "String", "toSHA", "(", "byte", "[", "]", "input", ")", "{", "try", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA-256\"", ")", ";", "return", "byteArray2Hex", "(", "md", ".", "digest", "(", "input", ...
Converts an input byte array to a SHA hash. The actual hash strength is hidden by the method name to allow for future-proofing this API, but the current default is SHA-256. @param input Byte array to hash @return SHA hash of the input String, hex encoded.
[ "Converts", "an", "input", "byte", "array", "to", "a", "SHA", "hash", ".", "The", "actual", "hash", "strength", "is", "hidden", "by", "the", "method", "name", "to", "allow", "for", "future", "-", "proofing", "this", "API", "but", "the", "current", "defau...
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/Utils.java#L36-L44
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/Utils.java
Utils.byteArray2Hex
private static String byteArray2Hex(final byte[] hash) { try (Formatter formatter = new Formatter();) { for (byte b : hash) { formatter.format("%02x", b); } String hex = formatter.toString(); return hex; } }
java
private static String byteArray2Hex(final byte[] hash) { try (Formatter formatter = new Formatter();) { for (byte b : hash) { formatter.format("%02x", b); } String hex = formatter.toString(); return hex; } }
[ "private", "static", "String", "byteArray2Hex", "(", "final", "byte", "[", "]", "hash", ")", "{", "try", "(", "Formatter", "formatter", "=", "new", "Formatter", "(", ")", ";", ")", "{", "for", "(", "byte", "b", ":", "hash", ")", "{", "formatter", "."...
Converts an input byte array to a hex encoded String. @param input Byte array to hex encode @return Hex encoded String of the input byte array
[ "Converts", "an", "input", "byte", "array", "to", "a", "hex", "encoded", "String", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/Utils.java#L53-L61
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerView.java
DefaultIntervalLoggerView.formatStatusMessage
@Override public String formatStatusMessage(IntervalProperty[] properties) { StringBuffer buff = new StringBuffer(500); buff.append( "Watchdog: "); for( IntervalProperty p : properties ) { buff.append(p.getName()); buff.append("="); buff.append(p.getValue()); buff.append(", "); } if( buff...
java
@Override public String formatStatusMessage(IntervalProperty[] properties) { StringBuffer buff = new StringBuffer(500); buff.append( "Watchdog: "); for( IntervalProperty p : properties ) { buff.append(p.getName()); buff.append("="); buff.append(p.getValue()); buff.append(", "); } if( buff...
[ "@", "Override", "public", "String", "formatStatusMessage", "(", "IntervalProperty", "[", "]", "properties", ")", "{", "StringBuffer", "buff", "=", "new", "StringBuffer", "(", "500", ")", ";", "buff", ".", "append", "(", "\"Watchdog: \"", ")", ";", "for", "(...
Format the message to be logged. @param properties An array of properties to log. @return Formatted log message.
[ "Format", "the", "message", "to", "be", "logged", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerView.java#L25-L43
train
javabeanz/owasp-security-logging
owasp-security-logging-log4j/src/main/java/org/owasp/security/logging/log4j/mask/MaskingRewritePolicy.java
MaskingRewritePolicy.rewrite
@Override public LogEvent rewrite(LogEvent source) { // get the markers for the log event. If no markers, nothing can be // tagged confidential and we can return Marker sourceMarker = source.getMarker(); if (sourceMarker == null) { return source; } // get the message. If no message we can return fina...
java
@Override public LogEvent rewrite(LogEvent source) { // get the markers for the log event. If no markers, nothing can be // tagged confidential and we can return Marker sourceMarker = source.getMarker(); if (sourceMarker == null) { return source; } // get the message. If no message we can return fina...
[ "@", "Override", "public", "LogEvent", "rewrite", "(", "LogEvent", "source", ")", "{", "// get the markers for the log event. If no markers, nothing can be", "// tagged confidential and we can return", "Marker", "sourceMarker", "=", "source", ".", "getMarker", "(", ")", ";", ...
Rewrite the event. @param source a logging event that may be returned or used to create a new logging event. @return The LogEvent after rewriting.
[ "Rewrite", "the", "event", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-log4j/src/main/java/org/owasp/security/logging/log4j/mask/MaskingRewritePolicy.java#L48-L91
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java
SecurityUtil.logShellEnvironmentVariables
public static void logShellEnvironmentVariables() { Map<String, String> env = System.getenv(); Iterator<String> keys = env.keySet().iterator(); while (keys.hasNext() ) { String key = keys.next(); String value = env.get(key); logMessage("Env, "+key+"="+value.trim()); } }
java
public static void logShellEnvironmentVariables() { Map<String, String> env = System.getenv(); Iterator<String> keys = env.keySet().iterator(); while (keys.hasNext() ) { String key = keys.next(); String value = env.get(key); logMessage("Env, "+key+"="+value.trim()); } }
[ "public", "static", "void", "logShellEnvironmentVariables", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "env", "=", "System", ".", "getenv", "(", ")", ";", "Iterator", "<", "String", ">", "keys", "=", "env", ".", "keySet", "(", ")", ".", ...
Log shell environment variables associated with Java process.
[ "Log", "shell", "environment", "variables", "associated", "with", "Java", "process", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java#L83-L91
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java
SecurityUtil.logJavaSystemProperties
public static void logJavaSystemProperties() { Properties properties = System.getProperties(); Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext() ) { Object key = keys.next(); Object value = properties.get(key); logMessage("SysProp, "+key+"="+value.toString().trim()); } }
java
public static void logJavaSystemProperties() { Properties properties = System.getProperties(); Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext() ) { Object key = keys.next(); Object value = properties.get(key); logMessage("SysProp, "+key+"="+value.toString().trim()); } }
[ "public", "static", "void", "logJavaSystemProperties", "(", ")", "{", "Properties", "properties", "=", "System", ".", "getProperties", "(", ")", ";", "Iterator", "<", "Object", ">", "keys", "=", "properties", ".", "keySet", "(", ")", ".", "iterator", "(", ...
Log Java system properties.
[ "Log", "Java", "system", "properties", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java#L96-L104
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerModel.java
DefaultIntervalLoggerModel.refresh
@Override public synchronized void refresh() { IntervalProperty[] properties = getProperties(); for(IntervalProperty p : properties ) { p.refresh(); } }
java
@Override public synchronized void refresh() { IntervalProperty[] properties = getProperties(); for(IntervalProperty p : properties ) { p.refresh(); } }
[ "@", "Override", "public", "synchronized", "void", "refresh", "(", ")", "{", "IntervalProperty", "[", "]", "properties", "=", "getProperties", "(", ")", ";", "for", "(", "IntervalProperty", "p", ":", "properties", ")", "{", "p", ".", "refresh", "(", ")", ...
Signal properties to update themselves.
[ "Signal", "properties", "to", "update", "themselves", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerModel.java#L152-L162
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerModel.java
DefaultIntervalLoggerModel.getThreadState
private int getThreadState( Thread.State state ) { Thread[] threads = getAllThreads(); int ct = 0; for( Thread thread : threads ) { if (state.equals(thread.getState()) ) ct++; } return ct; }
java
private int getThreadState( Thread.State state ) { Thread[] threads = getAllThreads(); int ct = 0; for( Thread thread : threads ) { if (state.equals(thread.getState()) ) ct++; } return ct; }
[ "private", "int", "getThreadState", "(", "Thread", ".", "State", "state", ")", "{", "Thread", "[", "]", "threads", "=", "getAllThreads", "(", ")", ";", "int", "ct", "=", "0", ";", "for", "(", "Thread", "thread", ":", "threads", ")", "{", "if", "(", ...
Utility method to retrieve the number of threads of a specified state. @param state Target Thread.State to retrieve. @return Total threads in specified state.
[ "Utility", "method", "to", "retrieve", "the", "number", "of", "threads", "of", "a", "specified", "state", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerModel.java#L170-L182
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerModel.java
DefaultIntervalLoggerModel.getAllThreads
private Thread[] getAllThreads() { final ThreadGroup root = getRootThreadGroup( ); int ct = Thread.activeCount(); int n = 0; Thread[] threads; do { ct *= 2; threads = new Thread[ ct ]; n = root.enumerate( threads, true ); } while ( n == ct ); return java....
java
private Thread[] getAllThreads() { final ThreadGroup root = getRootThreadGroup( ); int ct = Thread.activeCount(); int n = 0; Thread[] threads; do { ct *= 2; threads = new Thread[ ct ]; n = root.enumerate( threads, true ); } while ( n == ct ); return java....
[ "private", "Thread", "[", "]", "getAllThreads", "(", ")", "{", "final", "ThreadGroup", "root", "=", "getRootThreadGroup", "(", ")", ";", "int", "ct", "=", "Thread", ".", "activeCount", "(", ")", ";", "int", "n", "=", "0", ";", "Thread", "[", "]", "th...
Utility method to return all threads in system owned by the root ThreadGroup. @return Array of all threads.
[ "Utility", "method", "to", "return", "all", "threads", "in", "system", "owned", "by", "the", "root", "ThreadGroup", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/DefaultIntervalLoggerModel.java#L189-L202
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/ByteIntervalProperty.java
ByteIntervalProperty.getValue
public String getValue() { String results = super.getValue(); try { Long.parseLong(super.getValue()); results = addUnits(super.getValue()); }catch(NumberFormatException e) {} return results; }
java
public String getValue() { String results = super.getValue(); try { Long.parseLong(super.getValue()); results = addUnits(super.getValue()); }catch(NumberFormatException e) {} return results; }
[ "public", "String", "getValue", "(", ")", "{", "String", "results", "=", "super", ".", "getValue", "(", ")", ";", "try", "{", "Long", ".", "parseLong", "(", "super", ".", "getValue", "(", ")", ")", ";", "results", "=", "addUnits", "(", "super", ".", ...
Return the value in bytes with SI unit name includes. @return Value in bytes with SI unit name. @see #addUnits(String)
[ "Return", "the", "value", "in", "bytes", "with", "SI", "unit", "name", "includes", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/ByteIntervalProperty.java#L26-L37
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/ByteIntervalProperty.java
ByteIntervalProperty.addUnits
public String addUnits( String value ) { StringBuffer buff = new StringBuffer(100); long bytes = Long.parseLong(value); if( bytes < 1000000 ) { buff.append(value); buff.append("B"); } else { int unit = 1000; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = "kMGTPE...
java
public String addUnits( String value ) { StringBuffer buff = new StringBuffer(100); long bytes = Long.parseLong(value); if( bytes < 1000000 ) { buff.append(value); buff.append("B"); } else { int unit = 1000; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = "kMGTPE...
[ "public", "String", "addUnits", "(", "String", "value", ")", "{", "StringBuffer", "buff", "=", "new", "StringBuffer", "(", "100", ")", ";", "long", "bytes", "=", "Long", ".", "parseLong", "(", "value", ")", ";", "if", "(", "bytes", "<", "1000000", ")",...
Utility method to include the SI unit name. @param value The value of a Long in String form. @return Rounded value with appended SI units. For example, 45.3MB, 62B, 27.2GB, etc.
[ "Utility", "method", "to", "include", "the", "SI", "unit", "name", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/ByteIntervalProperty.java#L44-L67
train
javabeanz/owasp-security-logging
owasp-security-logging-common/src/main/java/org/owasp/security/logging/mdc/MDCFilter.java
MDCFilter.doFilter
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; // put values into MDC MDC.put(HOSTNAME, servletRequest.getServerName()); if (productName...
java
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; // put values into MDC MDC.put(HOSTNAME, servletRequest.getServerName()); if (productName...
[ "public", "void", "doFilter", "(", "ServletRequest", "servletRequest", ",", "ServletResponse", "servletResponse", ",", "FilterChain", "filterChain", ")", "throws", "IOException", ",", "ServletException", "{", "HttpServletRequest", "request", "=", "(", "HttpServletRequest"...
Sample filter that populates the MDC on every request. @param servletRequest The request to filter @param servletResponse The response to filter @param filterChain The filter chain for this context
[ "Sample", "filter", "that", "populates", "the", "MDC", "on", "every", "request", "." ]
060dcb1ab5f62aaea274597418ce41c8433a6c10
https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/mdc/MDCFilter.java#L90-L112
train
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/matcher/MultiMatcher.java
MultiMatcher.findResultWithMaxEnd
private static Result findResultWithMaxEnd(List<Result> successResults) { return Collections.max( successResults, new Comparator<Result>() { @Override public int compare(Result o1, Result o2) { return Integer.valueOf(o1.end()).compa...
java
private static Result findResultWithMaxEnd(List<Result> successResults) { return Collections.max( successResults, new Comparator<Result>() { @Override public int compare(Result o1, Result o2) { return Integer.valueOf(o1.end()).compa...
[ "private", "static", "Result", "findResultWithMaxEnd", "(", "List", "<", "Result", ">", "successResults", ")", "{", "return", "Collections", ".", "max", "(", "successResults", ",", "new", "Comparator", "<", "Result", ">", "(", ")", "{", "@", "Override", "pub...
Find the result with the maximum end position and use it as delegate.
[ "Find", "the", "result", "with", "the", "maximum", "end", "position", "and", "use", "it", "as", "delegate", "." ]
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/MultiMatcher.java#L86-L94
train
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java
Matchers.sequence
public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) { checkNotEmpty(matchers); return new Matcher<MultiResult>() { @Override public MultiResult matches(String input, boolean isEof) { int matchCount = 0; Result[] results = new ...
java
public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) { checkNotEmpty(matchers); return new Matcher<MultiResult>() { @Override public MultiResult matches(String input, boolean isEof) { int matchCount = 0; Result[] results = new ...
[ "public", "static", "Matcher", "<", "MultiResult", ">", "sequence", "(", "final", "Matcher", "<", "?", ">", "...", "matchers", ")", "{", "checkNotEmpty", "(", "matchers", ")", ";", "return", "new", "Matcher", "<", "MultiResult", ">", "(", ")", "{", "@", ...
Matches the given matchers one by one. Every successful matches updates the internal buffer. The consequent match operation is performed after the previous match has succeeded. @param matchers the collection of matchers. @return the matcher.
[ "Matches", "the", "given", "matchers", "one", "by", "one", ".", "Every", "successful", "matches", "updates", "the", "internal", "buffer", ".", "The", "consequent", "match", "operation", "is", "performed", "after", "the", "previous", "match", "has", "succeeded", ...
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L247-L285
train
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/ExpectBuilder.java
ExpectBuilder.withTimeout
public final ExpectBuilder withTimeout(long duration, TimeUnit unit) { validateDuration(duration); this.timeout = unit.toMillis(duration); return this; }
java
public final ExpectBuilder withTimeout(long duration, TimeUnit unit) { validateDuration(duration); this.timeout = unit.toMillis(duration); return this; }
[ "public", "final", "ExpectBuilder", "withTimeout", "(", "long", "duration", ",", "TimeUnit", "unit", ")", "{", "validateDuration", "(", "duration", ")", ";", "this", ".", "timeout", "=", "unit", ".", "toMillis", "(", "duration", ")", ";", "return", "this", ...
Sets the default timeout in the given unit for expect operations. Optional, the default value is 30 seconds. @param duration the timeout value @param unit the time unit @return this @throws java.lang.IllegalArgumentException if the timeout {@code <= 0}
[ "Sets", "the", "default", "timeout", "in", "the", "given", "unit", "for", "expect", "operations", ".", "Optional", "the", "default", "value", "is", "30", "seconds", "." ]
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/ExpectBuilder.java#L104-L108
train
Alexey1Gavrilov/ExpectIt
expectit-ant/src/main/java/net/sf/expectit/ant/ExpectSupportImpl.java
ExpectSupportImpl.setInput
public void setInput(int index, InputStream is) { if (index >= inputStreams.length) { inputStreams = Arrays.copyOf(inputStreams, index + 1); } this.inputStreams[index] = is; }
java
public void setInput(int index, InputStream is) { if (index >= inputStreams.length) { inputStreams = Arrays.copyOf(inputStreams, index + 1); } this.inputStreams[index] = is; }
[ "public", "void", "setInput", "(", "int", "index", ",", "InputStream", "is", ")", "{", "if", "(", "index", ">=", "inputStreams", ".", "length", ")", "{", "inputStreams", "=", "Arrays", ".", "copyOf", "(", "inputStreams", ",", "index", "+", "1", ")", ";...
Sets the input streams for the expect instance. @param index the number of the input stream @param is the input stream @see net.sf.expectit.ExpectBuilder#withInputs(java.io.InputStream...)
[ "Sets", "the", "input", "streams", "for", "the", "expect", "instance", "." ]
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-ant/src/main/java/net/sf/expectit/ant/ExpectSupportImpl.java#L144-L149
train
Alexey1Gavrilov/ExpectIt
expectit-ant/src/main/java/net/sf/expectit/ant/filter/FiltersElement.java
FiltersElement.toFilter
public Filter toFilter() { Filter[] result = new Filter[filters.size()]; for (int i = 0; i < result.length; i++) { result[i] = filters.get(i).createFilter(); } return chain(result); }
java
public Filter toFilter() { Filter[] result = new Filter[filters.size()]; for (int i = 0; i < result.length; i++) { result[i] = filters.get(i).createFilter(); } return chain(result); }
[ "public", "Filter", "toFilter", "(", ")", "{", "Filter", "[", "]", "result", "=", "new", "Filter", "[", "filters", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "length", ";", "i", "++", ")", ...
Creates a filter from the list of the children filter elements. @return the filter instance
[ "Creates", "a", "filter", "from", "the", "list", "of", "the", "children", "filter", "elements", "." ]
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-ant/src/main/java/net/sf/expectit/ant/filter/FiltersElement.java#L50-L56
train
Alexey1Gavrilov/ExpectIt
expectit-ant/src/main/java/net/sf/expectit/ant/matcher/AbstractMultiMatcherElement.java
AbstractMultiMatcherElement.getMatchers
protected Matcher<?>[] getMatchers() { Matcher<?>[] matchers = new Matcher<?>[tasks.size()]; for (int i = 0; i < matchers.length; i++) { matchers[i] = tasks.get(i).createMatcher(); } return matchers; }
java
protected Matcher<?>[] getMatchers() { Matcher<?>[] matchers = new Matcher<?>[tasks.size()]; for (int i = 0; i < matchers.length; i++) { matchers[i] = tasks.get(i).createMatcher(); } return matchers; }
[ "protected", "Matcher", "<", "?", ">", "[", "]", "getMatchers", "(", ")", "{", "Matcher", "<", "?", ">", "[", "]", "matchers", "=", "new", "Matcher", "<", "?", ">", "[", "tasks", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "...
Creates and return all the children matchers. @return matcher array
[ "Creates", "and", "return", "all", "the", "children", "matchers", "." ]
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-ant/src/main/java/net/sf/expectit/ant/matcher/AbstractMultiMatcherElement.java#L71-L77
train
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/matcher/SimpleResult.java
SimpleResult.failure
public static Result failure(String input, boolean canStopMatching) { return new SimpleResult(false, input, null, null, canStopMatching); }
java
public static Result failure(String input, boolean canStopMatching) { return new SimpleResult(false, input, null, null, canStopMatching); }
[ "public", "static", "Result", "failure", "(", "String", "input", ",", "boolean", "canStopMatching", ")", "{", "return", "new", "SimpleResult", "(", "false", ",", "input", ",", "null", ",", "null", ",", "canStopMatching", ")", ";", "}" ]
Creates an instance of an unsuccessful match. @param input the input string. @param canStopMatching indicates whether matching operation can be stopped. @return the result object.
[ "Creates", "an", "instance", "of", "an", "unsuccessful", "match", "." ]
5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/SimpleResult.java#L146-L148
train
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/preferences/PreferencesService.java
PreferencesService.savePreferences
@Destroy(priority = AutumnActionPriority.MIN_PRIORITY) public void savePreferences() { final ObjectSet<Preferences> preferencesToFlush = GdxSets.newSet(); for (final Entry<String, Preference<?>> preference : preferences) { final Preferences preferencesFile = namesToFiles.get(preference.k...
java
@Destroy(priority = AutumnActionPriority.MIN_PRIORITY) public void savePreferences() { final ObjectSet<Preferences> preferencesToFlush = GdxSets.newSet(); for (final Entry<String, Preference<?>> preference : preferences) { final Preferences preferencesFile = namesToFiles.get(preference.k...
[ "@", "Destroy", "(", "priority", "=", "AutumnActionPriority", ".", "MIN_PRIORITY", ")", "public", "void", "savePreferences", "(", ")", "{", "final", "ObjectSet", "<", "Preferences", ">", "preferencesToFlush", "=", "GdxSets", ".", "newSet", "(", ")", ";", "for"...
Saves all current preferences. This is a reasonably heavy operation, as it flushes all preferences files - by default, this is done once, before the application is closed.
[ "Saves", "all", "current", "preferences", ".", "This", "is", "a", "reasonably", "heavy", "operation", "as", "it", "flushes", "all", "preferences", "files", "-", "by", "default", "this", "is", "done", "once", "before", "the", "application", "is", "closed", "....
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/preferences/PreferencesService.java#L148-L159
train
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java
Disposables.gracefullyDisposeOf
public static void gracefullyDisposeOf(final Disposable disposable) { try { if (disposable != null) { disposable.dispose(); } } catch (final Throwable exception) { Gdx.app.error("WARN", "Unable to dispose: " + disposable + ". Ignored.", exception); ...
java
public static void gracefullyDisposeOf(final Disposable disposable) { try { if (disposable != null) { disposable.dispose(); } } catch (final Throwable exception) { Gdx.app.error("WARN", "Unable to dispose: " + disposable + ". Ignored.", exception); ...
[ "public", "static", "void", "gracefullyDisposeOf", "(", "final", "Disposable", "disposable", ")", "{", "try", "{", "if", "(", "disposable", "!=", "null", ")", "{", "disposable", ".", "dispose", "(", ")", ";", "}", "}", "catch", "(", "final", "Throwable", ...
Performs null check and disposes of an asset. Ignores exceptions. @param disposable will be disposed of (if it exists).
[ "Performs", "null", "check", "and", "disposes", "of", "an", "asset", ".", "Ignores", "exceptions", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java#L73-L81
train
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java
Dtd.saveSchema
public static void saveSchema(final LmlParser parser, final Appendable appendable) { try { new Dtd().getDtdSchema(parser, appendable); } catch (final IOException exception) { throw new GdxRuntimeException("Unable to append to file.", exception); } }
java
public static void saveSchema(final LmlParser parser, final Appendable appendable) { try { new Dtd().getDtdSchema(parser, appendable); } catch (final IOException exception) { throw new GdxRuntimeException("Unable to append to file.", exception); } }
[ "public", "static", "void", "saveSchema", "(", "final", "LmlParser", "parser", ",", "final", "Appendable", "appendable", ")", "{", "try", "{", "new", "Dtd", "(", ")", ".", "getDtdSchema", "(", "parser", ",", "appendable", ")", ";", "}", "catch", "(", "fi...
Saves DTD schema file containing all possible tags and their attributes. Any problems with the generation will be logged. This is a relatively heavy operation and should be done only during development. @param parser contains parsing data. Used to create mock-up actors. The skin MUST be fully loaded and contain all us...
[ "Saves", "DTD", "schema", "file", "containing", "all", "possible", "tags", "and", "their", "attributes", ".", "Any", "problems", "with", "the", "generation", "will", "be", "logged", ".", "This", "is", "a", "relatively", "heavy", "operation", "and", "should", ...
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java#L54-L60
train
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java
Dtd.saveMinifiedSchema
public static void saveMinifiedSchema(final LmlParser parser, final Appendable appendable) { try { new Dtd().setAppendComments(false).getDtdSchema(parser, appendable); } catch (final IOException exception) { throw new GdxRuntimeException("Unable to append to file.", exception); ...
java
public static void saveMinifiedSchema(final LmlParser parser, final Appendable appendable) { try { new Dtd().setAppendComments(false).getDtdSchema(parser, appendable); } catch (final IOException exception) { throw new GdxRuntimeException("Unable to append to file.", exception); ...
[ "public", "static", "void", "saveMinifiedSchema", "(", "final", "LmlParser", "parser", ",", "final", "Appendable", "appendable", ")", "{", "try", "{", "new", "Dtd", "(", ")", ".", "setAppendComments", "(", "false", ")", ".", "getDtdSchema", "(", "parser", ",...
Saves DTD schema file containing all possible tags and their attributes. Any problems with the generation will be logged. This is a relatively heavy operation and should be done only during development. Comments will not be appended, which will reduce the size of DTD file. @param parser contains parsing data. Used to ...
[ "Saves", "DTD", "schema", "file", "containing", "all", "possible", "tags", "and", "their", "attributes", ".", "Any", "problems", "with", "the", "generation", "will", "be", "logged", ".", "This", "is", "a", "relatively", "heavy", "operation", "and", "should", ...
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java#L71-L77
train
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java
Dtd.getDtdSchema
public void getDtdSchema(final LmlParser parser, final Appendable builder) throws IOException { appendActorTags(builder, parser); appendActorAttributes(parser, builder); appendMacroTags(builder, parser); appendMacroAttributes(parser, builder); }
java
public void getDtdSchema(final LmlParser parser, final Appendable builder) throws IOException { appendActorTags(builder, parser); appendActorAttributes(parser, builder); appendMacroTags(builder, parser); appendMacroAttributes(parser, builder); }
[ "public", "void", "getDtdSchema", "(", "final", "LmlParser", "parser", ",", "final", "Appendable", "builder", ")", "throws", "IOException", "{", "appendActorTags", "(", "builder", ",", "parser", ")", ";", "appendActorAttributes", "(", "parser", ",", "builder", "...
Creates DTD schema file containing all possible tags and their attributes. Any problems with the generation will be logged. This is a relatively heavy operation and should be done only during development. @param parser contains parsing data. Used to create mock-up actors. The skin MUST be fully loaded and contain all ...
[ "Creates", "DTD", "schema", "file", "containing", "all", "possible", "tags", "and", "their", "attributes", ".", "Any", "problems", "with", "the", "generation", "will", "be", "logged", ".", "This", "is", "a", "relatively", "heavy", "operation", "and", "should",...
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java#L108-L113
train
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/ui/controller/impl/AnnotatedViewDialogController.java
AnnotatedViewDialogController.prepareDialogInstance
public void prepareDialogInstance() { final LmlParser parser = interfaceService.getParser(); if (actionContainer != null) { parser.getData().addActionContainer(getId(), actionContainer); } dialog = (Window) parser.createView(wrappedObject, Gdx.files.internal(dialogData.value(...
java
public void prepareDialogInstance() { final LmlParser parser = interfaceService.getParser(); if (actionContainer != null) { parser.getData().addActionContainer(getId(), actionContainer); } dialog = (Window) parser.createView(wrappedObject, Gdx.files.internal(dialogData.value(...
[ "public", "void", "prepareDialogInstance", "(", ")", "{", "final", "LmlParser", "parser", "=", "interfaceService", ".", "getParser", "(", ")", ";", "if", "(", "actionContainer", "!=", "null", ")", "{", "parser", ".", "getData", "(", ")", ".", "addActionConta...
Creates instance of the managed dialog actor.
[ "Creates", "instance", "of", "the", "managed", "dialog", "actor", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/ui/controller/impl/AnnotatedViewDialogController.java#L84-L93
train
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/i18n/LocaleService.java
LocaleService.saveLocaleInPreferences
public void saveLocaleInPreferences(final String preferencesPath, final String preferenceName) { if (Strings.isEmpty(preferencesPath) || Strings.isEmpty(preferenceName)) { throw new GdxRuntimeException( "Preference path and name cannot be empty! These are set automatically if you...
java
public void saveLocaleInPreferences(final String preferencesPath, final String preferenceName) { if (Strings.isEmpty(preferencesPath) || Strings.isEmpty(preferenceName)) { throw new GdxRuntimeException( "Preference path and name cannot be empty! These are set automatically if you...
[ "public", "void", "saveLocaleInPreferences", "(", "final", "String", "preferencesPath", ",", "final", "String", "preferenceName", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "preferencesPath", ")", "||", "Strings", ".", "isEmpty", "(", "preferenceName", ...
Saves current locale in the selected preferences. @param preferencesPath used to retrieve preferences with {@link com.github.czyzby.kiwi.util.gdx.preference.ApplicationPreferences#getPreferences(String)} method. @param preferenceName name of the locale setting in the preferences.
[ "Saves", "current", "locale", "in", "the", "selected", "preferences", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/i18n/LocaleService.java#L178-L186
train
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/asset/AssetService.java
AssetService.load
public <Type> void load(final String assetPath, final Class<Type> assetClass, final AssetLoaderParameters<Type> loadingParameters) { if (isAssetNotScheduled(assetPath)) { assetManager.load(assetPath, assetClass, loadingParameters); } }
java
public <Type> void load(final String assetPath, final Class<Type> assetClass, final AssetLoaderParameters<Type> loadingParameters) { if (isAssetNotScheduled(assetPath)) { assetManager.load(assetPath, assetClass, loadingParameters); } }
[ "public", "<", "Type", ">", "void", "load", "(", "final", "String", "assetPath", ",", "final", "Class", "<", "Type", ">", "assetClass", ",", "final", "AssetLoaderParameters", "<", "Type", ">", "loadingParameters", ")", "{", "if", "(", "isAssetNotScheduled", ...
Schedules loading of the selected asset, if it was not scheduled already. @param assetPath assetPath internal path to the asset. @param assetClass assetClass class of the asset. @param loadingParameters specific loading parameters. @param <Type> type of asset class to load.
[ "Schedules", "loading", "of", "the", "selected", "asset", "if", "it", "was", "not", "scheduled", "already", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/asset/AssetService.java#L98-L103
train
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/asset/AssetService.java
AssetService.unload
public void unload(final String assetPath) { if (assetManager.isLoaded(assetPath) || scheduledAssets.contains(assetPath)) { assetManager.unload(assetPath); } else if (eagerAssetManager.isLoaded(assetPath)) { eagerAssetManager.unload(assetPath); } }
java
public void unload(final String assetPath) { if (assetManager.isLoaded(assetPath) || scheduledAssets.contains(assetPath)) { assetManager.unload(assetPath); } else if (eagerAssetManager.isLoaded(assetPath)) { eagerAssetManager.unload(assetPath); } }
[ "public", "void", "unload", "(", "final", "String", "assetPath", ")", "{", "if", "(", "assetManager", ".", "isLoaded", "(", "assetPath", ")", "||", "scheduledAssets", ".", "contains", "(", "assetPath", ")", ")", "{", "assetManager", ".", "unload", "(", "as...
Schedules disposing of the selected asset. @param assetPath internal path to the asset.
[ "Schedules", "disposing", "of", "the", "selected", "asset", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/asset/AssetService.java#L118-L124
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.overrideTableExtractors
protected void overrideTableExtractors() { StandardTableTarget.MAIN.setTableExtractor(new TableExtractor() { @Override public Table extract(final Table table) { if (table instanceof Dialog) { return ((Dialog) table).getContentTable(); }...
java
protected void overrideTableExtractors() { StandardTableTarget.MAIN.setTableExtractor(new TableExtractor() { @Override public Table extract(final Table table) { if (table instanceof Dialog) { return ((Dialog) table).getContentTable(); }...
[ "protected", "void", "overrideTableExtractors", "(", ")", "{", "StandardTableTarget", ".", "MAIN", ".", "setTableExtractor", "(", "new", "TableExtractor", "(", ")", "{", "@", "Override", "public", "Table", "extract", "(", "final", "Table", "table", ")", "{", "...
Since some multi-table Vis widgets do not extend standard Scene2D widgets, table extractors from multi-table actors need to be changed.
[ "Since", "some", "multi", "-", "table", "Vis", "widgets", "do", "not", "extend", "standard", "Scene2D", "widgets", "table", "extractors", "from", "multi", "-", "table", "actors", "need", "to", "be", "changed", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L169-L192
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.registerVisAttributes
protected void registerVisAttributes() { registerCollapsibleWidgetAttributes(); registerColorPickerAttributes(); registerDraggableAttributes(); registerDragPaneAttributes(); registerFloatingGroupAttributes(); registerFlowGroupsAttributes(); registerGridGroupAttrib...
java
protected void registerVisAttributes() { registerCollapsibleWidgetAttributes(); registerColorPickerAttributes(); registerDraggableAttributes(); registerDragPaneAttributes(); registerFloatingGroupAttributes(); registerFlowGroupsAttributes(); registerGridGroupAttrib...
[ "protected", "void", "registerVisAttributes", "(", ")", "{", "registerCollapsibleWidgetAttributes", "(", ")", ";", "registerColorPickerAttributes", "(", ")", ";", "registerDraggableAttributes", "(", ")", ";", "registerDragPaneAttributes", "(", ")", ";", "registerFloatingG...
Registers attributes of VisUI-specific actors.
[ "Registers", "attributes", "of", "VisUI", "-", "specific", "actors", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L290-L305
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.registerColorPickerAttributes
protected void registerColorPickerAttributes() { addAttributeProcessor(new CloseAfterPickingLmlAttribute(), "closeAfterPickingFinished", "closeAfter"); addAttributeProcessor(new ColorPickerListenerLmlAttribute(), "listener"); addAttributeProcessor(new ColorPickerResponsiveListenerLmlAttribute(),...
java
protected void registerColorPickerAttributes() { addAttributeProcessor(new CloseAfterPickingLmlAttribute(), "closeAfterPickingFinished", "closeAfter"); addAttributeProcessor(new ColorPickerListenerLmlAttribute(), "listener"); addAttributeProcessor(new ColorPickerResponsiveListenerLmlAttribute(),...
[ "protected", "void", "registerColorPickerAttributes", "(", ")", "{", "addAttributeProcessor", "(", "new", "CloseAfterPickingLmlAttribute", "(", ")", ",", "\"closeAfterPickingFinished\"", ",", "\"closeAfter\"", ")", ";", "addAttributeProcessor", "(", "new", "ColorPickerListe...
ColorPicker attributes.
[ "ColorPicker", "attributes", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L437-L445
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.registerDraggableAttributes
protected void registerDraggableAttributes() { addAttributeProcessor(new BlockInputLmlAttribute(), "blockInput"); addAttributeProcessor(new DeadzoneRadiusLmlAttribute(), "deadzone", "deadzoneRadius"); addAttributeProcessor(new DraggedAlphaLmlAttribute(), "alpha"); addAttributeProcessor(n...
java
protected void registerDraggableAttributes() { addAttributeProcessor(new BlockInputLmlAttribute(), "blockInput"); addAttributeProcessor(new DeadzoneRadiusLmlAttribute(), "deadzone", "deadzoneRadius"); addAttributeProcessor(new DraggedAlphaLmlAttribute(), "alpha"); addAttributeProcessor(n...
[ "protected", "void", "registerDraggableAttributes", "(", ")", "{", "addAttributeProcessor", "(", "new", "BlockInputLmlAttribute", "(", ")", ",", "\"blockInput\"", ")", ";", "addAttributeProcessor", "(", "new", "DeadzoneRadiusLmlAttribute", "(", ")", ",", "\"deadzone\"",...
Draggable listener attributes.
[ "Draggable", "listener", "attributes", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L448-L459
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.registerGridGroupAttributes
protected void registerGridGroupAttributes() { addAttributeProcessor(new GridSpacingLmlAttribute(), "spacing"); addAttributeProcessor(new ItemHeightLmlAttribute(), "itemHeight"); addAttributeProcessor(new ItemSizeLmlAttribute(), "itemSize"); addAttributeProcessor(new ItemWidthLmlAttribut...
java
protected void registerGridGroupAttributes() { addAttributeProcessor(new GridSpacingLmlAttribute(), "spacing"); addAttributeProcessor(new ItemHeightLmlAttribute(), "itemHeight"); addAttributeProcessor(new ItemSizeLmlAttribute(), "itemSize"); addAttributeProcessor(new ItemWidthLmlAttribut...
[ "protected", "void", "registerGridGroupAttributes", "(", ")", "{", "addAttributeProcessor", "(", "new", "GridSpacingLmlAttribute", "(", ")", ",", "\"spacing\"", ")", ";", "addAttributeProcessor", "(", "new", "ItemHeightLmlAttribute", "(", ")", ",", "\"itemHeight\"", "...
GridGroup attributes.
[ "GridGroup", "attributes", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L483-L491
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.registerSpinnerAttributes
protected void registerSpinnerAttributes() { addAttributeProcessor(new SpinnerArrayLmlAttribute(), "items"); addAttributeProcessor(new SpinnerDisabledLmlAttribute(), "disabled", "inputDisabled"); addAttributeProcessor(new SpinnerNameLmlAttribute(), "selectorName", "text"); addAttributePr...
java
protected void registerSpinnerAttributes() { addAttributeProcessor(new SpinnerArrayLmlAttribute(), "items"); addAttributeProcessor(new SpinnerDisabledLmlAttribute(), "disabled", "inputDisabled"); addAttributeProcessor(new SpinnerNameLmlAttribute(), "selectorName", "text"); addAttributePr...
[ "protected", "void", "registerSpinnerAttributes", "(", ")", "{", "addAttributeProcessor", "(", "new", "SpinnerArrayLmlAttribute", "(", ")", ",", "\"items\"", ")", ";", "addAttributeProcessor", "(", "new", "SpinnerDisabledLmlAttribute", "(", ")", ",", "\"disabled\"", "...
Spinner attributes.
[ "Spinner", "attributes", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L519-L528
train
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java
VisLmlSyntax.registerValidatorAttributes
protected void registerValidatorAttributes() { // CustomValidator: addAttributeProcessor(new CustomValidatorLmlAttribute(), "validator", "validate", "method", "action", "check"); // FormInputValidator: addAttributeProcessor(new ErrorMessageLmlAttribute(), "error", "errorMsg", "errorMessa...
java
protected void registerValidatorAttributes() { // CustomValidator: addAttributeProcessor(new CustomValidatorLmlAttribute(), "validator", "validate", "method", "action", "check"); // FormInputValidator: addAttributeProcessor(new ErrorMessageLmlAttribute(), "error", "errorMsg", "errorMessa...
[ "protected", "void", "registerValidatorAttributes", "(", ")", "{", "// CustomValidator:", "addAttributeProcessor", "(", "new", "CustomValidatorLmlAttribute", "(", ")", ",", "\"validator\"", ",", "\"validate\"", ",", "\"method\"", ",", "\"action\"", ",", "\"check\"", ")"...
InputValidator implementations' attributes.
[ "InputValidator", "implementations", "attributes", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/parser/impl/VisLmlSyntax.java#L562-L587
train
czyzby/gdx-lml
examples/gdx-autumn-mvc-simple/core/src/com/github/czyzby/config/Configuration.java
Configuration.initiateSkin
@Initiate(priority = AutumnActionPriority.TOP_PRIORITY) public void initiateSkin(final SkinService skinService) { // Loading default VisUI skin with double scale: VisUI.load(VisUI.SkinScale.X2); // Registering VisUI skin with "default" name - skin with this ID will be used by default if no o...
java
@Initiate(priority = AutumnActionPriority.TOP_PRIORITY) public void initiateSkin(final SkinService skinService) { // Loading default VisUI skin with double scale: VisUI.load(VisUI.SkinScale.X2); // Registering VisUI skin with "default" name - skin with this ID will be used by default if no o...
[ "@", "Initiate", "(", "priority", "=", "AutumnActionPriority", ".", "TOP_PRIORITY", ")", "public", "void", "initiateSkin", "(", "final", "SkinService", "skinService", ")", "{", "// Loading default VisUI skin with double scale:", "VisUI", ".", "load", "(", "VisUI", "."...
This action will be invoked when the application is being initialized. Actions are sorted by their priority and invoked in descending order; by manipulating the priority values, you can fully control the flow of your application's initiation. @param skinService its instance will be injected into the method. We're usin...
[ "This", "action", "will", "be", "invoked", "when", "the", "application", "is", "being", "initialized", ".", "Actions", "are", "sorted", "by", "their", "priority", "and", "invoked", "in", "descending", "order", ";", "by", "manipulating", "the", "priority", "val...
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/examples/gdx-autumn-mvc-simple/core/src/com/github/czyzby/config/Configuration.java#L75-L84
train
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/common/Strings.java
Strings.split
public static String[] split(final CharSequence charSequence, final char separator) { if (isEmpty(charSequence)) { return EMPTY_ARRAY; } final int originalSeparatorsCount = countSeparatedCharAppearances(charSequence, separator); int separatorsCount = originalSeparatorsCount; ...
java
public static String[] split(final CharSequence charSequence, final char separator) { if (isEmpty(charSequence)) { return EMPTY_ARRAY; } final int originalSeparatorsCount = countSeparatedCharAppearances(charSequence, separator); int separatorsCount = originalSeparatorsCount; ...
[ "public", "static", "String", "[", "]", "split", "(", "final", "CharSequence", "charSequence", ",", "final", "char", "separator", ")", "{", "if", "(", "isEmpty", "(", "charSequence", ")", ")", "{", "return", "EMPTY_ARRAY", ";", "}", "final", "int", "origin...
As opposed to string's split, this method allows to split a char sequence without a regex, provided that the separator is a single character. Since it does not require pattern compiling and is a simple iteration, this method should be always preferred when it can be used. @param charSequence will be split. Can be null...
[ "As", "opposed", "to", "string", "s", "split", "this", "method", "allows", "to", "split", "a", "char", "sequence", "without", "a", "regex", "provided", "that", "the", "separator", "is", "a", "single", "character", ".", "Since", "it", "does", "not", "requir...
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/common/Strings.java#L439-L486
train
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/collection/GdxMaps.java
GdxMaps.putIfAbsent
public static <Key, Value> Value putIfAbsent(final ObjectMap<Key, Value> map, final Key key, final Value value) { if (!map.containsKey(key)) { map.put(key, value); return value; } return map.get(key); }
java
public static <Key, Value> Value putIfAbsent(final ObjectMap<Key, Value> map, final Key key, final Value value) { if (!map.containsKey(key)) { map.put(key, value); return value; } return map.get(key); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Value", "putIfAbsent", "(", "final", "ObjectMap", "<", "Key", ",", "Value", ">", "map", ",", "final", "Key", "key", ",", "final", "Value", "value", ")", "{", "if", "(", "!", "map", ".", "containsKey...
Puts a value with the given key in the passed map, provided that the passed key isn't already present in the map. @param map may contain a value associated with the key. @param key map key. @param value map value to add. @return value associated with the key in the map (recently added or the previous one). @param <Key...
[ "Puts", "a", "value", "with", "the", "given", "key", "in", "the", "passed", "map", "provided", "that", "the", "passed", "key", "isn", "t", "already", "present", "in", "the", "map", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/collection/GdxMaps.java#L250-L256
train
czyzby/gdx-lml
autumn/src/main/java/com/github/czyzby/autumn/scanner/AbstractClassScanner.java
AbstractClassScanner.extractPackageName
protected String extractPackageName(final Class<?> root) { return root.getName().substring(0, root.getName().length() - root.getSimpleName().length() - 1); }
java
protected String extractPackageName(final Class<?> root) { return root.getName().substring(0, root.getName().length() - root.getSimpleName().length() - 1); }
[ "protected", "String", "extractPackageName", "(", "final", "Class", "<", "?", ">", "root", ")", "{", "return", "root", ".", "getName", "(", ")", ".", "substring", "(", "0", ",", "root", ".", "getName", "(", ")", ".", "length", "(", ")", "-", "root", ...
GWT-friendly method that extracts name of the package from class. @param root its package will be extracted. @return name of root's package.
[ "GWT", "-", "friendly", "method", "that", "extracts", "name", "of", "the", "package", "from", "class", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/autumn/src/main/java/com/github/czyzby/autumn/scanner/AbstractClassScanner.java#L16-L18
train
czyzby/gdx-lml
uedi/src/main/java/com/github/czyzby/uedi/scanner/nongwt/impl/AbstractClassScanner.java
AbstractClassScanner.getPackageName
protected String getPackageName(final Class<?> root) { return root.getName().substring(0, root.getName().length() - root.getSimpleName().length() - 1); }
java
protected String getPackageName(final Class<?> root) { return root.getName().substring(0, root.getName().length() - root.getSimpleName().length() - 1); }
[ "protected", "String", "getPackageName", "(", "final", "Class", "<", "?", ">", "root", ")", "{", "return", "root", ".", "getName", "(", ")", ".", "substring", "(", "0", ",", "root", ".", "getName", "(", ")", ".", "length", "(", ")", "-", "root", "....
GWT-friendly way of extracting package name. @param root scanning root. @return name of the package of the root class.
[ "GWT", "-", "friendly", "way", "of", "extracting", "package", "name", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/uedi/src/main/java/com/github/czyzby/uedi/scanner/nongwt/impl/AbstractClassScanner.java#L15-L17
train
czyzby/gdx-lml
websocket/natives/serialization/src/main/java/com/github/czyzby/websocket/serialization/impl/Serializer.java
Serializer.ensureCapacity
void ensureCapacity(final int bytesAmount) { if (currentByteArrayIndex + bytesAmount >= serializedData.length) { // +1 ensures proper behavior for 0 estimate. int newSerializedDataArrayLength = (serializedData.length + 1) * 2; while (currentByteArrayIndex + bytesAmount >= new...
java
void ensureCapacity(final int bytesAmount) { if (currentByteArrayIndex + bytesAmount >= serializedData.length) { // +1 ensures proper behavior for 0 estimate. int newSerializedDataArrayLength = (serializedData.length + 1) * 2; while (currentByteArrayIndex + bytesAmount >= new...
[ "void", "ensureCapacity", "(", "final", "int", "bytesAmount", ")", "{", "if", "(", "currentByteArrayIndex", "+", "bytesAmount", ">=", "serializedData", ".", "length", ")", "{", "// +1 ensures proper behavior for 0 estimate.", "int", "newSerializedDataArrayLength", "=", ...
Resizes original byte array if the object turns out to be bigger than expected. @param bytesAmount amount of bytes that needs to be added to the array.
[ "Resizes", "original", "byte", "array", "if", "the", "object", "turns", "out", "to", "be", "bigger", "than", "expected", "." ]
7623b322e6afe49ad4dd636c80c230150a1cfa4e
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/websocket/natives/serialization/src/main/java/com/github/czyzby/websocket/serialization/impl/Serializer.java#L38-L50
train