id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3,500 | FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/impl/DefaultSessionFactory.java | DefaultSessionFactory.removeFolders | private final static void removeFolders(String folder, List<String> folderTemplates,
int numberOfDaysToKeepTempFolders) {
long dateToRemoveFiledAfter = (new Date()).getTime()
- (numberOfDaysToKeepTempFolders * MILLISECONDS_IN_DAY);
File tempFolder = new File(folder);
... | java | private final static void removeFolders(String folder, List<String> folderTemplates,
int numberOfDaysToKeepTempFolders) {
long dateToRemoveFiledAfter = (new Date()).getTime()
- (numberOfDaysToKeepTempFolders * MILLISECONDS_IN_DAY);
File tempFolder = new File(folder);
... | [
"private",
"final",
"static",
"void",
"removeFolders",
"(",
"String",
"folder",
",",
"List",
"<",
"String",
">",
"folderTemplates",
",",
"int",
"numberOfDaysToKeepTempFolders",
")",
"{",
"long",
"dateToRemoveFiledAfter",
"=",
"(",
"new",
"Date",
"(",
")",
")",
... | This method can be called to remove specific folders or set how long you
want to keep the temp information.
@param folder
which temp folder you want to remove
@param folderTemplates
the templates of these temp folders
@param numberOfDaysToKeepTempFolders
how long you want to keep the temp information | [
"This",
"method",
"can",
"be",
"called",
"to",
"remove",
"specific",
"folders",
"or",
"set",
"how",
"long",
"you",
"want",
"to",
"keep",
"the",
"temp",
"information",
"."
] | 78d646def1bf0904f79b19a81df0241e07f2c73a | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/impl/DefaultSessionFactory.java#L699-L727 |
3,501 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RetryHandler.java | RetryHandler.runChildWithRetry | static void runChildWithRetry(Object runner, final FrameworkMethod method, RunNotifier notifier, int maxRetry) {
boolean doRetry = false;
Statement statement = invoke(runner, "methodBlock", method);
Description description = invoke(runner, "describeChild", method);
AtomicInteger coun... | java | static void runChildWithRetry(Object runner, final FrameworkMethod method, RunNotifier notifier, int maxRetry) {
boolean doRetry = false;
Statement statement = invoke(runner, "methodBlock", method);
Description description = invoke(runner, "describeChild", method);
AtomicInteger coun... | [
"static",
"void",
"runChildWithRetry",
"(",
"Object",
"runner",
",",
"final",
"FrameworkMethod",
"method",
",",
"RunNotifier",
"notifier",
",",
"int",
"maxRetry",
")",
"{",
"boolean",
"doRetry",
"=",
"false",
";",
"Statement",
"statement",
"=",
"invoke",
"(",
... | Run the specified method, retrying on failure.
@param runner JUnit test runner
@param method test method to be run
@param notifier run notifier through which events are published
@param maxRetry maximum number of retry attempts | [
"Run",
"the",
"specified",
"method",
"retrying",
"on",
"failure",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RetryHandler.java#L43-L76 |
3,502 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RetryHandler.java | RetryHandler.doRetry | static boolean doRetry(FrameworkMethod method, Throwable thrown, AtomicInteger retryCounter) {
boolean doRetry = false;
if ((retryCounter.decrementAndGet() > -1) && isRetriable(method, thrown)) {
LOGGER.warn("### RETRY ### {}", method);
doRetry = true;
}
ret... | java | static boolean doRetry(FrameworkMethod method, Throwable thrown, AtomicInteger retryCounter) {
boolean doRetry = false;
if ((retryCounter.decrementAndGet() > -1) && isRetriable(method, thrown)) {
LOGGER.warn("### RETRY ### {}", method);
doRetry = true;
}
ret... | [
"static",
"boolean",
"doRetry",
"(",
"FrameworkMethod",
"method",
",",
"Throwable",
"thrown",
",",
"AtomicInteger",
"retryCounter",
")",
"{",
"boolean",
"doRetry",
"=",
"false",
";",
"if",
"(",
"(",
"retryCounter",
".",
"decrementAndGet",
"(",
")",
">",
"-",
... | Determine if the indicated failure should be retried.
@param method failed test method
@param thrown exception for this failed test
@param retryCounter retry counter (remaining attempts)
@return {@code true} if failed test should be retried; otherwise {@code false} | [
"Determine",
"if",
"the",
"indicated",
"failure",
"should",
"be",
"retried",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RetryHandler.java#L86-L93 |
3,503 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RetryHandler.java | RetryHandler.isRetriable | static boolean isRetriable(final FrameworkMethod method, final Throwable thrown) {
synchronized(retryAnalyzerLoader) {
for (JUnitRetryAnalyzer analyzer : retryAnalyzerLoader) {
if (analyzer.retry(method, thrown)) {
return true;
}
... | java | static boolean isRetriable(final FrameworkMethod method, final Throwable thrown) {
synchronized(retryAnalyzerLoader) {
for (JUnitRetryAnalyzer analyzer : retryAnalyzerLoader) {
if (analyzer.retry(method, thrown)) {
return true;
}
... | [
"static",
"boolean",
"isRetriable",
"(",
"final",
"FrameworkMethod",
"method",
",",
"final",
"Throwable",
"thrown",
")",
"{",
"synchronized",
"(",
"retryAnalyzerLoader",
")",
"{",
"for",
"(",
"JUnitRetryAnalyzer",
"analyzer",
":",
"retryAnalyzerLoader",
")",
"{",
... | Determine if the specified failed test should be retried.
@param method failed test method
@param thrown exception for this failed test
@return {@code true} if test should be retried; otherwise {@code false} | [
"Determine",
"if",
"the",
"specified",
"failed",
"test",
"should",
"be",
"retried",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RetryHandler.java#L129-L138 |
3,504 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.describeChild | public static Description describeChild(Object target, Object child) {
Object runner = getRunnerForTarget(target);
return invoke(runner, "describeChild", child);
} | java | public static Description describeChild(Object target, Object child) {
Object runner = getRunnerForTarget(target);
return invoke(runner, "describeChild", child);
} | [
"public",
"static",
"Description",
"describeChild",
"(",
"Object",
"target",
",",
"Object",
"child",
")",
"{",
"Object",
"runner",
"=",
"getRunnerForTarget",
"(",
"target",
")",
";",
"return",
"invoke",
"(",
"runner",
",",
"\"describeChild\"",
",",
"child",
")... | Get the description of the indicated child object from the runner for the specified test class instance.
@param target test class instance
@param child child object
@return {@link Description} object for the indicated child | [
"Get",
"the",
"description",
"of",
"the",
"indicated",
"child",
"object",
"from",
"the",
"runner",
"for",
"the",
"specified",
"test",
"class",
"instance",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L208-L211 |
3,505 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.getInstanceClass | public static Class<?> getInstanceClass(Object instance) {
Class<?> clazz = instance.getClass();
return (instance instanceof Hooked) ? clazz.getSuperclass() : clazz;
} | java | public static Class<?> getInstanceClass(Object instance) {
Class<?> clazz = instance.getClass();
return (instance instanceof Hooked) ? clazz.getSuperclass() : clazz;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getInstanceClass",
"(",
"Object",
"instance",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"instance",
".",
"getClass",
"(",
")",
";",
"return",
"(",
"instance",
"instanceof",
"Hooked",
")",
"?",
"clazz",
... | Get class of specified test class instance.
@param instance test class instance
@return class of test class instance | [
"Get",
"class",
"of",
"specified",
"test",
"class",
"instance",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L219-L222 |
3,506 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.getSubclassName | static String getSubclassName(Object testObj) {
Class<?> testClass = testObj.getClass();
String testClassName = testClass.getSimpleName();
String testPackageName = testClass.getPackage().getName();
ReportsDirectory constant = ReportsDirectory.fromObject(testObj);
s... | java | static String getSubclassName(Object testObj) {
Class<?> testClass = testObj.getClass();
String testClassName = testClass.getSimpleName();
String testPackageName = testClass.getPackage().getName();
ReportsDirectory constant = ReportsDirectory.fromObject(testObj);
s... | [
"static",
"String",
"getSubclassName",
"(",
"Object",
"testObj",
")",
"{",
"Class",
"<",
"?",
">",
"testClass",
"=",
"testObj",
".",
"getClass",
"(",
")",
";",
"String",
"testClassName",
"=",
"testClass",
".",
"getSimpleName",
"(",
")",
";",
"String",
"tes... | Get fully-qualified name to use for hooked test class.
@param testObj test class object being hooked
@return fully-qualified name for hooked subclass | [
"Get",
"fully",
"-",
"qualified",
"name",
"to",
"use",
"for",
"hooked",
"test",
"class",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L230-L248 |
3,507 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.invoke | @SuppressWarnings("unchecked")
static <T> T invoke(Object target, String methodName, Object... parameters) {
Class<?>[] parameterTypes = new Class<?>[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterTypes[i] = parameters[i].getClass();
}
... | java | @SuppressWarnings("unchecked")
static <T> T invoke(Object target, String methodName, Object... parameters) {
Class<?>[] parameterTypes = new Class<?>[parameters.length];
for (int i = 0; i < parameters.length; i++) {
parameterTypes[i] = parameters[i].getClass();
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
">",
"T",
"invoke",
"(",
"Object",
"target",
",",
"String",
"methodName",
",",
"Object",
"...",
"parameters",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"new"... | Invoke the named method with the specified parameters on the specified target object.
@param <T> method return type
@param target target object
@param methodName name of the desired method
@param parameters parameters for the method invocation
@return result of method invocation | [
"Invoke",
"the",
"named",
"method",
"with",
"the",
"specified",
"parameters",
"on",
"the",
"specified",
"target",
"object",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L259-L282 |
3,508 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.getDeclaredField | static Field getDeclaredField(Object target, String name) throws NoSuchFieldException {
Throwable thrown = null;
for (Class<?> current = target.getClass(); current != null; current = current.getSuperclass()) {
try {
return current.getDeclaredField(name);
} ca... | java | static Field getDeclaredField(Object target, String name) throws NoSuchFieldException {
Throwable thrown = null;
for (Class<?> current = target.getClass(); current != null; current = current.getSuperclass()) {
try {
return current.getDeclaredField(name);
} ca... | [
"static",
"Field",
"getDeclaredField",
"(",
"Object",
"target",
",",
"String",
"name",
")",
"throws",
"NoSuchFieldException",
"{",
"Throwable",
"thrown",
"=",
"null",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"current",
"=",
"target",
".",
"getClass",
"(",
... | Get the specified field of the supplied object.
@param target target object
@param name field name
@return {@link Field} object for the requested field
@throws NoSuchFieldException if a field with the specified name is not found
@throws SecurityException if the request is denied | [
"Get",
"the",
"specified",
"field",
"of",
"the",
"supplied",
"object",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L293-L307 |
3,509 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.getFieldValue | @SuppressWarnings("unchecked")
static <T> T getFieldValue(Object target, String name) throws IllegalAccessException, NoSuchFieldException, SecurityException {
Field field = getDeclaredField(target, name);
field.setAccessible(true);
return (T) field.get(target);
} | java | @SuppressWarnings("unchecked")
static <T> T getFieldValue(Object target, String name) throws IllegalAccessException, NoSuchFieldException, SecurityException {
Field field = getDeclaredField(target, name);
field.setAccessible(true);
return (T) field.get(target);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
">",
"T",
"getFieldValue",
"(",
"Object",
"target",
",",
"String",
"name",
")",
"throws",
"IllegalAccessException",
",",
"NoSuchFieldException",
",",
"SecurityException",
"{",
"Field",
"field"... | Get the value of the specified field from the supplied object.
@param <T> field value type
@param target target object
@param name field name
@return {@code anything} - the value of the specified field in the supplied object
@throws IllegalAccessException if the {@code Field} object is enforcing access control for an ... | [
"Get",
"the",
"value",
"of",
"the",
"specified",
"field",
"from",
"the",
"supplied",
"object",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L320-L325 |
3,510 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.setFieldValue | static void setFieldValue(Object target, String name, Object value) throws IllegalAccessException, NoSuchFieldException, SecurityException {
Field field = getDeclaredField(target, name);
field.setAccessible(true);
field.set(target, value);
} | java | static void setFieldValue(Object target, String name, Object value) throws IllegalAccessException, NoSuchFieldException, SecurityException {
Field field = getDeclaredField(target, name);
field.setAccessible(true);
field.set(target, value);
} | [
"static",
"void",
"setFieldValue",
"(",
"Object",
"target",
",",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"IllegalAccessException",
",",
"NoSuchFieldException",
",",
"SecurityException",
"{",
"Field",
"field",
"=",
"getDeclaredField",
"(",
"target",
... | Set the value of the specified field of the supplied object.
@param target target object
@param name field name
@param value value to set in the specified field of the supplied object
@throws IllegalAccessException if the {@code Field} object is enforcing access control for an inaccessible field
@throws NoSuchFieldExc... | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"field",
"of",
"the",
"supplied",
"object",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L337-L341 |
3,511 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RuleChainWalker.java | RuleChainWalker.getAttachedRule | @SuppressWarnings("unchecked")
public static <T extends TestRule> Optional<T> getAttachedRule(RuleChain ruleChain, Class<T> ruleType) {
for (TestRule rule : getRuleList(ruleChain)) {
if (rule.getClass() == ruleType) {
return Optional.of((T) rule);
}
}
... | java | @SuppressWarnings("unchecked")
public static <T extends TestRule> Optional<T> getAttachedRule(RuleChain ruleChain, Class<T> ruleType) {
for (TestRule rule : getRuleList(ruleChain)) {
if (rule.getClass() == ruleType) {
return Optional.of((T) rule);
}
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"TestRule",
">",
"Optional",
"<",
"T",
">",
"getAttachedRule",
"(",
"RuleChain",
"ruleChain",
",",
"Class",
"<",
"T",
">",
"ruleType",
")",
"{",
"for",
"(",
"TestR... | Get reference to an instance of the specified test rule type on the supplied rule chain.
@param <T> test rule type
@param ruleChain rule chain to be walked
@param ruleType test rule type
@return optional test rule instance | [
"Get",
"reference",
"to",
"an",
"instance",
"of",
"the",
"specified",
"test",
"rule",
"type",
"on",
"the",
"supplied",
"rule",
"chain",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RuleChainWalker.java#L31-L39 |
3,512 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RuleChainWalker.java | RuleChainWalker.getRuleList | @SuppressWarnings("unchecked")
private static List<TestRule> getRuleList(RuleChain ruleChain) {
Field ruleChainList;
try {
String fieldName = JUnitConfig.getConfig().getString(JUnitSettings.RULE_CHAIN_LIST.key());
ruleChainList = RuleChain.class.getDeclaredField(fieldNam... | java | @SuppressWarnings("unchecked")
private static List<TestRule> getRuleList(RuleChain ruleChain) {
Field ruleChainList;
try {
String fieldName = JUnitConfig.getConfig().getString(JUnitSettings.RULE_CHAIN_LIST.key());
ruleChainList = RuleChain.class.getDeclaredField(fieldNam... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"List",
"<",
"TestRule",
">",
"getRuleList",
"(",
"RuleChain",
"ruleChain",
")",
"{",
"Field",
"ruleChainList",
";",
"try",
"{",
"String",
"fieldName",
"=",
"JUnitConfig",
".",
"getConfig",... | Get the list of test rules from the specified rule chain.
@param ruleChain rule chain
@return list of test rules | [
"Get",
"the",
"list",
"of",
"test",
"rules",
"from",
"the",
"specified",
"rule",
"chain",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RuleChainWalker.java#L47-L58 |
3,513 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RunChild.java | RunChild.applyTimeout | private static void applyTimeout(FrameworkMethod method) {
// if default test timeout is defined
if (LifecycleHooks.getConfig().containsKey(JUnitSettings.TEST_TIMEOUT.key())) {
// get default test timeout
long defaultTimeout = LifecycleHooks.getConfig().getLong(JUnitSettings.... | java | private static void applyTimeout(FrameworkMethod method) {
// if default test timeout is defined
if (LifecycleHooks.getConfig().containsKey(JUnitSettings.TEST_TIMEOUT.key())) {
// get default test timeout
long defaultTimeout = LifecycleHooks.getConfig().getLong(JUnitSettings.... | [
"private",
"static",
"void",
"applyTimeout",
"(",
"FrameworkMethod",
"method",
")",
"{",
"// if default test timeout is defined\r",
"if",
"(",
"LifecycleHooks",
".",
"getConfig",
"(",
")",
".",
"containsKey",
"(",
"JUnitSettings",
".",
"TEST_TIMEOUT",
".",
"key",
"(... | If configured for default test timeout, apply the timeout value to the specified framework method if it doesn't
already specify a longer timeout interval.
@param method {@link FrameworkMethod} object | [
"If",
"configured",
"for",
"default",
"test",
"timeout",
"apply",
"the",
"timeout",
"value",
"to",
"the",
"specified",
"framework",
"method",
"if",
"it",
"doesn",
"t",
"already",
"specify",
"a",
"longer",
"timeout",
"interval",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RunChild.java#L93-L106 |
3,514 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java | ArtifactCollector.captureArtifact | public Optional<Path> captureArtifact(Throwable reason) {
if (! provider.canGetArtifact(getInstance())) {
return Optional.absent();
}
byte[] artifact = provider.getArtifact(getInstance(), reason);
if ((artifact == null) || (artifact.length == 0)) {
... | java | public Optional<Path> captureArtifact(Throwable reason) {
if (! provider.canGetArtifact(getInstance())) {
return Optional.absent();
}
byte[] artifact = provider.getArtifact(getInstance(), reason);
if ((artifact == null) || (artifact.length == 0)) {
... | [
"public",
"Optional",
"<",
"Path",
">",
"captureArtifact",
"(",
"Throwable",
"reason",
")",
"{",
"if",
"(",
"!",
"provider",
".",
"canGetArtifact",
"(",
"getInstance",
"(",
")",
")",
")",
"{",
"return",
"Optional",
".",
"absent",
"(",
")",
";",
"}",
"b... | Capture artifact from the current test result context.
@param reason impetus for capture request; may be 'null'
@return (optional) path at which the captured artifact was stored | [
"Capture",
"artifact",
"from",
"the",
"current",
"test",
"result",
"context",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java#L69-L119 |
3,515 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java | ArtifactCollector.getCollectionPath | private Path getCollectionPath() {
Path collectionPath = PathUtils.ReportsDirectory.getPathForObject(getInstance());
return collectionPath.resolve(provider.getArtifactPath(getInstance()));
} | java | private Path getCollectionPath() {
Path collectionPath = PathUtils.ReportsDirectory.getPathForObject(getInstance());
return collectionPath.resolve(provider.getArtifactPath(getInstance()));
} | [
"private",
"Path",
"getCollectionPath",
"(",
")",
"{",
"Path",
"collectionPath",
"=",
"PathUtils",
".",
"ReportsDirectory",
".",
"getPathForObject",
"(",
"getInstance",
"(",
")",
")",
";",
"return",
"collectionPath",
".",
"resolve",
"(",
"provider",
".",
"getArt... | Get path of directory at which to store artifacts.
@return path of artifact storage directory | [
"Get",
"path",
"of",
"directory",
"at",
"which",
"to",
"store",
"artifacts",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java#L126-L129 |
3,516 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java | ArtifactCollector.retrieveArtifactPaths | public Optional<List<Path>> retrieveArtifactPaths() {
if (artifactPaths.isEmpty()) {
return Optional.absent();
} else {
return Optional.of(artifactPaths);
}
} | java | public Optional<List<Path>> retrieveArtifactPaths() {
if (artifactPaths.isEmpty()) {
return Optional.absent();
} else {
return Optional.of(artifactPaths);
}
} | [
"public",
"Optional",
"<",
"List",
"<",
"Path",
">",
">",
"retrieveArtifactPaths",
"(",
")",
"{",
"if",
"(",
"artifactPaths",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"absent",
"(",
")",
";",
"}",
"else",
"{",
"return",
"Optional"... | Retrieve the paths of artifacts that were stored in the indicated test result.
@return (optional) list of artifact paths | [
"Retrieve",
"the",
"paths",
"of",
"artifacts",
"that",
"were",
"stored",
"in",
"the",
"indicated",
"test",
"result",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java#L164-L170 |
3,517 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java | ArtifactCollector.getWatcher | @SuppressWarnings("unchecked")
public static <S extends ArtifactCollector<? extends ArtifactType>> Optional<S>
getWatcher(Description description, Class<S> watcherType) {
List<ArtifactCollector<? extends ArtifactType>> watcherList = watcherMap.get(description);
if (watcherLis... | java | @SuppressWarnings("unchecked")
public static <S extends ArtifactCollector<? extends ArtifactType>> Optional<S>
getWatcher(Description description, Class<S> watcherType) {
List<ArtifactCollector<? extends ArtifactType>> watcherList = watcherMap.get(description);
if (watcherLis... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"S",
"extends",
"ArtifactCollector",
"<",
"?",
"extends",
"ArtifactType",
">",
">",
"Optional",
"<",
"S",
">",
"getWatcher",
"(",
"Description",
"description",
",",
"Class",
"<",
"S",... | Get reference to an instance of the specified watcher type associated with the described method.
@param <S> type-specific artifact collector class
@param description JUnit method description object
@param watcherType watcher type
@return optional watcher instance | [
"Get",
"reference",
"to",
"an",
"instance",
"of",
"the",
"specified",
"watcher",
"type",
"associated",
"with",
"the",
"described",
"method",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/ArtifactCollector.java#L189-L201 |
3,518 | Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RunReflectiveCall.java | RunReflectiveCall.isParticleMethod | public static boolean isParticleMethod(FrameworkMethod method) {
return ((null != method.getAnnotation(Test.class)) ||
(null != method.getAnnotation(Before.class)) ||
(null != method.getAnnotation(After.class)) ||
(null != method.getAnnotation(BeforeClass.clas... | java | public static boolean isParticleMethod(FrameworkMethod method) {
return ((null != method.getAnnotation(Test.class)) ||
(null != method.getAnnotation(Before.class)) ||
(null != method.getAnnotation(After.class)) ||
(null != method.getAnnotation(BeforeClass.clas... | [
"public",
"static",
"boolean",
"isParticleMethod",
"(",
"FrameworkMethod",
"method",
")",
"{",
"return",
"(",
"(",
"null",
"!=",
"method",
".",
"getAnnotation",
"(",
"Test",
".",
"class",
")",
")",
"||",
"(",
"null",
"!=",
"method",
".",
"getAnnotation",
"... | Determine if the specified method is a test or configuration method.
@param method method whose type is in question
@return {@code true} if specified method is a particle; otherwise {@code false} | [
"Determine",
"if",
"the",
"specified",
"method",
"is",
"a",
"test",
"or",
"configuration",
"method",
"."
] | f24d91f8677d262c27d18ef29ed633eaac717be5 | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RunReflectiveCall.java#L144-L150 |
3,519 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/model/Packet.java | Packet.build | public static Packet build(IoBuffer buffer) {
if (buffer.hasArray()) {
return new Packet(buffer.array());
}
byte[] buf = new byte[buffer.remaining()];
buffer.get(buf);
return new Packet(buf);
} | java | public static Packet build(IoBuffer buffer) {
if (buffer.hasArray()) {
return new Packet(buffer.array());
}
byte[] buf = new byte[buffer.remaining()];
buffer.get(buf);
return new Packet(buf);
} | [
"public",
"static",
"Packet",
"build",
"(",
"IoBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
")",
"{",
"return",
"new",
"Packet",
"(",
"buffer",
".",
"array",
"(",
")",
")",
";",
"}",
"byte",
"[",
"]",
"buf",
"=",
"... | Builds the packet which just wraps the IoBuffer.
@param buffer
@return packet | [
"Builds",
"the",
"packet",
"which",
"just",
"wraps",
"the",
"IoBuffer",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/model/Packet.java#L79-L86 |
3,520 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/model/WSMessage.java | WSMessage.addPayload | public void addPayload(IoBuffer additionalPayload) {
if (payload == null) {
payload = IoBuffer.allocate(additionalPayload.remaining());
payload.setAutoExpand(true);
}
this.payload.put(additionalPayload);
} | java | public void addPayload(IoBuffer additionalPayload) {
if (payload == null) {
payload = IoBuffer.allocate(additionalPayload.remaining());
payload.setAutoExpand(true);
}
this.payload.put(additionalPayload);
} | [
"public",
"void",
"addPayload",
"(",
"IoBuffer",
"additionalPayload",
")",
"{",
"if",
"(",
"payload",
"==",
"null",
")",
"{",
"payload",
"=",
"IoBuffer",
".",
"allocate",
"(",
"additionalPayload",
".",
"remaining",
"(",
")",
")",
";",
"payload",
".",
"setA... | Adds additional payload data.
@param additionalPayload | [
"Adds",
"additional",
"payload",
"data",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/model/WSMessage.java#L95-L101 |
3,521 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/codec/WebSocketDecoder.java | WebSocketDecoder.buildHandshakeResponse | private HandshakeResponse buildHandshakeResponse(WebSocketConnection conn, String clientKey) throws WebSocketException {
if (log.isDebugEnabled()) {
log.debug("buildHandshakeResponse: {} client key: {}", conn, clientKey);
}
byte[] accept;
try {
// performs the acc... | java | private HandshakeResponse buildHandshakeResponse(WebSocketConnection conn, String clientKey) throws WebSocketException {
if (log.isDebugEnabled()) {
log.debug("buildHandshakeResponse: {} client key: {}", conn, clientKey);
}
byte[] accept;
try {
// performs the acc... | [
"private",
"HandshakeResponse",
"buildHandshakeResponse",
"(",
"WebSocketConnection",
"conn",
",",
"String",
"clientKey",
")",
"throws",
"WebSocketException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"buildHands... | Build a handshake response based on the given client key.
@param clientKey
@return response
@throws WebSocketException | [
"Build",
"a",
"handshake",
"response",
"based",
"on",
"the",
"given",
"client",
"key",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/codec/WebSocketDecoder.java#L390-L438 |
3,522 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/codec/WebSocketDecoder.java | WebSocketDecoder.build400Response | private HandshakeResponse build400Response(WebSocketConnection conn) throws WebSocketException {
if (log.isDebugEnabled()) {
log.debug("build400Response: {}", conn);
}
// make up reply data...
IoBuffer buf = IoBuffer.allocate(32);
buf.setAutoExpand(true);
buf.... | java | private HandshakeResponse build400Response(WebSocketConnection conn) throws WebSocketException {
if (log.isDebugEnabled()) {
log.debug("build400Response: {}", conn);
}
// make up reply data...
IoBuffer buf = IoBuffer.allocate(32);
buf.setAutoExpand(true);
buf.... | [
"private",
"HandshakeResponse",
"build400Response",
"(",
"WebSocketConnection",
"conn",
")",
"throws",
"WebSocketException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"build400Response: {}\"",
",",
"conn",
")",
... | Build an HTTP 400 "Bad Request" response.
@return response
@throws WebSocketException | [
"Build",
"an",
"HTTP",
"400",
"Bad",
"Request",
"response",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/codec/WebSocketDecoder.java#L446-L462 |
3,523 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.receive | public void receive(WSMessage message) {
log.trace("receive message");
if (isConnected()) {
WebSocketPlugin plugin = (WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin");
Optional<WebSocketScopeManager> optional = Optional.ofNullable((WebSocketScopeManager) session.getAt... | java | public void receive(WSMessage message) {
log.trace("receive message");
if (isConnected()) {
WebSocketPlugin plugin = (WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin");
Optional<WebSocketScopeManager> optional = Optional.ofNullable((WebSocketScopeManager) session.getAt... | [
"public",
"void",
"receive",
"(",
"WSMessage",
"message",
")",
"{",
"log",
".",
"trace",
"(",
"\"receive message\"",
")",
";",
"if",
"(",
"isConnected",
"(",
")",
")",
"{",
"WebSocketPlugin",
"plugin",
"=",
"(",
"WebSocketPlugin",
")",
"PluginRegistry",
".",... | Receive data from a client.
@param message | [
"Receive",
"data",
"from",
"a",
"client",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L147-L158 |
3,524 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.sendHandshakeResponse | public void sendHandshakeResponse(HandshakeResponse wsResponse) {
log.debug("Writing handshake on session: {}", session.getId());
// create write future
handshakeWriteFuture = session.write(wsResponse);
handshakeWriteFuture.addListener(new IoFutureListener<WriteFuture>() {
@... | java | public void sendHandshakeResponse(HandshakeResponse wsResponse) {
log.debug("Writing handshake on session: {}", session.getId());
// create write future
handshakeWriteFuture = session.write(wsResponse);
handshakeWriteFuture.addListener(new IoFutureListener<WriteFuture>() {
@... | [
"public",
"void",
"sendHandshakeResponse",
"(",
"HandshakeResponse",
"wsResponse",
")",
"{",
"log",
".",
"debug",
"(",
"\"Writing handshake on session: {}\"",
",",
"session",
".",
"getId",
"(",
")",
")",
";",
"// create write future",
"handshakeWriteFuture",
"=",
"ses... | Sends the handshake response.
@param wsResponse | [
"Sends",
"the",
"handshake",
"response",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L165-L197 |
3,525 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.send | public void send(Packet packet) {
if (log.isTraceEnabled()) {
log.trace("send packet: {}", packet);
}
// no handshake flag, queue the packet
if (session.containsAttribute(Constants.HANDSHAKE_COMPLETE)) {
try {
// clear any queued items first
... | java | public void send(Packet packet) {
if (log.isTraceEnabled()) {
log.trace("send packet: {}", packet);
}
// no handshake flag, queue the packet
if (session.containsAttribute(Constants.HANDSHAKE_COMPLETE)) {
try {
// clear any queued items first
... | [
"public",
"void",
"send",
"(",
"Packet",
"packet",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"send packet: {}\"",
",",
"packet",
")",
";",
"}",
"// no handshake flag, queue the packet",
"if",
"(",
"s... | Sends WebSocket packet to the client.
@param packet | [
"Sends",
"WebSocket",
"packet",
"to",
"the",
"client",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L204-L234 |
3,526 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.send | public void send(String data) throws UnsupportedEncodingException {
log.trace("send message: {}", data);
// process the incoming string
if (StringUtils.isNotBlank(data)) {
send(Packet.build(data.getBytes("UTF8"), MessageType.TEXT));
} else {
throw new UnsupportedE... | java | public void send(String data) throws UnsupportedEncodingException {
log.trace("send message: {}", data);
// process the incoming string
if (StringUtils.isNotBlank(data)) {
send(Packet.build(data.getBytes("UTF8"), MessageType.TEXT));
} else {
throw new UnsupportedE... | [
"public",
"void",
"send",
"(",
"String",
"data",
")",
"throws",
"UnsupportedEncodingException",
"{",
"log",
".",
"trace",
"(",
"\"send message: {}\"",
",",
"data",
")",
";",
"// process the incoming string",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"data"... | Sends text to the client.
@param data
string data
@throws UnsupportedEncodingException | [
"Sends",
"text",
"to",
"the",
"client",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L243-L251 |
3,527 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.send | public void send(byte[] buf) {
if (log.isTraceEnabled()) {
log.trace("send binary: {}", Arrays.toString(buf));
}
// send the incoming bytes
send(Packet.build(buf));
} | java | public void send(byte[] buf) {
if (log.isTraceEnabled()) {
log.trace("send binary: {}", Arrays.toString(buf));
}
// send the incoming bytes
send(Packet.build(buf));
} | [
"public",
"void",
"send",
"(",
"byte",
"[",
"]",
"buf",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"send binary: {}\"",
",",
"Arrays",
".",
"toString",
"(",
"buf",
")",
")",
";",
"}",
"// send... | Sends binary data to the client.
@param buf | [
"Sends",
"binary",
"data",
"to",
"the",
"client",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L258-L264 |
3,528 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.sendPing | public void sendPing(byte[] buf) {
if (log.isTraceEnabled()) {
log.trace("send ping: {}", buf);
}
// send ping
send(Packet.build(buf, MessageType.PING));
} | java | public void sendPing(byte[] buf) {
if (log.isTraceEnabled()) {
log.trace("send ping: {}", buf);
}
// send ping
send(Packet.build(buf, MessageType.PING));
} | [
"public",
"void",
"sendPing",
"(",
"byte",
"[",
"]",
"buf",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"send ping: {}\"",
",",
"buf",
")",
";",
"}",
"// send ping",
"send",
"(",
"Packet",
".",
... | Sends a ping to the client.
@param buf | [
"Sends",
"a",
"ping",
"to",
"the",
"client",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L271-L277 |
3,529 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.sendPong | public void sendPong(byte[] buf) {
if (log.isTraceEnabled()) {
log.trace("send pong: {}", buf);
}
// send pong
send(Packet.build(buf, MessageType.PONG));
} | java | public void sendPong(byte[] buf) {
if (log.isTraceEnabled()) {
log.trace("send pong: {}", buf);
}
// send pong
send(Packet.build(buf, MessageType.PONG));
} | [
"public",
"void",
"sendPong",
"(",
"byte",
"[",
"]",
"buf",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"send pong: {}\"",
",",
"buf",
")",
";",
"}",
"// send pong",
"send",
"(",
"Packet",
".",
... | Sends a pong back to the client; normally in response to a ping.
@param buf | [
"Sends",
"a",
"pong",
"back",
"to",
"the",
"client",
";",
"normally",
"in",
"response",
"to",
"a",
"ping",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L284-L290 |
3,530 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.close | public void close(int statusCode, HandshakeResponse errResponse) {
log.warn("Closing connection with status: {}", statusCode);
// remove handshake flag
session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
// clear the delay queue
queue.clear();
// send http error respon... | java | public void close(int statusCode, HandshakeResponse errResponse) {
log.warn("Closing connection with status: {}", statusCode);
// remove handshake flag
session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
// clear the delay queue
queue.clear();
// send http error respon... | [
"public",
"void",
"close",
"(",
"int",
"statusCode",
",",
"HandshakeResponse",
"errResponse",
")",
"{",
"log",
".",
"warn",
"(",
"\"Closing connection with status: {}\"",
",",
"statusCode",
")",
";",
"// remove handshake flag",
"session",
".",
"removeAttribute",
"(",
... | Close with an associated error status.
@param statusCode
@param errResponse | [
"Close",
"with",
"an",
"associated",
"error",
"status",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L358-L433 |
3,531 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketConnection.java | WebSocketConnection.getExtensionsAsString | public String getExtensionsAsString() {
String extensionsList = null;
if (extensions != null) {
StringBuilder sb = new StringBuilder();
for (String key : extensions.keySet()) {
sb.append(key);
sb.append("; ");
}
extensionsLi... | java | public String getExtensionsAsString() {
String extensionsList = null;
if (extensions != null) {
StringBuilder sb = new StringBuilder();
for (String key : extensions.keySet()) {
sb.append(key);
sb.append("; ");
}
extensionsLi... | [
"public",
"String",
"getExtensionsAsString",
"(",
")",
"{",
"String",
"extensionsList",
"=",
"null",
";",
"if",
"(",
"extensions",
"!=",
"null",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
... | Returns the extensions list as a comma separated string as specified by the rfc.
@return extension list string or null if no extensions are enabled | [
"Returns",
"the",
"extensions",
"list",
"as",
"a",
"comma",
"separated",
"string",
"as",
"specified",
"by",
"the",
"rfc",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketConnection.java#L589-L600 |
3,532 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.isEnabled | public boolean isEnabled(String path) {
if (path.startsWith("/")) {
// start after the leading slash
int roomSlashPos = path.indexOf('/', 1);
if (roomSlashPos == -1) {
// check application level scope
path = path.substring(1);
} els... | java | public boolean isEnabled(String path) {
if (path.startsWith("/")) {
// start after the leading slash
int roomSlashPos = path.indexOf('/', 1);
if (roomSlashPos == -1) {
// check application level scope
path = path.substring(1);
} els... | [
"public",
"boolean",
"isEnabled",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"// start after the leading slash",
"int",
"roomSlashPos",
"=",
"path",
".",
"indexOf",
"(",
"'",
"'",
",",
"1",
")",
";... | Returns the enable state of a given path.
@param path
scope / context path
@return enabled if registered as active and false otherwise | [
"Returns",
"the",
"enable",
"state",
"of",
"a",
"given",
"path",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L74-L89 |
3,533 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.addScope | public void addScope(IScope scope) {
String app = scope.getName();
// add the name to the collection (no '/' prefix)
activeRooms.add(app);
// check the context for a predefined websocket scope
IContext ctx = scope.getContext();
if (ctx != null && ctx.hasBean("webSocketSco... | java | public void addScope(IScope scope) {
String app = scope.getName();
// add the name to the collection (no '/' prefix)
activeRooms.add(app);
// check the context for a predefined websocket scope
IContext ctx = scope.getContext();
if (ctx != null && ctx.hasBean("webSocketSco... | [
"public",
"void",
"addScope",
"(",
"IScope",
"scope",
")",
"{",
"String",
"app",
"=",
"scope",
".",
"getName",
"(",
")",
";",
"// add the name to the collection (no '/' prefix)",
"activeRooms",
".",
"add",
"(",
"app",
")",
";",
"// check the context for a predefined... | Adds a scope to the enabled applications.
@param scope
the application scope | [
"Adds",
"a",
"scope",
"to",
"the",
"enabled",
"applications",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L97-L125 |
3,534 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.addWebSocketScope | public void addWebSocketScope(WebSocketScope webSocketScope) {
String path = webSocketScope.getPath();
if (scopes.putIfAbsent(path, webSocketScope) == null) {
log.info("addWebSocketScope: {}", webSocketScope);
notifyListeners(WebSocketEvent.SCOPE_ADDED, webSocketScope);
}... | java | public void addWebSocketScope(WebSocketScope webSocketScope) {
String path = webSocketScope.getPath();
if (scopes.putIfAbsent(path, webSocketScope) == null) {
log.info("addWebSocketScope: {}", webSocketScope);
notifyListeners(WebSocketEvent.SCOPE_ADDED, webSocketScope);
}... | [
"public",
"void",
"addWebSocketScope",
"(",
"WebSocketScope",
"webSocketScope",
")",
"{",
"String",
"path",
"=",
"webSocketScope",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"scopes",
".",
"putIfAbsent",
"(",
"path",
",",
"webSocketScope",
")",
"==",
"null",
... | Adds a websocket scope.
@param webSocketScope | [
"Adds",
"a",
"websocket",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L154-L160 |
3,535 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.removeWebSocketScope | public void removeWebSocketScope(WebSocketScope webSocketScope) {
log.info("removeWebSocketScope: {}", webSocketScope);
WebSocketScope wsScope = scopes.remove(webSocketScope.getPath());
if (wsScope != null) {
notifyListeners(WebSocketEvent.SCOPE_REMOVED, wsScope);
}
} | java | public void removeWebSocketScope(WebSocketScope webSocketScope) {
log.info("removeWebSocketScope: {}", webSocketScope);
WebSocketScope wsScope = scopes.remove(webSocketScope.getPath());
if (wsScope != null) {
notifyListeners(WebSocketEvent.SCOPE_REMOVED, wsScope);
}
} | [
"public",
"void",
"removeWebSocketScope",
"(",
"WebSocketScope",
"webSocketScope",
")",
"{",
"log",
".",
"info",
"(",
"\"removeWebSocketScope: {}\"",
",",
"webSocketScope",
")",
";",
"WebSocketScope",
"wsScope",
"=",
"scopes",
".",
"remove",
"(",
"webSocketScope",
"... | Removes a websocket scope.
@param webSocketScope | [
"Removes",
"a",
"websocket",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L167-L173 |
3,536 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.addConnection | public void addConnection(WebSocketConnection conn) {
WebSocketScope scope = getScope(conn);
scope.addConnection(conn);
} | java | public void addConnection(WebSocketConnection conn) {
WebSocketScope scope = getScope(conn);
scope.addConnection(conn);
} | [
"public",
"void",
"addConnection",
"(",
"WebSocketConnection",
"conn",
")",
"{",
"WebSocketScope",
"scope",
"=",
"getScope",
"(",
"conn",
")",
";",
"scope",
".",
"addConnection",
"(",
"conn",
")",
";",
"}"
] | Add the connection on scope.
@param conn
WebSocketConnection | [
"Add",
"the",
"connection",
"on",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L181-L184 |
3,537 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.addListener | public void addListener(IWebSocketDataListener listener, String path) {
log.trace("addListener: {}", listener);
WebSocketScope scope = getScope(path);
if (scope != null) {
scope.addListener(listener);
} else {
log.info("Scope not found for path: {}", path);
... | java | public void addListener(IWebSocketDataListener listener, String path) {
log.trace("addListener: {}", listener);
WebSocketScope scope = getScope(path);
if (scope != null) {
scope.addListener(listener);
} else {
log.info("Scope not found for path: {}", path);
... | [
"public",
"void",
"addListener",
"(",
"IWebSocketDataListener",
"listener",
",",
"String",
"path",
")",
"{",
"log",
".",
"trace",
"(",
"\"addListener: {}\"",
",",
"listener",
")",
";",
"WebSocketScope",
"scope",
"=",
"getScope",
"(",
"path",
")",
";",
"if",
... | Add the listener on scope via its path.
@param listener
IWebSocketDataListener
@param path | [
"Add",
"the",
"listener",
"on",
"scope",
"via",
"its",
"path",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L212-L220 |
3,538 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.removeListener | public void removeListener(IWebSocketDataListener listener, String path) {
log.trace("removeListener: {}", listener);
WebSocketScope scope = getScope(path);
if (scope != null) {
scope.removeListener(listener);
if (!scope.isValid()) {
// scope is not valid.... | java | public void removeListener(IWebSocketDataListener listener, String path) {
log.trace("removeListener: {}", listener);
WebSocketScope scope = getScope(path);
if (scope != null) {
scope.removeListener(listener);
if (!scope.isValid()) {
// scope is not valid.... | [
"public",
"void",
"removeListener",
"(",
"IWebSocketDataListener",
"listener",
",",
"String",
"path",
")",
"{",
"log",
".",
"trace",
"(",
"\"removeListener: {}\"",
",",
"listener",
")",
";",
"WebSocketScope",
"scope",
"=",
"getScope",
"(",
"path",
")",
";",
"i... | Remove listener from scope via its path.
@param listener
IWebSocketDataListener
@param path | [
"Remove",
"listener",
"from",
"scope",
"via",
"its",
"path",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L229-L241 |
3,539 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.makeScope | public void makeScope(String path) {
log.debug("makeScope: {}", path);
WebSocketScope wsScope = null;
if (!scopes.containsKey(path)) {
// new websocket scope
wsScope = new WebSocketScope();
wsScope.setPath(path);
notifyListeners(WebSocketEvent.SCOP... | java | public void makeScope(String path) {
log.debug("makeScope: {}", path);
WebSocketScope wsScope = null;
if (!scopes.containsKey(path)) {
// new websocket scope
wsScope = new WebSocketScope();
wsScope.setPath(path);
notifyListeners(WebSocketEvent.SCOP... | [
"public",
"void",
"makeScope",
"(",
"String",
"path",
")",
"{",
"log",
".",
"debug",
"(",
"\"makeScope: {}\"",
",",
"path",
")",
";",
"WebSocketScope",
"wsScope",
"=",
"null",
";",
"if",
"(",
"!",
"scopes",
".",
"containsKey",
"(",
"path",
")",
")",
"{... | Create a web socket scope. Use the IWebSocketScopeListener interface to configure the created scope.
@param path | [
"Create",
"a",
"web",
"socket",
"scope",
".",
"Use",
"the",
"IWebSocketScopeListener",
"interface",
"to",
"configure",
"the",
"created",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L248-L261 |
3,540 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.makeScope | public void makeScope(IScope scope) {
log.debug("makeScope: {}", scope);
String path = scope.getContextPath();
WebSocketScope wsScope = null;
if (!scopes.containsKey(path)) {
// add the name to the collection (no '/' prefix)
activeRooms.add(scope.getName());
... | java | public void makeScope(IScope scope) {
log.debug("makeScope: {}", scope);
String path = scope.getContextPath();
WebSocketScope wsScope = null;
if (!scopes.containsKey(path)) {
// add the name to the collection (no '/' prefix)
activeRooms.add(scope.getName());
... | [
"public",
"void",
"makeScope",
"(",
"IScope",
"scope",
")",
"{",
"log",
".",
"debug",
"(",
"\"makeScope: {}\"",
",",
"scope",
")",
";",
"String",
"path",
"=",
"scope",
".",
"getContextPath",
"(",
")",
";",
"WebSocketScope",
"wsScope",
"=",
"null",
";",
"... | Create a web socket scope from a server IScope. Use the IWebSocketScopeListener interface to configure the created scope.
@param scope | [
"Create",
"a",
"web",
"socket",
"scope",
"from",
"a",
"server",
"IScope",
".",
"Use",
"the",
"IWebSocketScopeListener",
"interface",
"to",
"configure",
"the",
"created",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L268-L285 |
3,541 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.getScope | public WebSocketScope getScope(String path) {
log.debug("getScope: {}", path);
WebSocketScope scope = scopes.get(path);
// if we dont find a scope, go for default
if (scope == null) {
scope = scopes.get("default");
}
log.debug("Returning: {}", scope);
... | java | public WebSocketScope getScope(String path) {
log.debug("getScope: {}", path);
WebSocketScope scope = scopes.get(path);
// if we dont find a scope, go for default
if (scope == null) {
scope = scopes.get("default");
}
log.debug("Returning: {}", scope);
... | [
"public",
"WebSocketScope",
"getScope",
"(",
"String",
"path",
")",
"{",
"log",
".",
"debug",
"(",
"\"getScope: {}\"",
",",
"path",
")",
";",
"WebSocketScope",
"scope",
"=",
"scopes",
".",
"get",
"(",
"path",
")",
";",
"// if we dont find a scope, go for default... | Get the corresponding scope.
@param path
scope path
@return scope | [
"Get",
"the",
"corresponding",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L294-L303 |
3,542 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.getScope | private WebSocketScope getScope(WebSocketConnection conn) {
if (log.isTraceEnabled()) {
log.trace("Scopes: {}", scopes);
}
log.debug("getScope: {}", conn);
WebSocketScope wsScope;
String path = conn.getPath();
if (!scopes.containsKey(path)) {
// ch... | java | private WebSocketScope getScope(WebSocketConnection conn) {
if (log.isTraceEnabled()) {
log.trace("Scopes: {}", scopes);
}
log.debug("getScope: {}", conn);
WebSocketScope wsScope;
String path = conn.getPath();
if (!scopes.containsKey(path)) {
// ch... | [
"private",
"WebSocketScope",
"getScope",
"(",
"WebSocketConnection",
"conn",
")",
"{",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"Scopes: {}\"",
",",
"scopes",
")",
";",
"}",
"log",
".",
"debug",
"(",
"\"get... | Get the corresponding scope, if none exists, make new one.
@param conn
@return wsScope | [
"Get",
"the",
"corresponding",
"scope",
"if",
"none",
"exists",
"make",
"new",
"one",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L311-L333 |
3,543 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScopeManager.java | WebSocketScopeManager.setApplication | public void setApplication(IScope appScope) {
log.debug("Application scope: {}", appScope);
this.appScope = appScope;
// add the name to the collection (no '/' prefix)
activeRooms.add(appScope.getName());
} | java | public void setApplication(IScope appScope) {
log.debug("Application scope: {}", appScope);
this.appScope = appScope;
// add the name to the collection (no '/' prefix)
activeRooms.add(appScope.getName());
} | [
"public",
"void",
"setApplication",
"(",
"IScope",
"appScope",
")",
"{",
"log",
".",
"debug",
"(",
"\"Application scope: {}\"",
",",
"appScope",
")",
";",
"this",
".",
"appScope",
"=",
"appScope",
";",
"// add the name to the collection (no '/' prefix)",
"activeRooms"... | Set the application scope for this manager.
@param appScope | [
"Set",
"the",
"application",
"scope",
"for",
"this",
"manager",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScopeManager.java#L349-L354 |
3,544 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/codec/WebSocketEncoder.java | WebSocketEncoder.encodeOutgoingData | public static IoBuffer encodeOutgoingData(Packet packet) {
log.debug("encode outgoing: {}", packet);
// get the payload data
IoBuffer data = packet.getData();
// get the frame length based on the byte count
int frameLen = data.limit();
// start with frame length + 2b (hea... | java | public static IoBuffer encodeOutgoingData(Packet packet) {
log.debug("encode outgoing: {}", packet);
// get the payload data
IoBuffer data = packet.getData();
// get the frame length based on the byte count
int frameLen = data.limit();
// start with frame length + 2b (hea... | [
"public",
"static",
"IoBuffer",
"encodeOutgoingData",
"(",
"Packet",
"packet",
")",
"{",
"log",
".",
"debug",
"(",
"\"encode outgoing: {}\"",
",",
"packet",
")",
";",
"// get the payload data",
"IoBuffer",
"data",
"=",
"packet",
".",
"getData",
"(",
")",
";",
... | Encode the in buffer according to the Section 5.2. RFC 6455 | [
"Encode",
"the",
"in",
"buffer",
"according",
"to",
"the",
"Section",
"5",
".",
"2",
".",
"RFC",
"6455"
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/codec/WebSocketEncoder.java#L66-L123 |
3,545 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketPlugin.java | WebSocketPlugin.getManager | public WebSocketScopeManager getManager(String path) {
log.debug("getManager: {}", path);
// determine what the app scope name is
String[] parts = path.split("\\/");
if (log.isTraceEnabled()) {
log.trace("Path parts: {}", Arrays.toString(parts));
}
if (parts.l... | java | public WebSocketScopeManager getManager(String path) {
log.debug("getManager: {}", path);
// determine what the app scope name is
String[] parts = path.split("\\/");
if (log.isTraceEnabled()) {
log.trace("Path parts: {}", Arrays.toString(parts));
}
if (parts.l... | [
"public",
"WebSocketScopeManager",
"getManager",
"(",
"String",
"path",
")",
"{",
"log",
".",
"debug",
"(",
"\"getManager: {}\"",
",",
"path",
")",
";",
"// determine what the app scope name is",
"String",
"[",
"]",
"parts",
"=",
"path",
".",
"split",
"(",
"\"\\... | Returns a WebSocketScopeManager for a given path.
@param path
@return WebSocketScopeManager if registered for the given path and null otherwise | [
"Returns",
"a",
"WebSocketScopeManager",
"for",
"a",
"given",
"path",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketPlugin.java#L104-L128 |
3,546 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScope.java | WebSocketScope.register | public void register() {
log.info("Application scope: {}", scope);
// set the logger to the app scope
//log = Red5LoggerFactory.getLogger(WebSocketScope.class, scope.getName());
WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin")).getManager(sco... | java | public void register() {
log.info("Application scope: {}", scope);
// set the logger to the app scope
//log = Red5LoggerFactory.getLogger(WebSocketScope.class, scope.getName());
WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin("WebSocketPlugin")).getManager(sco... | [
"public",
"void",
"register",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Application scope: {}\"",
",",
"scope",
")",
";",
"// set the logger to the app scope",
"//log = Red5LoggerFactory.getLogger(WebSocketScope.class, scope.getName());",
"WebSocketScopeManager",
"manager",
"=... | Registers with the WebSocketScopeManager. | [
"Registers",
"with",
"the",
"WebSocketScopeManager",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScope.java#L74-L83 |
3,547 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScope.java | WebSocketScope.unregister | public void unregister() {
// clean up the connections by first closing them
for (WebSocketConnection conn : conns) {
conn.close();
}
conns.clear();
// clean up the listeners by first stopping them
for (IWebSocketDataListener listener : listeners) {
... | java | public void unregister() {
// clean up the connections by first closing them
for (WebSocketConnection conn : conns) {
conn.close();
}
conns.clear();
// clean up the listeners by first stopping them
for (IWebSocketDataListener listener : listeners) {
... | [
"public",
"void",
"unregister",
"(",
")",
"{",
"// clean up the connections by first closing them",
"for",
"(",
"WebSocketConnection",
"conn",
":",
"conns",
")",
"{",
"conn",
".",
"close",
"(",
")",
";",
"}",
"conns",
".",
"clear",
"(",
")",
";",
"// clean up ... | Un-registers from the WebSocketScopeManager. | [
"Un",
"-",
"registers",
"from",
"the",
"WebSocketScopeManager",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScope.java#L88-L99 |
3,548 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScope.java | WebSocketScope.addConnection | public void addConnection(WebSocketConnection conn) {
conns.add(conn);
for (IWebSocketDataListener listener : listeners) {
listener.onWSConnect(conn);
}
} | java | public void addConnection(WebSocketConnection conn) {
conns.add(conn);
for (IWebSocketDataListener listener : listeners) {
listener.onWSConnect(conn);
}
} | [
"public",
"void",
"addConnection",
"(",
"WebSocketConnection",
"conn",
")",
"{",
"conns",
".",
"add",
"(",
"conn",
")",
";",
"for",
"(",
"IWebSocketDataListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"onWSConnect",
"(",
"conn",
")",
";",
... | Add new connection on scope.
@param conn
WebSocketConnection | [
"Add",
"new",
"connection",
"on",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScope.java#L154-L159 |
3,549 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScope.java | WebSocketScope.setListeners | public void setListeners(Collection<IWebSocketDataListener> listeners) {
log.trace("setListeners: {}", listeners);
this.listeners.addAll(listeners);
} | java | public void setListeners(Collection<IWebSocketDataListener> listeners) {
log.trace("setListeners: {}", listeners);
this.listeners.addAll(listeners);
} | [
"public",
"void",
"setListeners",
"(",
"Collection",
"<",
"IWebSocketDataListener",
">",
"listeners",
")",
"{",
"log",
".",
"trace",
"(",
"\"setListeners: {}\"",
",",
"listeners",
")",
";",
"this",
".",
"listeners",
".",
"addAll",
"(",
"listeners",
")",
";",
... | Add new listeners on scope.
@param listeners
list of IWebSocketDataListener | [
"Add",
"new",
"listeners",
"on",
"scope",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScope.java#L202-L205 |
3,550 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/WebSocketScope.java | WebSocketScope.onMessage | public void onMessage(WSMessage message) {
log.trace("Listeners: {}", listeners.size());
for (IWebSocketDataListener listener : listeners) {
try {
listener.onWSMessage(message);
} catch (Exception e) {
log.warn("onMessage exception", e);
... | java | public void onMessage(WSMessage message) {
log.trace("Listeners: {}", listeners.size());
for (IWebSocketDataListener listener : listeners) {
try {
listener.onWSMessage(message);
} catch (Exception e) {
log.warn("onMessage exception", e);
... | [
"public",
"void",
"onMessage",
"(",
"WSMessage",
"message",
")",
"{",
"log",
".",
"trace",
"(",
"\"Listeners: {}\"",
",",
"listeners",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"IWebSocketDataListener",
"listener",
":",
"listeners",
")",
"{",
"try",
"{"... | Message received from client and passed on to the listeners.
@param message | [
"Message",
"received",
"from",
"client",
"and",
"passed",
"on",
"to",
"the",
"listeners",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/WebSocketScope.java#L230-L239 |
3,551 | Red5/red5-websocket | src/main/java/org/red5/net/websocket/util/IdGenerator.java | IdGenerator.generateId | public static final long generateId() {
long id = 0;
// add new seed material from current time
random.addSeedMaterial(ThreadLocalRandom.current().nextLong());
// get a new id
byte[] bytes = new byte[16];
// get random bytes
random.nextBytes(bytes);
for (i... | java | public static final long generateId() {
long id = 0;
// add new seed material from current time
random.addSeedMaterial(ThreadLocalRandom.current().nextLong());
// get a new id
byte[] bytes = new byte[16];
// get random bytes
random.nextBytes(bytes);
for (i... | [
"public",
"static",
"final",
"long",
"generateId",
"(",
")",
"{",
"long",
"id",
"=",
"0",
";",
"// add new seed material from current time",
"random",
".",
"addSeedMaterial",
"(",
"ThreadLocalRandom",
".",
"current",
"(",
")",
".",
"nextLong",
"(",
")",
")",
"... | Returns a cryptographically generated id.
@return id | [
"Returns",
"a",
"cryptographically",
"generated",
"id",
"."
] | 24b53f2f3875624fb01f0a2604f4117583aeab40 | https://github.com/Red5/red5-websocket/blob/24b53f2f3875624fb01f0a2604f4117583aeab40/src/main/java/org/red5/net/websocket/util/IdGenerator.java#L40-L53 |
3,552 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.capitalize | static public String capitalize(String string0) {
if (string0 == null) {
return null;
}
int length = string0.length();
// if empty string, just return it
if (length == 0) {
return string0;
} else if (length == 1) {
return string0.toUppe... | java | static public String capitalize(String string0) {
if (string0 == null) {
return null;
}
int length = string0.length();
// if empty string, just return it
if (length == 0) {
return string0;
} else if (length == 1) {
return string0.toUppe... | [
"static",
"public",
"String",
"capitalize",
"(",
"String",
"string0",
")",
"{",
"if",
"(",
"string0",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"length",
"=",
"string0",
".",
"length",
"(",
")",
";",
"// if empty string, just return it",
"... | Safely capitalizes a string by converting the first character to upper
case. Handles null, empty, and strings of length of 1 or greater. For
example, this will convert "joe" to "Joe". If the string is null, this
will return null. If the string is empty such as "", then it'll just
return an empty string such as "".
@... | [
"Safely",
"capitalizes",
"a",
"string",
"by",
"converting",
"the",
"first",
"character",
"to",
"upper",
"case",
".",
"Handles",
"null",
"empty",
"and",
"strings",
"of",
"length",
"of",
"1",
"or",
"greater",
".",
"For",
"example",
"this",
"will",
"convert",
... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L212-L228 |
3,553 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.uncapitalize | static public String uncapitalize(String string0) {
if (string0 == null) {
return null;
}
int length = string0.length();
// if empty string, just return it
if (length == 0) {
return string0;
} else if (length == 1) {
return string0.toLo... | java | static public String uncapitalize(String string0) {
if (string0 == null) {
return null;
}
int length = string0.length();
// if empty string, just return it
if (length == 0) {
return string0;
} else if (length == 1) {
return string0.toLo... | [
"static",
"public",
"String",
"uncapitalize",
"(",
"String",
"string0",
")",
"{",
"if",
"(",
"string0",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"length",
"=",
"string0",
".",
"length",
"(",
")",
";",
"// if empty string, just return it",
... | Safely uncapitalizes a string by converting the first character to lower
case. Handles null, empty, and strings of length of 1 or greater. For
example, this will convert "Joe" to "joe". If the string is null, this
will return null. If the string is empty such as "", then it'll just
return an empty string such as "".... | [
"Safely",
"uncapitalizes",
"a",
"string",
"by",
"converting",
"the",
"first",
"character",
"to",
"lower",
"case",
".",
"Handles",
"null",
"empty",
"and",
"strings",
"of",
"length",
"of",
"1",
"or",
"greater",
".",
"For",
"example",
"this",
"will",
"convert",... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L239-L255 |
3,554 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.indexOf | static public int indexOf(String[] strings, String targetString) {
if (strings == null)
return -1;
for (int i = 0; i < strings.length; i++) {
if (strings[i] == null) {
if (targetString == null) {
return i;
}
} else {... | java | static public int indexOf(String[] strings, String targetString) {
if (strings == null)
return -1;
for (int i = 0; i < strings.length; i++) {
if (strings[i] == null) {
if (targetString == null) {
return i;
}
} else {... | [
"static",
"public",
"int",
"indexOf",
"(",
"String",
"[",
"]",
"strings",
",",
"String",
"targetString",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"return",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strings",
".",
... | Finds the first occurrence of the targetString in the array of strings.
Returns -1 if an occurrence wasn't found. This
method will return true if a "null" is contained in the array and the
targetString is also null.
@param strings The array of strings to search.
@param targetString The string to search for
@return The ... | [
"Finds",
"the",
"first",
"occurrence",
"of",
"the",
"targetString",
"in",
"the",
"array",
"of",
"strings",
".",
"Returns",
"-",
"1",
"if",
"an",
"occurrence",
"wasn",
"t",
"found",
".",
"This",
"method",
"will",
"return",
"true",
"if",
"a",
"null",
"is",... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L280-L297 |
3,555 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.stripQuotes | static public String stripQuotes(String string0) {
// if an empty string, return it
if (string0.length() == 0) {
return string0;
}
// if the first and last characters are quotes, just do 1 substring
if (string0.length() > 1 && string0.charAt(0) == '"' && string0.charA... | java | static public String stripQuotes(String string0) {
// if an empty string, return it
if (string0.length() == 0) {
return string0;
}
// if the first and last characters are quotes, just do 1 substring
if (string0.length() > 1 && string0.charAt(0) == '"' && string0.charA... | [
"static",
"public",
"String",
"stripQuotes",
"(",
"String",
"string0",
")",
"{",
"// if an empty string, return it",
"if",
"(",
"string0",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"string0",
";",
"}",
"// if the first and last characters are quotes, j... | If present, this method will strip off the leading and trailing "
character in the string parameter. For example, "10958" will
becomes just 10958. | [
"If",
"present",
"this",
"method",
"will",
"strip",
"off",
"the",
"leading",
"and",
"trailing",
"character",
"in",
"the",
"string",
"parameter",
".",
"For",
"example",
"10958",
"will",
"becomes",
"just",
"10958",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L305-L319 |
3,556 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.containsOnlyDigits | static public boolean containsOnlyDigits(String string0) {
// are they all digits?
for (int i = 0; i < string0.length(); i++) {
if (!Character.isDigit(string0.charAt(i))) {
return false;
}
}
return true;
} | java | static public boolean containsOnlyDigits(String string0) {
// are they all digits?
for (int i = 0; i < string0.length(); i++) {
if (!Character.isDigit(string0.charAt(i))) {
return false;
}
}
return true;
} | [
"static",
"public",
"boolean",
"containsOnlyDigits",
"(",
"String",
"string0",
")",
"{",
"// are they all digits?",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"string0",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"Characte... | Checks if a string contains only digits.
@return True if the string0 only contains digits, or false otherwise. | [
"Checks",
"if",
"a",
"string",
"contains",
"only",
"digits",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L326-L334 |
3,557 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.split | static public String[] split(String str, char delim) {
if (str == null) {
throw new NullPointerException("str can't be null");
}
// Note the javadoc on StringTokenizer:
// StringTokenizer is a legacy class that is retained for
// compatibility reasons althoug... | java | static public String[] split(String str, char delim) {
if (str == null) {
throw new NullPointerException("str can't be null");
}
// Note the javadoc on StringTokenizer:
// StringTokenizer is a legacy class that is retained for
// compatibility reasons althoug... | [
"static",
"public",
"String",
"[",
"]",
"split",
"(",
"String",
"str",
",",
"char",
"delim",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"str can't be null\"",
")",
";",
"}",
"// Note the javadoc on Stri... | Splits a string around matches of the given delimiter character.
Where applicable, this method can be used as a substitute for
<code>String.split(String regex)</code>, which is not available
on a JSR169/Java ME platform.
@param str the string to be split
@param delim the delimiter
@throws NullPointerException if str ... | [
"Splits",
"a",
"string",
"around",
"matches",
"of",
"the",
"given",
"delimiter",
"character",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L348-L367 |
3,558 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.formatForPrint | public final static String formatForPrint(String input) {
if (input.length() > 60) {
StringBuffer tmp = new StringBuffer(input.substring(0, 60));
tmp.append("&");
input = tmp.toString();
}
return input;
} | java | public final static String formatForPrint(String input) {
if (input.length() > 60) {
StringBuffer tmp = new StringBuffer(input.substring(0, 60));
tmp.append("&");
input = tmp.toString();
}
return input;
} | [
"public",
"final",
"static",
"String",
"formatForPrint",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
".",
"length",
"(",
")",
">",
"60",
")",
"{",
"StringBuffer",
"tmp",
"=",
"new",
"StringBuffer",
"(",
"input",
".",
"substring",
"(",
"0",
",... | Used to print out a string for error messages,
chops is off at 60 chars for historical reasons. | [
"Used",
"to",
"print",
"out",
"a",
"string",
"for",
"error",
"messages",
"chops",
"is",
"off",
"at",
"60",
"chars",
"for",
"historical",
"reasons",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L373-L380 |
3,559 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.toStringArray | public static String[] toStringArray(Object[] objArray) {
int idx;
int len = objArray.length;
String[] strArray = new String[len];
for (idx = 0; idx < len; idx++) {
strArray[idx] = objArray[idx].toString();
}
return strArray;
} | java | public static String[] toStringArray(Object[] objArray) {
int idx;
int len = objArray.length;
String[] strArray = new String[len];
for (idx = 0; idx < len; idx++) {
strArray[idx] = objArray[idx].toString();
}
return strArray;
} | [
"public",
"static",
"String",
"[",
"]",
"toStringArray",
"(",
"Object",
"[",
"]",
"objArray",
")",
"{",
"int",
"idx",
";",
"int",
"len",
"=",
"objArray",
".",
"length",
";",
"String",
"[",
"]",
"strArray",
"=",
"new",
"String",
"[",
"len",
"]",
";",
... | A method that receive an array of Objects and return a
String array representation of that array. | [
"A",
"method",
"that",
"receive",
"an",
"array",
"of",
"Objects",
"and",
"return",
"a",
"String",
"array",
"representation",
"of",
"that",
"array",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L386-L396 |
3,560 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.getAsciiBytes | public static byte[] getAsciiBytes(String input) {
char[] c = input.toCharArray();
byte[] b = new byte[c.length];
for (int i = 0; i < c.length; i++) {
b[i] = (byte) (c[i] & 0x007F);
}
return b;
} | java | public static byte[] getAsciiBytes(String input) {
char[] c = input.toCharArray();
byte[] b = new byte[c.length];
for (int i = 0; i < c.length; i++) {
b[i] = (byte) (c[i] & 0x007F);
}
return b;
} | [
"public",
"static",
"byte",
"[",
"]",
"getAsciiBytes",
"(",
"String",
"input",
")",
"{",
"char",
"[",
"]",
"c",
"=",
"input",
".",
"toCharArray",
"(",
")",
";",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"c",
".",
"length",
"]",
";",
"for",
... | Get 7-bit ASCII character array from input String.
The lower 7 bits of each character in the input string is assumed to be
the ASCII character value.
Hexadecimal - Character
| 00 NUL| 01 SOH| 02 STX| 03 ETX| 04 EOT| 05 ENQ| 06 ACK| 07 BEL|
| 08 BS | 09 HT | 0A NL | 0B VT | 0C NP | 0D CR | 0E SO | 0F SI |
| 10 DLE| 11... | [
"Get",
"7",
"-",
"bit",
"ASCII",
"character",
"array",
"from",
"input",
"String",
".",
"The",
"lower",
"7",
"bits",
"of",
"each",
"character",
"in",
"the",
"input",
"string",
"is",
"assumed",
"to",
"be",
"the",
"ASCII",
"character",
"value",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L423-L431 |
3,561 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.trimTrailing | public static String trimTrailing(String str) {
if (str == null) {
return null;
}
int len = str.length();
for (; len > 0; len--) {
if (!Character.isWhitespace(str.charAt(len - 1))) {
break;
}
}
return str.substring(0, le... | java | public static String trimTrailing(String str) {
if (str == null) {
return null;
}
int len = str.length();
for (; len > 0; len--) {
if (!Character.isWhitespace(str.charAt(len - 1))) {
break;
}
}
return str.substring(0, le... | [
"public",
"static",
"String",
"trimTrailing",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"for",
"(",
";",
"len",
">",
"0",
";",
"... | Trim off trailing blanks but not leading blanks
@param str
@return The input with trailing blanks stipped off | [
"Trim",
"off",
"trailing",
"blanks",
"but",
"not",
"leading",
"blanks"
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L446-L457 |
3,562 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.truncate | public static String truncate(String value, int length) {
if (value != null && value.length() > length) {
value = value.substring(0, length);
}
return value;
} | java | public static String truncate(String value, int length) {
if (value != null && value.length() > length) {
value = value.substring(0, length);
}
return value;
} | [
"public",
"static",
"String",
"truncate",
"(",
"String",
"value",
",",
"int",
"length",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"value",
".",
"length",
"(",
")",
">",
"length",
")",
"{",
"value",
"=",
"value",
".",
"substring",
"(",
"0",
... | Truncate a String to the given length with no warnings
or error raised if it is bigger.
@param value String to be truncated
@param length Maximum length of string
@return Returns value if value is null or value.length() is less or equal to than length, otherwise a String representing
value truncated to length. | [
"Truncate",
"a",
"String",
"to",
"the",
"given",
"length",
"with",
"no",
"warnings",
"or",
"error",
"raised",
"if",
"it",
"is",
"bigger",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L469-L474 |
3,563 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.hexDump | public static String hexDump(String prefix, byte[] data) {
byte byte_value;
StringBuffer str = new StringBuffer(data.length * 3);
str.append(prefix);
for (int i = 0; i < data.length; i += 16) {
// dump the header: 00000000:
String offset = Integer.toHexString(i... | java | public static String hexDump(String prefix, byte[] data) {
byte byte_value;
StringBuffer str = new StringBuffer(data.length * 3);
str.append(prefix);
for (int i = 0; i < data.length; i += 16) {
// dump the header: 00000000:
String offset = Integer.toHexString(i... | [
"public",
"static",
"String",
"hexDump",
"(",
"String",
"prefix",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"byte",
"byte_value",
";",
"StringBuffer",
"str",
"=",
"new",
"StringBuffer",
"(",
"data",
".",
"length",
"*",
"3",
")",
";",
"str",
".",
"append... | Convert a byte array to a human-readable String for debugging purposes. | [
"Convert",
"a",
"byte",
"array",
"to",
"a",
"human",
"-",
"readable",
"String",
"for",
"debugging",
"purposes",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L585-L657 |
3,564 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.quoteString | static String quoteString(String source, char quote) {
// Normally, the quoted string is two characters longer than the source
// string (because of start quote and end quote).
StringBuffer quoted = new StringBuffer(source.length() + 2);
quoted.append(quote);
for (int i = 0; i < ... | java | static String quoteString(String source, char quote) {
// Normally, the quoted string is two characters longer than the source
// string (because of start quote and end quote).
StringBuffer quoted = new StringBuffer(source.length() + 2);
quoted.append(quote);
for (int i = 0; i < ... | [
"static",
"String",
"quoteString",
"(",
"String",
"source",
",",
"char",
"quote",
")",
"{",
"// Normally, the quoted string is two characters longer than the source",
"// string (because of start quote and end quote).",
"StringBuffer",
"quoted",
"=",
"new",
"StringBuffer",
"(",
... | Quote a string so that it can be used as an identifier or a string
literal in SQL statements. Identifiers are surrounded by double quotes
and string literals are surrounded by single quotes. If the string
contains quote characters, they are escaped.
@param source the string to quote
@param quote the character to quote... | [
"Quote",
"a",
"string",
"so",
"that",
"it",
"can",
"be",
"used",
"as",
"an",
"identifier",
"or",
"a",
"string",
"literal",
"in",
"SQL",
"statements",
".",
"Identifiers",
"are",
"surrounded",
"by",
"double",
"quotes",
"and",
"string",
"literals",
"are",
"su... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L765-L778 |
3,565 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java | StringUtil.removeAllCharsExceptDigits | static public String removeAllCharsExceptDigits(String str0) {
if (str0 == null) {
return null;
}
if (str0.length() == 0) {
return str0;
}
StringBuilder buf = new StringBuilder(str0.length());
int length = str0.length();
for (int i = 0; i <... | java | static public String removeAllCharsExceptDigits(String str0) {
if (str0 == null) {
return null;
}
if (str0.length() == 0) {
return str0;
}
StringBuilder buf = new StringBuilder(str0.length());
int length = str0.length();
for (int i = 0; i <... | [
"static",
"public",
"String",
"removeAllCharsExceptDigits",
"(",
"String",
"str0",
")",
"{",
"if",
"(",
"str0",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"str0",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"str0",
";"... | Removes all other characters from a string except digits. A good way
of cleaing up something like a phone number.
@param str0 The string to clean up
@return A new String that has all characters except digits removed | [
"Removes",
"all",
"other",
"characters",
"from",
"a",
"string",
"except",
"digits",
".",
"A",
"good",
"way",
"of",
"cleaing",
"up",
"something",
"like",
"a",
"phone",
"number",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L967-L984 |
3,566 | twitter/cloudhopper-commons | ch-commons-locale/src/main/java/com/cloudhopper/commons/locale/Country.java | Country.parse | protected static Country parse(String line) throws IOException {
try {
int pos = line.indexOf(' ');
if (pos < 0) throw new IOException("Invalid format, could not parse 2 char code");
String code2 = line.substring(0, pos);
int pos2 = line.indexOf(' ', pos+1);
... | java | protected static Country parse(String line) throws IOException {
try {
int pos = line.indexOf(' ');
if (pos < 0) throw new IOException("Invalid format, could not parse 2 char code");
String code2 = line.substring(0, pos);
int pos2 = line.indexOf(' ', pos+1);
... | [
"protected",
"static",
"Country",
"parse",
"(",
"String",
"line",
")",
"throws",
"IOException",
"{",
"try",
"{",
"int",
"pos",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"throw",
"new",
"IOException",
"(",
... | AF AFG 004 Afghanistan | [
"AF",
"AFG",
"004",
"Afghanistan"
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-locale/src/main/java/com/cloudhopper/commons/locale/Country.java#L139-L170 |
3,567 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteUtil.java | ByteUtil.encodeBcd | public static byte[] encodeBcd(String data, int num_bytes) {
// allocate buffer
byte buf[] = new byte[num_bytes];
// if length of addr is odd, then add an F onto the end of it
if ((data.length() % 2) != 0) {
data += "F";
}
int index = 0;
for (int i =... | java | public static byte[] encodeBcd(String data, int num_bytes) {
// allocate buffer
byte buf[] = new byte[num_bytes];
// if length of addr is odd, then add an F onto the end of it
if ((data.length() % 2) != 0) {
data += "F";
}
int index = 0;
for (int i =... | [
"public",
"static",
"byte",
"[",
"]",
"encodeBcd",
"(",
"String",
"data",
",",
"int",
"num_bytes",
")",
"{",
"// allocate buffer",
"byte",
"buf",
"[",
"]",
"=",
"new",
"byte",
"[",
"num_bytes",
"]",
";",
"// if length of addr is odd, then add an F onto the end of ... | BCD encodes a String into a byte array. | [
"BCD",
"encodes",
"a",
"String",
"into",
"a",
"byte",
"array",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteUtil.java#L33-L51 |
3,568 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/TimedStateBoolean.java | TimedStateBoolean.getAndSet | public boolean getAndSet(boolean newValue) {
boolean oldValue = value.getAndSet(newValue);
// did the state change?
if (oldValue != newValue)
valueTime = System.currentTimeMillis();
return oldValue;
} | java | public boolean getAndSet(boolean newValue) {
boolean oldValue = value.getAndSet(newValue);
// did the state change?
if (oldValue != newValue)
valueTime = System.currentTimeMillis();
return oldValue;
} | [
"public",
"boolean",
"getAndSet",
"(",
"boolean",
"newValue",
")",
"{",
"boolean",
"oldValue",
"=",
"value",
".",
"getAndSet",
"(",
"newValue",
")",
";",
"// did the state change?",
"if",
"(",
"oldValue",
"!=",
"newValue",
")",
"valueTime",
"=",
"System",
".",... | Sets to the given value and returns the previous value. If the previous
value is different than the new value, the internal "valueTime" will
be updated.
@param newValue The new boolean value
@return | [
"Sets",
"to",
"the",
"given",
"value",
"and",
"returns",
"the",
"previous",
"value",
".",
"If",
"the",
"previous",
"value",
"is",
"different",
"than",
"the",
"new",
"value",
"the",
"internal",
"valueTime",
"will",
"be",
"updated",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/TimedStateBoolean.java#L100-L106 |
3,569 | twitter/cloudhopper-commons | ch-commons-sql/src/main/java/com/cloudhopper/commons/sql/DataSourceManager.java | DataSourceManager.create | public static DataSource create(DataSourceConfiguration configuration) throws SQLMissingDependencyException, SQLConfigurationException {
// verify all required properties are configured and set
configuration.validate();
// clone the configuration so we can save the properties used to create the... | java | public static DataSource create(DataSourceConfiguration configuration) throws SQLMissingDependencyException, SQLConfigurationException {
// verify all required properties are configured and set
configuration.validate();
// clone the configuration so we can save the properties used to create the... | [
"public",
"static",
"DataSource",
"create",
"(",
"DataSourceConfiguration",
"configuration",
")",
"throws",
"SQLMissingDependencyException",
",",
"SQLConfigurationException",
"{",
"// verify all required properties are configured and set",
"configuration",
".",
"validate",
"(",
"... | Creates a new DataSource from the DataSourceConfiguration.
@param configuration The configuration of the DataSource
@return A new DataSource tied to the configuration
@throws SQLMissingDependencyException Thrown if a dependency (external jar)
is missing from the configuration.
@throws SQLConfigurationException Thrown i... | [
"Creates",
"a",
"new",
"DataSource",
"from",
"the",
"DataSourceConfiguration",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-sql/src/main/java/com/cloudhopper/commons/sql/DataSourceManager.java#L73-L119 |
3,570 | twitter/cloudhopper-commons | ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/TypeConverterUtil.java | TypeConverterUtil.convert | static public <E> E convert(String s, Class<E> type) throws ConversionException {
// if enum, handle differently
if (type.isEnum()) {
Object obj = ClassUtil.findEnumConstant(type, s);
if (obj == null) {
throw new ConversionException("Invalid constant [" + s + "] u... | java | static public <E> E convert(String s, Class<E> type) throws ConversionException {
// if enum, handle differently
if (type.isEnum()) {
Object obj = ClassUtil.findEnumConstant(type, s);
if (obj == null) {
throw new ConversionException("Invalid constant [" + s + "] u... | [
"static",
"public",
"<",
"E",
">",
"E",
"convert",
"(",
"String",
"s",
",",
"Class",
"<",
"E",
">",
"type",
")",
"throws",
"ConversionException",
"{",
"// if enum, handle differently",
"if",
"(",
"type",
".",
"isEnum",
"(",
")",
")",
"{",
"Object",
"obj"... | Converts the string value into an Object of the Class type. Will either
delegate conversion to a PropertyConverter or will handle creating enums
directly.
@param string0 The string value to convert
@param type The Class type to convert it into
@return A new Object converted from the String value | [
"Converts",
"the",
"string",
"value",
"into",
"an",
"Object",
"of",
"the",
"Class",
"type",
".",
"Will",
"either",
"delegate",
"conversion",
"to",
"a",
"PropertyConverter",
"or",
"will",
"handle",
"creating",
"enums",
"directly",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-xbean/src/main/java/com/cloudhopper/commons/xbean/TypeConverterUtil.java#L95-L113 |
3,571 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java | FileUtil.isValidFileExtension | public static boolean isValidFileExtension(String extension) {
for (int i = 0; i < extension.length(); i++) {
char c = extension.charAt(i);
if (!(Character.isDigit(c) || Character.isLetter(c) || c == '_')) {
return false;
}
}
return true;
} | java | public static boolean isValidFileExtension(String extension) {
for (int i = 0; i < extension.length(); i++) {
char c = extension.charAt(i);
if (!(Character.isDigit(c) || Character.isLetter(c) || c == '_')) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isValidFileExtension",
"(",
"String",
"extension",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"extension",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"extension",
".",
"charAt"... | Checks if the extension is valid. This method only permits letters, digits,
and an underscore character.
@param extension The file extension to validate
@return True if its valid, otherwise false | [
"Checks",
"if",
"the",
"extension",
"is",
"valid",
".",
"This",
"method",
"only",
"permits",
"letters",
"digits",
"and",
"an",
"underscore",
"character",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java#L140-L148 |
3,572 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java | FileUtil.parseFileExtension | public static String parseFileExtension(String filename) {
// if null, return null
if (filename == null) {
return null;
}
// find position of last period
int pos = filename.lastIndexOf('.');
// did one exist or have any length?
if (pos < 0 || (pos+1) >... | java | public static String parseFileExtension(String filename) {
// if null, return null
if (filename == null) {
return null;
}
// find position of last period
int pos = filename.lastIndexOf('.');
// did one exist or have any length?
if (pos < 0 || (pos+1) >... | [
"public",
"static",
"String",
"parseFileExtension",
"(",
"String",
"filename",
")",
"{",
"// if null, return null",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// find position of last period",
"int",
"pos",
"=",
"filename",
".",
... | Parse the filename and return the file extension. For example, if the
file is "app.2006-10-10.log", then this method will return "log". Will
only return the last file extension. For example, if the filename ends
with ".log.gz", then this method will return "gz"
@param String to process containing the filename
@retur... | [
"Parse",
"the",
"filename",
"and",
"return",
"the",
"file",
"extension",
".",
"For",
"example",
"if",
"the",
"file",
"is",
"app",
".",
"2006",
"-",
"10",
"-",
"10",
".",
"log",
"then",
"this",
"method",
"will",
"return",
"log",
".",
"Will",
"only",
"... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java#L159-L172 |
3,573 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java | FileUtil.copy | public static void copy(File sourceFile, File targetFile) throws FileAlreadyExistsException, IOException {
copy(sourceFile, targetFile, false);
} | java | public static void copy(File sourceFile, File targetFile) throws FileAlreadyExistsException, IOException {
copy(sourceFile, targetFile, false);
} | [
"public",
"static",
"void",
"copy",
"(",
"File",
"sourceFile",
",",
"File",
"targetFile",
")",
"throws",
"FileAlreadyExistsException",
",",
"IOException",
"{",
"copy",
"(",
"sourceFile",
",",
"targetFile",
",",
"false",
")",
";",
"}"
] | Copy the source file to the target file.
@param sourceFile The source file to copy from
@param targetFile The target file to copy to
@throws FileAlreadyExistsException Thrown if the target file already
exists. This exception is a subclass of IOException, so catching
an IOException is enough if you don't care about thi... | [
"Copy",
"the",
"source",
"file",
"to",
"the",
"target",
"file",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java#L335-L337 |
3,574 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java | FileUtil.copy | public static boolean copy(File sourceFile, File targetFile, boolean overwrite) throws FileAlreadyExistsException, IOException {
boolean overwriteOccurred = false;
// check if the targetFile already exists
if (targetFile.exists()) {
// if overwrite is not allowed, throw an exception... | java | public static boolean copy(File sourceFile, File targetFile, boolean overwrite) throws FileAlreadyExistsException, IOException {
boolean overwriteOccurred = false;
// check if the targetFile already exists
if (targetFile.exists()) {
// if overwrite is not allowed, throw an exception... | [
"public",
"static",
"boolean",
"copy",
"(",
"File",
"sourceFile",
",",
"File",
"targetFile",
",",
"boolean",
"overwrite",
")",
"throws",
"FileAlreadyExistsException",
",",
"IOException",
"{",
"boolean",
"overwriteOccurred",
"=",
"false",
";",
"// check if the targetFi... | Copy the source file to the target file while optionally permitting an
overwrite to occur in case the target file already exists.
@param sourceFile The source file to copy from
@param targetFile The target file to copy to
@return True if an overwrite occurred, otherwise false.
@throws FileAlreadyExistsException Thrown ... | [
"Copy",
"the",
"source",
"file",
"to",
"the",
"target",
"file",
"while",
"optionally",
"permitting",
"an",
"overwrite",
"to",
"occur",
"in",
"case",
"the",
"target",
"file",
"already",
"exists",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FileUtil.java#L351-L374 |
3,575 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/filefilter/FileExtensionFilter.java | FileExtensionFilter.accept | public boolean accept(File file) {
// extract this file's extension
String fileExt = FileUtil.parseFileExtension(file.getName());
// a file extension might not have existed
if (fileExt == null) {
// if no file extension extracted, this definitely is not a match
r... | java | public boolean accept(File file) {
// extract this file's extension
String fileExt = FileUtil.parseFileExtension(file.getName());
// a file extension might not have existed
if (fileExt == null) {
// if no file extension extracted, this definitely is not a match
r... | [
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"// extract this file's extension",
"String",
"fileExt",
"=",
"FileUtil",
".",
"parseFileExtension",
"(",
"file",
".",
"getName",
"(",
")",
")",
";",
"// a file extension might not have existed",
"if",
"(... | Accepts a File by its file extension.
@param file The file to match
@return True if the File matches this the array of acceptable file
extensions. | [
"Accepts",
"a",
"File",
"by",
"its",
"file",
"extension",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/filefilter/FileExtensionFilter.java#L102-L127 |
3,576 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java | MetaFieldUtil.toMetaFieldInfoString | public static String toMetaFieldInfoString(Object obj) {
StringBuffer buf = new StringBuffer(100);
MetaFieldInfo[] fields = toMetaFieldInfoArray(obj, null, true);
for (int i = 0; i < fields.length; i++) {
MetaFieldInfo field = fields[i];
buf.append(field.name);
... | java | public static String toMetaFieldInfoString(Object obj) {
StringBuffer buf = new StringBuffer(100);
MetaFieldInfo[] fields = toMetaFieldInfoArray(obj, null, true);
for (int i = 0; i < fields.length; i++) {
MetaFieldInfo field = fields[i];
buf.append(field.name);
... | [
"public",
"static",
"String",
"toMetaFieldInfoString",
"(",
"Object",
"obj",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"100",
")",
";",
"MetaFieldInfo",
"[",
"]",
"fields",
"=",
"toMetaFieldInfoArray",
"(",
"obj",
",",
"null",
",",
"t... | Creates a string for an object based on the MetaField annotations.
@param obj The object to search
@return A string representing the current values of any MetaFields | [
"Creates",
"a",
"string",
"for",
"an",
"object",
"based",
"on",
"the",
"MetaField",
"annotations",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java#L47-L67 |
3,577 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java | MetaFieldUtil.toMetaFieldInfoArray | public static MetaFieldInfo[] toMetaFieldInfoArray(Class type, Object obj, String stringForNullValues, boolean ignoreAnnotatedName, boolean recursive) {
return internalToMetaFieldInfoArray(type, obj, null, null, stringForNullValues, ignoreAnnotatedName, recursive);
} | java | public static MetaFieldInfo[] toMetaFieldInfoArray(Class type, Object obj, String stringForNullValues, boolean ignoreAnnotatedName, boolean recursive) {
return internalToMetaFieldInfoArray(type, obj, null, null, stringForNullValues, ignoreAnnotatedName, recursive);
} | [
"public",
"static",
"MetaFieldInfo",
"[",
"]",
"toMetaFieldInfoArray",
"(",
"Class",
"type",
",",
"Object",
"obj",
",",
"String",
"stringForNullValues",
",",
"boolean",
"ignoreAnnotatedName",
",",
"boolean",
"recursive",
")",
"{",
"return",
"internalToMetaFieldInfoArr... | Returns a new MetaFieldInfo array of all Fields annotated with MetaField
in the object type. The object must be an instance of the type, otherwise
this method may throw a runtime exception. Optionally, this method can
recursively search the object to provide a deep view of the entire class.
@param type The class type o... | [
"Returns",
"a",
"new",
"MetaFieldInfo",
"array",
"of",
"all",
"Fields",
"annotated",
"with",
"MetaField",
"in",
"the",
"object",
"type",
".",
"The",
"object",
"must",
"be",
"an",
"instance",
"of",
"the",
"type",
"otherwise",
"this",
"method",
"may",
"throw",... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java#L138-L140 |
3,578 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java | DateTimePeriod.toMonths | public List<DateTimePeriod> toMonths() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" month to start datetime
DateTime currentStart = getStart();
// calculate "next" month
DateTime nextStart = currentStart.plusMonths(1);
// conti... | java | public List<DateTimePeriod> toMonths() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" month to start datetime
DateTime currentStart = getStart();
// calculate "next" month
DateTime nextStart = currentStart.plusMonths(1);
// conti... | [
"public",
"List",
"<",
"DateTimePeriod",
">",
"toMonths",
"(",
")",
"{",
"ArrayList",
"<",
"DateTimePeriod",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"DateTimePeriod",
">",
"(",
")",
";",
"// default \"current\" month to start datetime",
"DateTime",
"currentStart"... | Converts this period to a list of month periods. Partial months will not be
included. For example, a period of "2009" will return a list
of 12 months - one for each month in 2009. On the other hand, a period
of "January 20, 2009" would return an empty list since partial
months are not included.
@return A list of mon... | [
"Converts",
"this",
"period",
"to",
"a",
"list",
"of",
"month",
"periods",
".",
"Partial",
"months",
"will",
"not",
"be",
"included",
".",
"For",
"example",
"a",
"period",
"of",
"2009",
"will",
"return",
"a",
"list",
"of",
"12",
"months",
"-",
"one",
"... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L327-L344 |
3,579 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java | DateTimePeriod.toYears | public List<DateTimePeriod> toYears() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" year to start datetime
DateTime currentStart = getStart();
// calculate "next" year
DateTime nextStart = currentStart.plusYears(1);
// continue ... | java | public List<DateTimePeriod> toYears() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" year to start datetime
DateTime currentStart = getStart();
// calculate "next" year
DateTime nextStart = currentStart.plusYears(1);
// continue ... | [
"public",
"List",
"<",
"DateTimePeriod",
">",
"toYears",
"(",
")",
"{",
"ArrayList",
"<",
"DateTimePeriod",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"DateTimePeriod",
">",
"(",
")",
";",
"// default \"current\" year to start datetime",
"DateTime",
"currentStart",
... | Converts this period to a list of year periods. Partial years will not be
included. For example, a period of "2009-2010" will return a list
of 2 years - one for 2009 and one for 2010. On the other hand, a period
of "January 2009" would return an empty list since partial
years are not included.
@return A list of year... | [
"Converts",
"this",
"period",
"to",
"a",
"list",
"of",
"year",
"periods",
".",
"Partial",
"years",
"will",
"not",
"be",
"included",
".",
"For",
"example",
"a",
"period",
"of",
"2009",
"-",
"2010",
"will",
"return",
"a",
"list",
"of",
"2",
"years",
"-",... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L354-L371 |
3,580 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java | DateTimePeriod.create | static public DateTimePeriod create(DateTimeDuration duration, DateTime start) {
if (duration == DateTimeDuration.YEAR) {
return createYear(start);
} else if (duration == DateTimeDuration.MONTH) {
return createMonth(start);
} else if (duration == DateTimeDuration.DAY) {
... | java | static public DateTimePeriod create(DateTimeDuration duration, DateTime start) {
if (duration == DateTimeDuration.YEAR) {
return createYear(start);
} else if (duration == DateTimeDuration.MONTH) {
return createMonth(start);
} else if (duration == DateTimeDuration.DAY) {
... | [
"static",
"public",
"DateTimePeriod",
"create",
"(",
"DateTimeDuration",
"duration",
",",
"DateTime",
"start",
")",
"{",
"if",
"(",
"duration",
"==",
"DateTimeDuration",
".",
"YEAR",
")",
"{",
"return",
"createYear",
"(",
"start",
")",
";",
"}",
"else",
"if"... | Creates a new period for the specified duration starting from the
provided DateTime.
@param duration The duration for this period such as Month, Hour, etc.
@param start The DateTime to start this period from
@return A new period | [
"Creates",
"a",
"new",
"period",
"for",
"the",
"specified",
"duration",
"starting",
"from",
"the",
"provided",
"DateTime",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L423-L437 |
3,581 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java | DateTimePeriod.createLastYearMonths | static public List<DateTimePeriod> createLastYearMonths(DateTimeZone zone) {
ArrayList<DateTimePeriod> periods = new ArrayList<DateTimePeriod>();
// get today's date
DateTime now = new DateTime(zone);
// start with today's current month and 11 others (last 12 months)
for (int i... | java | static public List<DateTimePeriod> createLastYearMonths(DateTimeZone zone) {
ArrayList<DateTimePeriod> periods = new ArrayList<DateTimePeriod>();
// get today's date
DateTime now = new DateTime(zone);
// start with today's current month and 11 others (last 12 months)
for (int i... | [
"static",
"public",
"List",
"<",
"DateTimePeriod",
">",
"createLastYearMonths",
"(",
"DateTimeZone",
"zone",
")",
"{",
"ArrayList",
"<",
"DateTimePeriod",
">",
"periods",
"=",
"new",
"ArrayList",
"<",
"DateTimePeriod",
">",
"(",
")",
";",
"// get today's date",
... | Create a list of DateTimePeriods that represent the last year of
YearMonth periods. For example, if its currently January 2009, this
would return periods representing "January 2009, December 2008, ... February 2008"
@param zone
@return | [
"Create",
"a",
"list",
"of",
"DateTimePeriods",
"that",
"represent",
"the",
"last",
"year",
"of",
"YearMonth",
"periods",
".",
"For",
"example",
"if",
"its",
"currently",
"January",
"2009",
"this",
"would",
"return",
"periods",
"representing",
"January",
"2009",... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/time/DateTimePeriod.java#L503-L519 |
3,582 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/EnvironmentUtil.java | EnvironmentUtil.createCommonSystemProperties | public static Properties createCommonSystemProperties() throws EnvironmentException {
// create a new system properties object
Properties systemProperties = new Properties();
// host name, domain, fqdn
String hostFQDN = getHostFQDN();
if (!StringUtil.isEmpty(hostFQDN)) {
... | java | public static Properties createCommonSystemProperties() throws EnvironmentException {
// create a new system properties object
Properties systemProperties = new Properties();
// host name, domain, fqdn
String hostFQDN = getHostFQDN();
if (!StringUtil.isEmpty(hostFQDN)) {
... | [
"public",
"static",
"Properties",
"createCommonSystemProperties",
"(",
")",
"throws",
"EnvironmentException",
"{",
"// create a new system properties object",
"Properties",
"systemProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"// host name, domain, fqdn",
"String",
"h... | Creates a Properties object containing common system properties that are
determined using various Java routines. For example, determining the
hostname that the application is running on.
HOST_NAME
HOST_DOMAIN
@return | [
"Creates",
"a",
"Properties",
"object",
"containing",
"common",
"system",
"properties",
"that",
"are",
"determined",
"using",
"various",
"Java",
"routines",
".",
"For",
"example",
"determining",
"the",
"hostname",
"that",
"the",
"application",
"is",
"running",
"on... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/EnvironmentUtil.java#L48-L75 |
3,583 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/ThreadUtil.java | ThreadUtil.getAllThreads | static public Thread[] getAllThreads() {
final ThreadGroup root = getRootThreadGroup();
final ThreadMXBean thbean = ManagementFactory.getThreadMXBean();
int nAlloc = thbean.getThreadCount();
int n = 0;
Thread[] threads;
do {
nAlloc *= 2;
threads = ... | java | static public Thread[] getAllThreads() {
final ThreadGroup root = getRootThreadGroup();
final ThreadMXBean thbean = ManagementFactory.getThreadMXBean();
int nAlloc = thbean.getThreadCount();
int n = 0;
Thread[] threads;
do {
nAlloc *= 2;
threads = ... | [
"static",
"public",
"Thread",
"[",
"]",
"getAllThreads",
"(",
")",
"{",
"final",
"ThreadGroup",
"root",
"=",
"getRootThreadGroup",
"(",
")",
";",
"final",
"ThreadMXBean",
"thbean",
"=",
"ManagementFactory",
".",
"getThreadMXBean",
"(",
")",
";",
"int",
"nAlloc... | Gets all threads in the JVM. This is really a snapshot of all threads
at the time this method is called.
@return An array of all threads currently running in the JVM. | [
"Gets",
"all",
"threads",
"in",
"the",
"JVM",
".",
"This",
"is",
"really",
"a",
"snapshot",
"of",
"all",
"threads",
"at",
"the",
"time",
"this",
"method",
"is",
"called",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ThreadUtil.java#L58-L70 |
3,584 | twitter/cloudhopper-commons | ch-commons-sql/src/main/java/com/cloudhopper/commons/sql/DataSourceConfiguration.java | DataSourceConfiguration.validate | public void validate() throws SQLConfigurationException {
if (this.url == null) {
throw new SQLConfigurationException("url is a required property");
}
if (this.username == null) {
throw new SQLConfigurationException("username is a required property");
}
/* passwo... | java | public void validate() throws SQLConfigurationException {
if (this.url == null) {
throw new SQLConfigurationException("url is a required property");
}
if (this.username == null) {
throw new SQLConfigurationException("username is a required property");
}
/* passwo... | [
"public",
"void",
"validate",
"(",
")",
"throws",
"SQLConfigurationException",
"{",
"if",
"(",
"this",
".",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"SQLConfigurationException",
"(",
"\"url is a required property\"",
")",
";",
"}",
"if",
"(",
"this",
"."... | Validates this configuration and checks that all required parameters are
set. Throws an exception if a property is missing.
@throws SQLConfigurationException Thrown if a required property is
missing. | [
"Validates",
"this",
"configuration",
"and",
"checks",
"that",
"all",
"required",
"parameters",
"are",
"set",
".",
"Throws",
"an",
"exception",
"if",
"a",
"property",
"is",
"missing",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-sql/src/main/java/com/cloudhopper/commons/sql/DataSourceConfiguration.java#L97-L115 |
3,585 | twitter/cloudhopper-commons | ch-commons-locale/src/main/java/com/cloudhopper/commons/locale/E164CountryCodeUtil.java | E164CountryCodeUtil.lookup | public static E164CountryCode lookup(String address) {
// analyze just the first few chars -- max of 4 or length of address
int len = (address.length() > maxPrefixLength ? maxPrefixLength : address.length());
// search backwards first, return the first result
for (int i = len; i > 0; i--... | java | public static E164CountryCode lookup(String address) {
// analyze just the first few chars -- max of 4 or length of address
int len = (address.length() > maxPrefixLength ? maxPrefixLength : address.length());
// search backwards first, return the first result
for (int i = len; i > 0; i--... | [
"public",
"static",
"E164CountryCode",
"lookup",
"(",
"String",
"address",
")",
"{",
"// analyze just the first few chars -- max of 4 or length of address",
"int",
"len",
"=",
"(",
"address",
".",
"length",
"(",
")",
">",
"maxPrefixLength",
"?",
"maxPrefixLength",
":",
... | Looks up an E164CountryCode object by analyzing the address and returning
the best match. For example, 12125551212 will return an entry for the US.
@param address The address to lookup.
@return | [
"Looks",
"up",
"an",
"E164CountryCode",
"object",
"by",
"analyzing",
"the",
"address",
"and",
"returning",
"the",
"best",
"match",
".",
"For",
"example",
"12125551212",
"will",
"return",
"an",
"entry",
"for",
"the",
"US",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-locale/src/main/java/com/cloudhopper/commons/locale/E164CountryCodeUtil.java#L79-L92 |
3,586 | twitter/cloudhopper-commons | ch-commons-io/src/main/java/com/cloudhopper/commons/io/FileMonitor.java | FileMonitor.addListener | public void addListener (FileChangedListener fileListener)
{
// Don't add if its already there
for (Iterator<WeakReference<FileChangedListener>> i = listeners_.iterator(); i.hasNext(); ) {
WeakReference<FileChangedListener> reference = i.next();
FileChangedListener listener = reference.get();
... | java | public void addListener (FileChangedListener fileListener)
{
// Don't add if its already there
for (Iterator<WeakReference<FileChangedListener>> i = listeners_.iterator(); i.hasNext(); ) {
WeakReference<FileChangedListener> reference = i.next();
FileChangedListener listener = reference.get();
... | [
"public",
"void",
"addListener",
"(",
"FileChangedListener",
"fileListener",
")",
"{",
"// Don't add if its already there",
"for",
"(",
"Iterator",
"<",
"WeakReference",
"<",
"FileChangedListener",
">",
">",
"i",
"=",
"listeners_",
".",
"iterator",
"(",
")",
";",
... | Add listener to this file monitor.
@param fileListener Listener to add. | [
"Add",
"listener",
"to",
"this",
"file",
"monitor",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-io/src/main/java/com/cloudhopper/commons/io/FileMonitor.java#L127-L140 |
3,587 | twitter/cloudhopper-commons | ch-commons-io/src/main/java/com/cloudhopper/commons/io/FileMonitor.java | FileMonitor.removeListener | public void removeListener (FileChangedListener fileListener)
{
for (Iterator<WeakReference<FileChangedListener>> i = listeners_.iterator(); i.hasNext(); ) {
WeakReference<FileChangedListener> reference = i.next();
FileChangedListener listener = reference.get();
if (listener == fileListener) {
... | java | public void removeListener (FileChangedListener fileListener)
{
for (Iterator<WeakReference<FileChangedListener>> i = listeners_.iterator(); i.hasNext(); ) {
WeakReference<FileChangedListener> reference = i.next();
FileChangedListener listener = reference.get();
if (listener == fileListener) {
... | [
"public",
"void",
"removeListener",
"(",
"FileChangedListener",
"fileListener",
")",
"{",
"for",
"(",
"Iterator",
"<",
"WeakReference",
"<",
"FileChangedListener",
">",
">",
"i",
"=",
"listeners_",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")... | Remove listener from this file monitor.
@param fileListener Listener to remove. | [
"Remove",
"listener",
"from",
"this",
"file",
"monitor",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-io/src/main/java/com/cloudhopper/commons/io/FileMonitor.java#L149-L159 |
3,588 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/DigitLookupMap.java | DigitLookupMap.dumpNode | private void dumpNode(Node node, int level, int idx, java.io.PrintStream out) {
// if node null, then return
if (node == null) {
return;
}
// print out required spaces
printSpaces(level, out);
if (idx == -2) {
out.print("ROOT -> ");
} el... | java | private void dumpNode(Node node, int level, int idx, java.io.PrintStream out) {
// if node null, then return
if (node == null) {
return;
}
// print out required spaces
printSpaces(level, out);
if (idx == -2) {
out.print("ROOT -> ");
} el... | [
"private",
"void",
"dumpNode",
"(",
"Node",
"node",
",",
"int",
"level",
",",
"int",
"idx",
",",
"java",
".",
"io",
".",
"PrintStream",
"out",
")",
"{",
"// if node null, then return",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// ... | Recursively dumps a node at a certain index. | [
"Recursively",
"dumps",
"a",
"node",
"at",
"a",
"certain",
"index",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/DigitLookupMap.java#L299-L334 |
3,589 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/DigitLookupMap.java | DigitLookupMap.printSpaces | private void printSpaces(int count, java.io.PrintStream out) {
for (int i = 0; i < count; i++) {
out.print(" ");
}
} | java | private void printSpaces(int count, java.io.PrintStream out) {
for (int i = 0; i < count; i++) {
out.print(" ");
}
} | [
"private",
"void",
"printSpaces",
"(",
"int",
"count",
",",
"java",
".",
"io",
".",
"PrintStream",
"out",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"out",
".",
"print",
"(",
"\" \"",
")",
";",... | Prints out certain number of spaces. | [
"Prints",
"out",
"certain",
"number",
"of",
"spaces",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/DigitLookupMap.java#L339-L343 |
3,590 | twitter/cloudhopper-commons | ch-commons-rfs/src/main/java/com/cloudhopper/commons/rfs/provider/SftpRemoteFileSystem.java | SftpRemoteFileSystem.findSshDirs | protected File[] findSshDirs() {
ArrayList<File> dirs = new ArrayList<File>();
// user's home directory and .ssh subdir
File sshHomeDir = new File(System.getProperty("user.home"), ".ssh");
if (sshHomeDir.exists() && sshHomeDir.isDirectory()) {
dirs.add(sshHomeDir);
}... | java | protected File[] findSshDirs() {
ArrayList<File> dirs = new ArrayList<File>();
// user's home directory and .ssh subdir
File sshHomeDir = new File(System.getProperty("user.home"), ".ssh");
if (sshHomeDir.exists() && sshHomeDir.isDirectory()) {
dirs.add(sshHomeDir);
}... | [
"protected",
"File",
"[",
"]",
"findSshDirs",
"(",
")",
"{",
"ArrayList",
"<",
"File",
">",
"dirs",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"// user's home directory and .ssh subdir",
"File",
"sshHomeDir",
"=",
"new",
"File",
"(",
"System",... | Best attempt to find a default .ssh directory on this particular server.
While more directories may be attempted, for now the user's home directory
will be scanned for a .ssh directory.
@return An array of .ssh directories to search or null if none were
found. | [
"Best",
"attempt",
"to",
"find",
"a",
"default",
".",
"ssh",
"directory",
"on",
"this",
"particular",
"server",
".",
"While",
"more",
"directories",
"may",
"be",
"attempted",
"for",
"now",
"the",
"user",
"s",
"home",
"directory",
"will",
"be",
"scanned",
"... | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-rfs/src/main/java/com/cloudhopper/commons/rfs/provider/SftpRemoteFileSystem.java#L67-L79 |
3,591 | twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.loadKeyStore | protected KeyStore loadKeyStore() throws Exception {
return getKeyStore(keyStoreInputStream, sslConfig.getKeyStorePath(),
sslConfig.getKeyStoreType(), sslConfig.getKeyStoreProvider(),
sslConfig.getKeyStorePassword());
} | java | protected KeyStore loadKeyStore() throws Exception {
return getKeyStore(keyStoreInputStream, sslConfig.getKeyStorePath(),
sslConfig.getKeyStoreType(), sslConfig.getKeyStoreProvider(),
sslConfig.getKeyStorePassword());
} | [
"protected",
"KeyStore",
"loadKeyStore",
"(",
")",
"throws",
"Exception",
"{",
"return",
"getKeyStore",
"(",
"keyStoreInputStream",
",",
"sslConfig",
".",
"getKeyStorePath",
"(",
")",
",",
"sslConfig",
".",
"getKeyStoreType",
"(",
")",
",",
"sslConfig",
".",
"ge... | Override this method to provide alternate way to load a keystore.
@return the key store instance
@throws Exception | [
"Override",
"this",
"method",
"to",
"provide",
"alternate",
"way",
"to",
"load",
"a",
"keystore",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L183-L187 |
3,592 | twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.loadTrustStore | protected KeyStore loadTrustStore() throws Exception {
return getKeyStore(trustStoreInputStream, sslConfig.getTrustStorePath(),
sslConfig.getTrustStoreType(), sslConfig.getTrustStoreProvider(),
sslConfig.getTrustStorePassword());
} | java | protected KeyStore loadTrustStore() throws Exception {
return getKeyStore(trustStoreInputStream, sslConfig.getTrustStorePath(),
sslConfig.getTrustStoreType(), sslConfig.getTrustStoreProvider(),
sslConfig.getTrustStorePassword());
} | [
"protected",
"KeyStore",
"loadTrustStore",
"(",
")",
"throws",
"Exception",
"{",
"return",
"getKeyStore",
"(",
"trustStoreInputStream",
",",
"sslConfig",
".",
"getTrustStorePath",
"(",
")",
",",
"sslConfig",
".",
"getTrustStoreType",
"(",
")",
",",
"sslConfig",
".... | Override this method to provide alternate way to load a truststore.
@return the key store instance
@throws Exception | [
"Override",
"this",
"method",
"to",
"provide",
"alternate",
"way",
"to",
"load",
"a",
"truststore",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L195-L199 |
3,593 | twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.getKeyStore | protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
KeyStore keystore = null;
if (storeStream != null || storePath != null) {
InputStream inStream = storeStream;
try {
... | java | protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
KeyStore keystore = null;
if (storeStream != null || storePath != null) {
InputStream inStream = storeStream;
try {
... | [
"protected",
"KeyStore",
"getKeyStore",
"(",
"InputStream",
"storeStream",
",",
"String",
"storePath",
",",
"String",
"storeType",
",",
"String",
"storeProvider",
",",
"String",
"storePassword",
")",
"throws",
"Exception",
"{",
"KeyStore",
"keystore",
"=",
"null",
... | Loads keystore using an input stream or a file path in the same
order of precedence.
Required for integrations to be able to override the mechanism
used to load a keystore in order to provide their own implementation.
@param storeStream keystore input stream
@param storePath path of keystore file
@param storeType key... | [
"Loads",
"keystore",
"using",
"an",
"input",
"stream",
"or",
"a",
"file",
"path",
"in",
"the",
"same",
"order",
"of",
"precedence",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L243-L264 |
3,594 | twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.checkKeyStore | public void checkKeyStore() {
if (sslContext != null)
return; //nothing to check if using preconfigured context
if (keyStoreInputStream == null &&
sslConfig.getKeyStorePath() == null) {
throw new IllegalStateException("SSL doesn't have a valid keystore");
}
... | java | public void checkKeyStore() {
if (sslContext != null)
return; //nothing to check if using preconfigured context
if (keyStoreInputStream == null &&
sslConfig.getKeyStorePath() == null) {
throw new IllegalStateException("SSL doesn't have a valid keystore");
}
... | [
"public",
"void",
"checkKeyStore",
"(",
")",
"{",
"if",
"(",
"sslContext",
"!=",
"null",
")",
"return",
";",
"//nothing to check if using preconfigured context",
"if",
"(",
"keyStoreInputStream",
"==",
"null",
"&&",
"sslConfig",
".",
"getKeyStorePath",
"(",
")",
"... | Check KeyStore Configuration. Ensures that if keystore has been
configured but there's no truststore, that keystore is
used as truststore.
@throws IllegalStateException if SslContextFactory configuration can't be used. | [
"Check",
"KeyStore",
"Configuration",
".",
"Ensures",
"that",
"if",
"keystore",
"has",
"been",
"configured",
"but",
"there",
"s",
"no",
"truststore",
"that",
"keystore",
"is",
"used",
"as",
"truststore",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L341-L372 |
3,595 | twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.streamCopy | private static void streamCopy(InputStream is, OutputStream os, byte[] buf, boolean close) throws IOException {
int len;
if (buf == null) {
buf = new byte[4096];
}
while ((len = is.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.flush();
if (... | java | private static void streamCopy(InputStream is, OutputStream os, byte[] buf, boolean close) throws IOException {
int len;
if (buf == null) {
buf = new byte[4096];
}
while ((len = is.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.flush();
if (... | [
"private",
"static",
"void",
"streamCopy",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"byte",
"[",
"]",
"buf",
",",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"int",
"len",
";",
"if",
"(",
"buf",
"==",
"null",
")",
"{",
"buf"... | Copy the contents of is to os.
@param is
@param os
@param buf Can be null
@param close If true, is is closed after the copy.
@throws IOException | [
"Copy",
"the",
"contents",
"of",
"is",
"to",
"os",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L382-L394 |
3,596 | twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.contains | private static boolean contains(Object[] arr, Object obj) {
for (Object o : arr) {
if (o.equals(obj)) return true;
}
return false;
} | java | private static boolean contains(Object[] arr, Object obj) {
for (Object o : arr) {
if (o.equals(obj)) return true;
}
return false;
} | [
"private",
"static",
"boolean",
"contains",
"(",
"Object",
"[",
"]",
"arr",
",",
"Object",
"obj",
")",
"{",
"for",
"(",
"Object",
"o",
":",
"arr",
")",
"{",
"if",
"(",
"o",
".",
"equals",
"(",
"obj",
")",
")",
"return",
"true",
";",
"}",
"return"... | Does an object array include an object.
@param arr The array
@param obj The object | [
"Does",
"an",
"object",
"array",
"include",
"an",
"object",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L401-L406 |
3,597 | twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/StackTraceUtil.java | StackTraceUtil.toStackTraceString | public static String toStackTraceString(String firstLine, StackTraceElement[] stack)
{
//add the class name and any message passed to constructor
final StringBuilder result = new StringBuilder(firstLine);
//result.append(aThrowable.toString());
final String NEW_LINE = System.getProperty("line.separato... | java | public static String toStackTraceString(String firstLine, StackTraceElement[] stack)
{
//add the class name and any message passed to constructor
final StringBuilder result = new StringBuilder(firstLine);
//result.append(aThrowable.toString());
final String NEW_LINE = System.getProperty("line.separato... | [
"public",
"static",
"String",
"toStackTraceString",
"(",
"String",
"firstLine",
",",
"StackTraceElement",
"[",
"]",
"stack",
")",
"{",
"//add the class name and any message passed to constructor",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
"firs... | Defines a custom format for the stack trace as String. | [
"Defines",
"a",
"custom",
"format",
"for",
"the",
"stack",
"trace",
"as",
"String",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StackTraceUtil.java#L42-L57 |
3,598 | twitter/cloudhopper-commons | ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/ModifiedUTF8Charset.java | ModifiedUTF8Charset.encodeToByteArray | static public int encodeToByteArray(CharSequence charSeq, char[] charBuffer, int charOffset, int charLength, byte[] byteBuffer, int byteOffset) {
int c = 0;
int bytePos = byteOffset; // start at byte offset
int charPos = charOffset; // start at char offset
int charAbsLength =... | java | static public int encodeToByteArray(CharSequence charSeq, char[] charBuffer, int charOffset, int charLength, byte[] byteBuffer, int byteOffset) {
int c = 0;
int bytePos = byteOffset; // start at byte offset
int charPos = charOffset; // start at char offset
int charAbsLength =... | [
"static",
"public",
"int",
"encodeToByteArray",
"(",
"CharSequence",
"charSeq",
",",
"char",
"[",
"]",
"charBuffer",
",",
"int",
"charOffset",
",",
"int",
"charLength",
",",
"byte",
"[",
"]",
"byteBuffer",
",",
"int",
"byteOffset",
")",
"{",
"int",
"c",
"=... | Encode the string to an array of UTF-8 bytes. The buffer must be pre-allocated
and have enough space to hold the encoded string.
@param charSeq The optional character sequence to use for encoding rather
than the provided character buffer. It is always higher performance
to supply a char array vs. use a CharSequence. ... | [
"Encode",
"the",
"string",
"to",
"an",
"array",
"of",
"UTF",
"-",
"8",
"bytes",
".",
"The",
"buffer",
"must",
"be",
"pre",
"-",
"allocated",
"and",
"have",
"enough",
"space",
"to",
"hold",
"the",
"encoded",
"string",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/ModifiedUTF8Charset.java#L225-L273 |
3,599 | twitter/cloudhopper-commons | ch-commons-rfs/src/main/java/com/cloudhopper/commons/rfs/RemoteFileSystemFactory.java | RemoteFileSystemFactory.create | public static RemoteFileSystem create(String url) throws MalformedURLException, FileSystemException {
// parse url into a URL object
URL r = URLParser.parse(url);
// delegate responsibility to other method
return create(r);
} | java | public static RemoteFileSystem create(String url) throws MalformedURLException, FileSystemException {
// parse url into a URL object
URL r = URLParser.parse(url);
// delegate responsibility to other method
return create(r);
} | [
"public",
"static",
"RemoteFileSystem",
"create",
"(",
"String",
"url",
")",
"throws",
"MalformedURLException",
",",
"FileSystemException",
"{",
"// parse url into a URL object",
"URL",
"r",
"=",
"URLParser",
".",
"parse",
"(",
"url",
")",
";",
"// delegate responsibi... | Creates a new RemoteFileSystem by parsing the URL and creating the
correct underlying provider to support the protocol. | [
"Creates",
"a",
"new",
"RemoteFileSystem",
"by",
"parsing",
"the",
"URL",
"and",
"creating",
"the",
"correct",
"underlying",
"provider",
"to",
"support",
"the",
"protocol",
"."
] | b5bc397dbec4537e8149e7ec0733c1d7ed477499 | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-rfs/src/main/java/com/cloudhopper/commons/rfs/RemoteFileSystemFactory.java#L46-L51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.