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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,600 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.fireStartDoc | protected void fireStartDoc()
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTDOCUMENT);
}
} | java | protected void fireStartDoc()
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTDOCUMENT);
}
} | [
"protected",
"void",
"fireStartDoc",
"(",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"flushMyWriter",
"(",
")",
";",
"m_tracer",
".",
"fireGenerateEvent",
"(",
"SerializerTrace",
"... | To fire off start document trace event | [
"To",
"fire",
"off",
"start",
"document",
"trace",
"event"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1087-L1095 |
35,601 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.fireEndDoc | protected void fireEndDoc()
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDDOCUMENT);
}
} | java | protected void fireEndDoc()
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDDOCUMENT);
}
} | [
"protected",
"void",
"fireEndDoc",
"(",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"flushMyWriter",
"(",
")",
";",
"m_tracer",
".",
"fireGenerateEvent",
"(",
"SerializerTrace",
"."... | To fire off end document trace event | [
"To",
"fire",
"off",
"end",
"document",
"trace",
"event"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1101-L1109 |
35,602 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.fireStartElem | protected void fireStartElem(String elemName)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTELEMENT,
elemName, m_attributes);
}
} | java | protected void fireStartElem(String elemName)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_STARTELEMENT,
elemName, m_attributes);
}
} | [
"protected",
"void",
"fireStartElem",
"(",
"String",
"elemName",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"flushMyWriter",
"(",
")",
";",
"m_tracer",
".",
"fireGenerateEvent",
"(... | Report the start element trace event. This trace method needs to be
called just before the attributes are cleared.
@param elemName the qualified name of the element | [
"Report",
"the",
"start",
"element",
"trace",
"event",
".",
"This",
"trace",
"method",
"needs",
"to",
"be",
"called",
"just",
"before",
"the",
"attributes",
"are",
"cleared",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1118-L1127 |
35,603 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.fireEscapingEvent | protected void fireEscapingEvent(String name, String data)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_PI,name, data);
}
} | java | protected void fireEscapingEvent(String name, String data)
throws org.xml.sax.SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_PI,name, data);
}
} | [
"protected",
"void",
"fireEscapingEvent",
"(",
"String",
"name",
",",
"String",
"data",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"flushMyWriter",
"(",
")",
";",
"m_tracer",
"."... | To fire off the PI trace event
@param name Name of PI | [
"To",
"fire",
"off",
"the",
"PI",
"trace",
"event"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1146-L1155 |
35,604 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.resetSerializerBase | private void resetSerializerBase()
{
this.m_attributes.clear();
this.m_CdataElems = null;
this.m_cdataTagOpen = false;
this.m_docIsEmpty = true;
this.m_doctypePublic = null;
this.m_doctypeSystem = null;
this.m_doIndent = false;
this.m_elemContext = new ElemContext();
this.m_indentAmount = 0;
this.m_inEntityRef = false;
this.m_inExternalDTD = false;
this.m_mediatype = null;
this.m_needToCallStartDocument = true;
this.m_needToOutputDocTypeDecl = false;
if (m_OutputProps != null)
this.m_OutputProps.clear();
if (m_OutputPropsDefault != null)
this.m_OutputPropsDefault.clear();
if (this.m_prefixMap != null)
this.m_prefixMap.reset();
this.m_shouldNotWriteXMLHeader = false;
this.m_sourceLocator = null;
this.m_standalone = null;
this.m_standaloneWasSpecified = false;
this.m_StringOfCDATASections = null;
this.m_tracer = null;
this.m_transformer = null;
this.m_version = null;
// don't set writer to null, so that it might be re-used
//this.m_writer = null;
} | java | private void resetSerializerBase()
{
this.m_attributes.clear();
this.m_CdataElems = null;
this.m_cdataTagOpen = false;
this.m_docIsEmpty = true;
this.m_doctypePublic = null;
this.m_doctypeSystem = null;
this.m_doIndent = false;
this.m_elemContext = new ElemContext();
this.m_indentAmount = 0;
this.m_inEntityRef = false;
this.m_inExternalDTD = false;
this.m_mediatype = null;
this.m_needToCallStartDocument = true;
this.m_needToOutputDocTypeDecl = false;
if (m_OutputProps != null)
this.m_OutputProps.clear();
if (m_OutputPropsDefault != null)
this.m_OutputPropsDefault.clear();
if (this.m_prefixMap != null)
this.m_prefixMap.reset();
this.m_shouldNotWriteXMLHeader = false;
this.m_sourceLocator = null;
this.m_standalone = null;
this.m_standaloneWasSpecified = false;
this.m_StringOfCDATASections = null;
this.m_tracer = null;
this.m_transformer = null;
this.m_version = null;
// don't set writer to null, so that it might be re-used
//this.m_writer = null;
} | [
"private",
"void",
"resetSerializerBase",
"(",
")",
"{",
"this",
".",
"m_attributes",
".",
"clear",
"(",
")",
";",
"this",
".",
"m_CdataElems",
"=",
"null",
";",
"this",
".",
"m_cdataTagOpen",
"=",
"false",
";",
"this",
".",
"m_docIsEmpty",
"=",
"true",
... | Reset all of the fields owned by SerializerBase | [
"Reset",
"all",
"of",
"the",
"fields",
"owned",
"by",
"SerializerBase"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1249-L1281 |
35,605 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.getElementURI | private String getElementURI() {
String uri = null;
// At this point in processing we have received all the
// namespace mappings
// As we still don't know the elements namespace,
// we now figure it out.
String prefix = getPrefixPart(m_elemContext.m_elementName);
if (prefix == null) {
// no prefix so lookup the URI of the default namespace
uri = m_prefixMap.lookupNamespace("");
} else {
uri = m_prefixMap.lookupNamespace(prefix);
}
if (uri == null) {
// We didn't find the namespace for the
// prefix ... ouch, that shouldn't happen.
// This is a hack, we really don't know
// the namespace
uri = EMPTYSTRING;
}
return uri;
} | java | private String getElementURI() {
String uri = null;
// At this point in processing we have received all the
// namespace mappings
// As we still don't know the elements namespace,
// we now figure it out.
String prefix = getPrefixPart(m_elemContext.m_elementName);
if (prefix == null) {
// no prefix so lookup the URI of the default namespace
uri = m_prefixMap.lookupNamespace("");
} else {
uri = m_prefixMap.lookupNamespace(prefix);
}
if (uri == null) {
// We didn't find the namespace for the
// prefix ... ouch, that shouldn't happen.
// This is a hack, we really don't know
// the namespace
uri = EMPTYSTRING;
}
return uri;
} | [
"private",
"String",
"getElementURI",
"(",
")",
"{",
"String",
"uri",
"=",
"null",
";",
"// At this point in processing we have received all the",
"// namespace mappings",
"// As we still don't know the elements namespace,",
"// we now figure it out.",
"String",
"prefix",
"=",
"g... | Before this call m_elementContext.m_elementURI is null,
which means it is not yet known. After this call it
is non-null, but possibly "" meaning that it is in the
default namespace.
@return The URI of the element, never null, but possibly "". | [
"Before",
"this",
"call",
"m_elementContext",
".",
"m_elementURI",
"is",
"null",
"which",
"means",
"it",
"is",
"not",
"yet",
"known",
".",
"After",
"this",
"call",
"it",
"is",
"non",
"-",
"null",
"but",
"possibly",
"meaning",
"that",
"it",
"is",
"in",
"t... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1519-L1543 |
35,606 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.getOutputProperty | public String getOutputProperty(String name) {
String val = getOutputPropertyNonDefault(name);
// If no explicit value, try to get the default value
if (val == null)
val = getOutputPropertyDefault(name);
return val;
} | java | public String getOutputProperty(String name) {
String val = getOutputPropertyNonDefault(name);
// If no explicit value, try to get the default value
if (val == null)
val = getOutputPropertyDefault(name);
return val;
} | [
"public",
"String",
"getOutputProperty",
"(",
"String",
"name",
")",
"{",
"String",
"val",
"=",
"getOutputPropertyNonDefault",
"(",
"name",
")",
";",
"// If no explicit value, try to get the default value",
"if",
"(",
"val",
"==",
"null",
")",
"val",
"=",
"getOutput... | Get the value of an output property,
the explicit value, if any, otherwise the
default value, if any, otherwise null. | [
"Get",
"the",
"value",
"of",
"an",
"output",
"property",
"the",
"explicit",
"value",
"if",
"any",
"otherwise",
"the",
"default",
"value",
"if",
"any",
"otherwise",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1551-L1558 |
35,607 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java | SerializerBase.getFirstCharLocName | static char getFirstCharLocName(String name) {
final char first;
int i = name.indexOf('}');
if (i < 0)
first = name.charAt(0);
else
first = name.charAt(i+1);
return first;
} | java | static char getFirstCharLocName(String name) {
final char first;
int i = name.indexOf('}');
if (i < 0)
first = name.charAt(0);
else
first = name.charAt(i+1);
return first;
} | [
"static",
"char",
"getFirstCharLocName",
"(",
"String",
"name",
")",
"{",
"final",
"char",
"first",
";",
"int",
"i",
"=",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"first",
"=",
"name",
".",
"charAt",
"(",
"0... | Get the first char of the local name
@param name Either a local name, or a local name
preceeded by a uri enclosed in curly braces. | [
"Get",
"the",
"first",
"char",
"of",
"the",
"local",
"name"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L1688-L1696 |
35,608 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java | Functionizer.makeFunction | private FunctionDeclaration makeFunction(MethodDeclaration method) {
ExecutableElement elem = method.getExecutableElement();
TypeElement declaringClass = ElementUtil.getDeclaringClass(elem);
boolean isInstanceMethod = !ElementUtil.isStatic(elem) && !ElementUtil.isConstructor(elem);
FunctionDeclaration function =
new FunctionDeclaration(nameTable.getFullFunctionName(elem), elem.getReturnType());
function.setJniSignature(signatureGenerator.createJniFunctionSignature(elem));
function.setLineNumber(method.getLineNumber());
if (!ElementUtil.isStatic(elem)) {
VariableElement var = GeneratedVariableElement.newParameter(
NameTable.SELF_NAME, declaringClass.asType(), null);
function.addParameter(new SingleVariableDeclaration(var));
}
TreeUtil.copyList(method.getParameters(), function.getParameters());
function.setModifiers(method.getModifiers() & Modifier.STATIC);
if (ElementUtil.isPrivate(elem) || (isInstanceMethod && !ElementUtil.isDefault(elem))) {
function.addModifiers(Modifier.PRIVATE);
} else {
function.addModifiers(Modifier.PUBLIC);
}
if (Modifier.isNative(method.getModifiers())) {
function.addModifiers(Modifier.NATIVE);
return function;
}
function.setBody(TreeUtil.remove(method.getBody()));
if (ElementUtil.isStatic(elem) || ElementUtil.isDefault(elem)) {
// Add class initialization invocation, since this may be the first use of this class.
String initName = UnicodeUtils.format("%s_initialize", nameTable.getFullName(declaringClass));
TypeMirror voidType = typeUtil.getVoid();
FunctionElement initElement = new FunctionElement(initName, voidType, declaringClass);
FunctionInvocation initCall = new FunctionInvocation(initElement, voidType);
function.getBody().addStatement(0, new ExpressionStatement(initCall));
} else {
FunctionConverter.convert(function);
}
return function;
} | java | private FunctionDeclaration makeFunction(MethodDeclaration method) {
ExecutableElement elem = method.getExecutableElement();
TypeElement declaringClass = ElementUtil.getDeclaringClass(elem);
boolean isInstanceMethod = !ElementUtil.isStatic(elem) && !ElementUtil.isConstructor(elem);
FunctionDeclaration function =
new FunctionDeclaration(nameTable.getFullFunctionName(elem), elem.getReturnType());
function.setJniSignature(signatureGenerator.createJniFunctionSignature(elem));
function.setLineNumber(method.getLineNumber());
if (!ElementUtil.isStatic(elem)) {
VariableElement var = GeneratedVariableElement.newParameter(
NameTable.SELF_NAME, declaringClass.asType(), null);
function.addParameter(new SingleVariableDeclaration(var));
}
TreeUtil.copyList(method.getParameters(), function.getParameters());
function.setModifiers(method.getModifiers() & Modifier.STATIC);
if (ElementUtil.isPrivate(elem) || (isInstanceMethod && !ElementUtil.isDefault(elem))) {
function.addModifiers(Modifier.PRIVATE);
} else {
function.addModifiers(Modifier.PUBLIC);
}
if (Modifier.isNative(method.getModifiers())) {
function.addModifiers(Modifier.NATIVE);
return function;
}
function.setBody(TreeUtil.remove(method.getBody()));
if (ElementUtil.isStatic(elem) || ElementUtil.isDefault(elem)) {
// Add class initialization invocation, since this may be the first use of this class.
String initName = UnicodeUtils.format("%s_initialize", nameTable.getFullName(declaringClass));
TypeMirror voidType = typeUtil.getVoid();
FunctionElement initElement = new FunctionElement(initName, voidType, declaringClass);
FunctionInvocation initCall = new FunctionInvocation(initElement, voidType);
function.getBody().addStatement(0, new ExpressionStatement(initCall));
} else {
FunctionConverter.convert(function);
}
return function;
} | [
"private",
"FunctionDeclaration",
"makeFunction",
"(",
"MethodDeclaration",
"method",
")",
"{",
"ExecutableElement",
"elem",
"=",
"method",
".",
"getExecutableElement",
"(",
")",
";",
"TypeElement",
"declaringClass",
"=",
"ElementUtil",
".",
"getDeclaringClass",
"(",
... | Create an equivalent function declaration for a given method. | [
"Create",
"an",
"equivalent",
"function",
"declaration",
"for",
"a",
"given",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java#L408-L451 |
35,609 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java | Functionizer.makeAllocatingConstructor | private FunctionDeclaration makeAllocatingConstructor(
MethodDeclaration method, boolean releasing) {
assert method.isConstructor();
ExecutableElement element = method.getExecutableElement();
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
String name = releasing ? nameTable.getReleasingConstructorName(element)
: nameTable.getAllocatingConstructorName(element);
FunctionDeclaration function = new FunctionDeclaration(name, declaringClass.asType());
function.setLineNumber(method.getLineNumber());
function.setModifiers(ElementUtil.isPrivate(element) ? Modifier.PRIVATE : Modifier.PUBLIC);
function.setReturnsRetained(!releasing);
TreeUtil.copyList(method.getParameters(), function.getParameters());
Block body = new Block();
function.setBody(body);
StringBuilder sb = new StringBuilder(releasing ? "J2OBJC_CREATE_IMPL(" : "J2OBJC_NEW_IMPL(");
sb.append(nameTable.getFullName(declaringClass));
sb.append(", ").append(nameTable.getFunctionName(element));
for (SingleVariableDeclaration param : function.getParameters()) {
sb.append(", ").append(nameTable.getVariableQualifiedName(param.getVariableElement()));
}
sb.append(")");
body.addStatement(new NativeStatement(sb.toString()));
return function;
} | java | private FunctionDeclaration makeAllocatingConstructor(
MethodDeclaration method, boolean releasing) {
assert method.isConstructor();
ExecutableElement element = method.getExecutableElement();
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
String name = releasing ? nameTable.getReleasingConstructorName(element)
: nameTable.getAllocatingConstructorName(element);
FunctionDeclaration function = new FunctionDeclaration(name, declaringClass.asType());
function.setLineNumber(method.getLineNumber());
function.setModifiers(ElementUtil.isPrivate(element) ? Modifier.PRIVATE : Modifier.PUBLIC);
function.setReturnsRetained(!releasing);
TreeUtil.copyList(method.getParameters(), function.getParameters());
Block body = new Block();
function.setBody(body);
StringBuilder sb = new StringBuilder(releasing ? "J2OBJC_CREATE_IMPL(" : "J2OBJC_NEW_IMPL(");
sb.append(nameTable.getFullName(declaringClass));
sb.append(", ").append(nameTable.getFunctionName(element));
for (SingleVariableDeclaration param : function.getParameters()) {
sb.append(", ").append(nameTable.getVariableQualifiedName(param.getVariableElement()));
}
sb.append(")");
body.addStatement(new NativeStatement(sb.toString()));
return function;
} | [
"private",
"FunctionDeclaration",
"makeAllocatingConstructor",
"(",
"MethodDeclaration",
"method",
",",
"boolean",
"releasing",
")",
"{",
"assert",
"method",
".",
"isConstructor",
"(",
")",
";",
"ExecutableElement",
"element",
"=",
"method",
".",
"getExecutableElement",... | Create a wrapper for a constructor that does the object allocation. | [
"Create",
"a",
"wrapper",
"for",
"a",
"constructor",
"that",
"does",
"the",
"object",
"allocation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java#L456-L482 |
35,610 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java | Functionizer.setFunctionCaller | private void setFunctionCaller(MethodDeclaration method, ExecutableElement methodElement) {
TypeMirror returnType = methodElement.getReturnType();
TypeElement declaringClass = ElementUtil.getDeclaringClass(methodElement);
Block body = new Block();
method.setBody(body);
method.removeModifiers(Modifier.NATIVE);
List<Statement> stmts = body.getStatements();
FunctionInvocation invocation =
new FunctionInvocation(newFunctionElement(methodElement), returnType);
List<Expression> args = invocation.getArguments();
if (!ElementUtil.isStatic(methodElement)) {
args.add(new ThisExpression(declaringClass.asType()));
}
for (SingleVariableDeclaration param : method.getParameters()) {
args.add(new SimpleName(param.getVariableElement()));
}
if (TypeUtil.isVoid(returnType)) {
stmts.add(new ExpressionStatement(invocation));
if (ElementUtil.isConstructor(methodElement)) {
stmts.add(new ReturnStatement(new ThisExpression(declaringClass.asType())));
}
} else {
stmts.add(new ReturnStatement(invocation));
}
} | java | private void setFunctionCaller(MethodDeclaration method, ExecutableElement methodElement) {
TypeMirror returnType = methodElement.getReturnType();
TypeElement declaringClass = ElementUtil.getDeclaringClass(methodElement);
Block body = new Block();
method.setBody(body);
method.removeModifiers(Modifier.NATIVE);
List<Statement> stmts = body.getStatements();
FunctionInvocation invocation =
new FunctionInvocation(newFunctionElement(methodElement), returnType);
List<Expression> args = invocation.getArguments();
if (!ElementUtil.isStatic(methodElement)) {
args.add(new ThisExpression(declaringClass.asType()));
}
for (SingleVariableDeclaration param : method.getParameters()) {
args.add(new SimpleName(param.getVariableElement()));
}
if (TypeUtil.isVoid(returnType)) {
stmts.add(new ExpressionStatement(invocation));
if (ElementUtil.isConstructor(methodElement)) {
stmts.add(new ReturnStatement(new ThisExpression(declaringClass.asType())));
}
} else {
stmts.add(new ReturnStatement(invocation));
}
} | [
"private",
"void",
"setFunctionCaller",
"(",
"MethodDeclaration",
"method",
",",
"ExecutableElement",
"methodElement",
")",
"{",
"TypeMirror",
"returnType",
"=",
"methodElement",
".",
"getReturnType",
"(",
")",
";",
"TypeElement",
"declaringClass",
"=",
"ElementUtil",
... | Replace method block statements with single statement that invokes function. | [
"Replace",
"method",
"block",
"statements",
"with",
"single",
"statement",
"that",
"invokes",
"function",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java#L487-L511 |
35,611 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java | Functionizer.addDisallowedConstructors | private void addDisallowedConstructors(TypeDeclaration node) {
TypeElement typeElement = node.getTypeElement();
TypeElement superClass = ElementUtil.getSuperclass(typeElement);
if (ElementUtil.isPrivateInnerType(typeElement) || ElementUtil.isAbstract(typeElement)
|| superClass == null
// If we're not emitting constructors we don't need to disallow anything unless our
// superclass is NSObject.
|| (!options.emitWrapperMethods()
&& typeUtil.getObjcClass(superClass) != TypeUtil.NS_OBJECT)) {
return;
}
Map<String, ExecutableElement> inheritedConstructors = new HashMap<>();
// Add super constructors that have unique parameter lists.
for (ExecutableElement superC : ElementUtil.getConstructors(superClass)) {
if (ElementUtil.isPrivate(superC)) {
// Skip private super constructors since they're already unavailable.
continue;
}
String selector = nameTable.getMethodSelector(superC);
inheritedConstructors.put(selector, superC);
}
// Don't disallow this class' constructors if we're emitting wrapper methods.
if (options.emitWrapperMethods()) {
for (ExecutableElement constructor : ElementUtil.getConstructors(typeElement)) {
inheritedConstructors.remove(nameTable.getMethodSelector(constructor));
}
}
for (Map.Entry<String, ExecutableElement> entry : inheritedConstructors.entrySet()) {
ExecutableElement oldConstructor = entry.getValue();
GeneratedExecutableElement newConstructor =
GeneratedExecutableElement.newConstructorWithSelector(
entry.getKey(), typeElement, typeUtil);
MethodDeclaration decl = new MethodDeclaration(newConstructor).setUnavailable(true);
decl.addModifiers(Modifier.ABSTRACT);
int count = 0;
for (VariableElement param : oldConstructor.getParameters()) {
VariableElement newParam = GeneratedVariableElement.newParameter(
"arg" + count++, param.asType(), newConstructor);
newConstructor.addParameter(newParam);
decl.addParameter(new SingleVariableDeclaration(newParam));
}
addImplicitParameters(decl, ElementUtil.getDeclaringClass(oldConstructor));
node.addBodyDeclaration(decl);
}
} | java | private void addDisallowedConstructors(TypeDeclaration node) {
TypeElement typeElement = node.getTypeElement();
TypeElement superClass = ElementUtil.getSuperclass(typeElement);
if (ElementUtil.isPrivateInnerType(typeElement) || ElementUtil.isAbstract(typeElement)
|| superClass == null
// If we're not emitting constructors we don't need to disallow anything unless our
// superclass is NSObject.
|| (!options.emitWrapperMethods()
&& typeUtil.getObjcClass(superClass) != TypeUtil.NS_OBJECT)) {
return;
}
Map<String, ExecutableElement> inheritedConstructors = new HashMap<>();
// Add super constructors that have unique parameter lists.
for (ExecutableElement superC : ElementUtil.getConstructors(superClass)) {
if (ElementUtil.isPrivate(superC)) {
// Skip private super constructors since they're already unavailable.
continue;
}
String selector = nameTable.getMethodSelector(superC);
inheritedConstructors.put(selector, superC);
}
// Don't disallow this class' constructors if we're emitting wrapper methods.
if (options.emitWrapperMethods()) {
for (ExecutableElement constructor : ElementUtil.getConstructors(typeElement)) {
inheritedConstructors.remove(nameTable.getMethodSelector(constructor));
}
}
for (Map.Entry<String, ExecutableElement> entry : inheritedConstructors.entrySet()) {
ExecutableElement oldConstructor = entry.getValue();
GeneratedExecutableElement newConstructor =
GeneratedExecutableElement.newConstructorWithSelector(
entry.getKey(), typeElement, typeUtil);
MethodDeclaration decl = new MethodDeclaration(newConstructor).setUnavailable(true);
decl.addModifiers(Modifier.ABSTRACT);
int count = 0;
for (VariableElement param : oldConstructor.getParameters()) {
VariableElement newParam = GeneratedVariableElement.newParameter(
"arg" + count++, param.asType(), newConstructor);
newConstructor.addParameter(newParam);
decl.addParameter(new SingleVariableDeclaration(newParam));
}
addImplicitParameters(decl, ElementUtil.getDeclaringClass(oldConstructor));
node.addBodyDeclaration(decl);
}
} | [
"private",
"void",
"addDisallowedConstructors",
"(",
"TypeDeclaration",
"node",
")",
"{",
"TypeElement",
"typeElement",
"=",
"node",
".",
"getTypeElement",
"(",
")",
";",
"TypeElement",
"superClass",
"=",
"ElementUtil",
".",
"getSuperclass",
"(",
"typeElement",
")",... | Declare any inherited constructors that aren't allowed to be accessed in Java
with a NS_UNAVAILABLE macro, so that clang will flag such access from native
code as an error. | [
"Declare",
"any",
"inherited",
"constructors",
"that",
"aren",
"t",
"allowed",
"to",
"be",
"accessed",
"in",
"Java",
"with",
"a",
"NS_UNAVAILABLE",
"macro",
"so",
"that",
"clang",
"will",
"flag",
"such",
"access",
"from",
"native",
"code",
"as",
"an",
"error... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Functionizer.java#L525-L569 |
35,612 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OuterReferenceResolver.java | OuterReferenceResolver.findScopeForType | private Scope findScopeForType(TypeElement type) {
Scope scope = peekScope();
while (scope != null) {
if (scope.kind != ScopeKind.METHOD && type.equals(scope.type)) {
return scope;
}
scope = scope.outer;
}
return null;
} | java | private Scope findScopeForType(TypeElement type) {
Scope scope = peekScope();
while (scope != null) {
if (scope.kind != ScopeKind.METHOD && type.equals(scope.type)) {
return scope;
}
scope = scope.outer;
}
return null;
} | [
"private",
"Scope",
"findScopeForType",
"(",
"TypeElement",
"type",
")",
"{",
"Scope",
"scope",
"=",
"peekScope",
"(",
")",
";",
"while",
"(",
"scope",
"!=",
"null",
")",
"{",
"if",
"(",
"scope",
".",
"kind",
"!=",
"ScopeKind",
".",
"METHOD",
"&&",
"ty... | Finds the non-method scope for the given type. | [
"Finds",
"the",
"non",
"-",
"method",
"scope",
"for",
"the",
"given",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OuterReferenceResolver.java#L166-L175 |
35,613 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OuterReferenceResolver.java | OuterReferenceResolver.whenNeedsOuterParam | private void whenNeedsOuterParam(TypeElement type, Runnable runnable) {
if (captureInfo.needsOuterParam(type)) {
runnable.run();
} else if (ElementUtil.isLocal(type)) {
Scope scope = findScopeForType(type);
if (scope != null) {
scope.onOuterParam.add(captureCurrentScope(runnable));
}
}
} | java | private void whenNeedsOuterParam(TypeElement type, Runnable runnable) {
if (captureInfo.needsOuterParam(type)) {
runnable.run();
} else if (ElementUtil.isLocal(type)) {
Scope scope = findScopeForType(type);
if (scope != null) {
scope.onOuterParam.add(captureCurrentScope(runnable));
}
}
} | [
"private",
"void",
"whenNeedsOuterParam",
"(",
"TypeElement",
"type",
",",
"Runnable",
"runnable",
")",
"{",
"if",
"(",
"captureInfo",
".",
"needsOuterParam",
"(",
"type",
")",
")",
"{",
"runnable",
".",
"run",
"(",
")",
";",
"}",
"else",
"if",
"(",
"Ele... | Executes the runnable if or when the given type needs an outer param. | [
"Executes",
"the",
"runnable",
"if",
"or",
"when",
"the",
"given",
"type",
"needs",
"an",
"outer",
"param",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OuterReferenceResolver.java#L201-L210 |
35,614 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OuterReferenceResolver.java | OuterReferenceResolver.addSuperOuterPath | private void addSuperOuterPath(TypeDeclaration node) {
TypeElement superclass = ElementUtil.getSuperclass(node.getTypeElement());
if (superclass != null && captureInfo.needsOuterParam(superclass)) {
node.setSuperOuter(getOuterPathInherited(ElementUtil.getDeclaringClass(superclass)));
}
} | java | private void addSuperOuterPath(TypeDeclaration node) {
TypeElement superclass = ElementUtil.getSuperclass(node.getTypeElement());
if (superclass != null && captureInfo.needsOuterParam(superclass)) {
node.setSuperOuter(getOuterPathInherited(ElementUtil.getDeclaringClass(superclass)));
}
} | [
"private",
"void",
"addSuperOuterPath",
"(",
"TypeDeclaration",
"node",
")",
"{",
"TypeElement",
"superclass",
"=",
"ElementUtil",
".",
"getSuperclass",
"(",
"node",
".",
"getTypeElement",
"(",
")",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
"&&",
"captu... | type node because there may be implicit super invocations. | [
"type",
"node",
"because",
"there",
"may",
"be",
"implicit",
"super",
"invocations",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OuterReferenceResolver.java#L286-L291 |
35,615 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java | CharsetEncoder.replaceWith | public final CharsetEncoder replaceWith(byte[] newReplacement) {
if (newReplacement == null)
throw new IllegalArgumentException("Null replacement");
int len = newReplacement.length;
if (len == 0)
throw new IllegalArgumentException("Empty replacement");
if (len > maxBytesPerChar)
throw new IllegalArgumentException("Replacement too long");
if (!isLegalReplacement(newReplacement))
throw new IllegalArgumentException("Illegal replacement");
this.replacement = newReplacement;
implReplaceWith(newReplacement);
return this;
} | java | public final CharsetEncoder replaceWith(byte[] newReplacement) {
if (newReplacement == null)
throw new IllegalArgumentException("Null replacement");
int len = newReplacement.length;
if (len == 0)
throw new IllegalArgumentException("Empty replacement");
if (len > maxBytesPerChar)
throw new IllegalArgumentException("Replacement too long");
if (!isLegalReplacement(newReplacement))
throw new IllegalArgumentException("Illegal replacement");
this.replacement = newReplacement;
implReplaceWith(newReplacement);
return this;
} | [
"public",
"final",
"CharsetEncoder",
"replaceWith",
"(",
"byte",
"[",
"]",
"newReplacement",
")",
"{",
"if",
"(",
"newReplacement",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null replacement\"",
")",
";",
"int",
"len",
"=",
"newRepla... | Changes this encoder's replacement value.
<p> This method invokes the {@link #implReplaceWith implReplaceWith}
method, passing the new replacement, after checking that the new
replacement is acceptable. </p>
@param newReplacement
The new replacement; must not be <tt>null</tt>, must have
non-zero length, must not be longer than the value returned by
the {@link #maxBytesPerChar() maxBytesPerChar} method, and
must be {@link #isLegalReplacement </code>legal<code>}
@return This encoder
@throws IllegalArgumentException
If the preconditions on the parameter do not hold | [
"Changes",
"this",
"encoder",
"s",
"replacement",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java#L294-L309 |
35,616 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java | CharsetEncoder.isLegalReplacement | public boolean isLegalReplacement(byte[] repl) {
/* J2ObjC: Removed use of WeakReference.
WeakReference<CharsetDecoder> wr = cachedDecoder;
CharsetDecoder dec = null;
if ((wr == null) || ((dec = wr.get()) == null)) {*/
CharsetDecoder dec = cachedDecoder;
if (dec == null) {
dec = charset().newDecoder();
dec.onMalformedInput(CodingErrorAction.REPORT);
dec.onUnmappableCharacter(CodingErrorAction.REPORT);
//cachedDecoder = new WeakReference<CharsetDecoder>(dec);
cachedDecoder = dec;
} else {
dec.reset();
}
ByteBuffer bb = ByteBuffer.wrap(repl);
CharBuffer cb = CharBuffer.allocate((int)(bb.remaining()
* dec.maxCharsPerByte()));
CoderResult cr = dec.decode(bb, cb, true);
return !cr.isError();
} | java | public boolean isLegalReplacement(byte[] repl) {
/* J2ObjC: Removed use of WeakReference.
WeakReference<CharsetDecoder> wr = cachedDecoder;
CharsetDecoder dec = null;
if ((wr == null) || ((dec = wr.get()) == null)) {*/
CharsetDecoder dec = cachedDecoder;
if (dec == null) {
dec = charset().newDecoder();
dec.onMalformedInput(CodingErrorAction.REPORT);
dec.onUnmappableCharacter(CodingErrorAction.REPORT);
//cachedDecoder = new WeakReference<CharsetDecoder>(dec);
cachedDecoder = dec;
} else {
dec.reset();
}
ByteBuffer bb = ByteBuffer.wrap(repl);
CharBuffer cb = CharBuffer.allocate((int)(bb.remaining()
* dec.maxCharsPerByte()));
CoderResult cr = dec.decode(bb, cb, true);
return !cr.isError();
} | [
"public",
"boolean",
"isLegalReplacement",
"(",
"byte",
"[",
"]",
"repl",
")",
"{",
"/* J2ObjC: Removed use of WeakReference.\n WeakReference<CharsetDecoder> wr = cachedDecoder;\n CharsetDecoder dec = null;\n if ((wr == null) || ((dec = wr.get()) == null)) {*/",
"CharsetDe... | Tells whether or not the given byte array is a legal replacement value
for this encoder.
<p> A replacement is legal if, and only if, it is a legal sequence of
bytes in this encoder's charset; that is, it must be possible to decode
the replacement into one or more sixteen-bit Unicode characters.
<p> The default implementation of this method is not very efficient; it
should generally be overridden to improve performance. </p>
@param repl The byte array to be tested
@return <tt>true</tt> if, and only if, the given byte array
is a legal replacement value for this encoder | [
"Tells",
"whether",
"or",
"not",
"the",
"given",
"byte",
"array",
"is",
"a",
"legal",
"replacement",
"value",
"for",
"this",
"encoder",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java#L343-L363 |
35,617 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java | CharsetEncoder.onUnmappableCharacter | public final CharsetEncoder onUnmappableCharacter(CodingErrorAction
newAction)
{
if (newAction == null)
throw new IllegalArgumentException("Null action");
unmappableCharacterAction = newAction;
implOnUnmappableCharacter(newAction);
return this;
} | java | public final CharsetEncoder onUnmappableCharacter(CodingErrorAction
newAction)
{
if (newAction == null)
throw new IllegalArgumentException("Null action");
unmappableCharacterAction = newAction;
implOnUnmappableCharacter(newAction);
return this;
} | [
"public",
"final",
"CharsetEncoder",
"onUnmappableCharacter",
"(",
"CodingErrorAction",
"newAction",
")",
"{",
"if",
"(",
"newAction",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null action\"",
")",
";",
"unmappableCharacterAction",
"=",
"n... | Changes this encoder's action for unmappable-character errors.
<p> This method invokes the {@link #implOnUnmappableCharacter
implOnUnmappableCharacter} method, passing the new action. </p>
@param newAction The new action; must not be <tt>null</tt>
@return This encoder
@throws IllegalArgumentException
If the precondition on the parameter does not hold | [
"Changes",
"this",
"encoder",
"s",
"action",
"for",
"unmappable",
"-",
"character",
"errors",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java#L430-L438 |
35,618 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java | CharsetEncoder.encode | public final ByteBuffer encode(CharBuffer in)
throws CharacterCodingException
{
int n = (int)(in.remaining() * averageBytesPerChar());
ByteBuffer out = ByteBuffer.allocate(n);
if ((n == 0) && (in.remaining() == 0))
return out;
reset();
for (;;) {
CoderResult cr = in.hasRemaining() ?
encode(in, out, true) : CoderResult.UNDERFLOW;
if (cr.isUnderflow())
cr = flush(out);
if (cr.isUnderflow())
break;
if (cr.isOverflow()) {
n = 2*n + 1; // Ensure progress; n might be 0!
ByteBuffer o = ByteBuffer.allocate(n);
out.flip();
o.put(out);
out = o;
continue;
}
cr.throwException();
}
out.flip();
return out;
} | java | public final ByteBuffer encode(CharBuffer in)
throws CharacterCodingException
{
int n = (int)(in.remaining() * averageBytesPerChar());
ByteBuffer out = ByteBuffer.allocate(n);
if ((n == 0) && (in.remaining() == 0))
return out;
reset();
for (;;) {
CoderResult cr = in.hasRemaining() ?
encode(in, out, true) : CoderResult.UNDERFLOW;
if (cr.isUnderflow())
cr = flush(out);
if (cr.isUnderflow())
break;
if (cr.isOverflow()) {
n = 2*n + 1; // Ensure progress; n might be 0!
ByteBuffer o = ByteBuffer.allocate(n);
out.flip();
o.put(out);
out = o;
continue;
}
cr.throwException();
}
out.flip();
return out;
} | [
"public",
"final",
"ByteBuffer",
"encode",
"(",
"CharBuffer",
"in",
")",
"throws",
"CharacterCodingException",
"{",
"int",
"n",
"=",
"(",
"int",
")",
"(",
"in",
".",
"remaining",
"(",
")",
"*",
"averageBytesPerChar",
"(",
")",
")",
";",
"ByteBuffer",
"out"... | Convenience method that encodes the remaining content of a single input
character buffer into a newly-allocated byte buffer.
<p> This method implements an entire <a href="#steps">encoding
operation</a>; that is, it resets this encoder, then it encodes the
characters in the given character buffer, and finally it flushes this
encoder. This method should therefore not be invoked if an encoding
operation is already in progress. </p>
@param in
The input character buffer
@return A newly-allocated byte buffer containing the result of the
encoding operation. The buffer's position will be zero and its
limit will follow the last byte written.
@throws IllegalStateException
If an encoding operation is already in progress
@throws MalformedInputException
If the character sequence starting at the input buffer's current
position is not a legal sixteen-bit Unicode sequence and the current malformed-input action
is {@link CodingErrorAction#REPORT}
@throws UnmappableCharacterException
If the character sequence starting at the input buffer's current
position cannot be mapped to an equivalent byte sequence and
the current unmappable-character action is {@link
CodingErrorAction#REPORT} | [
"Convenience",
"method",
"that",
"encodes",
"the",
"remaining",
"content",
"of",
"a",
"single",
"input",
"character",
"buffer",
"into",
"a",
"newly",
"-",
"allocated",
"byte",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java#L796-L825 |
35,619 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java | CharsetEncoder.canEncode | public boolean canEncode(char c) {
CharBuffer cb = CharBuffer.allocate(1);
cb.put(c);
cb.flip();
return canEncode(cb);
} | java | public boolean canEncode(char c) {
CharBuffer cb = CharBuffer.allocate(1);
cb.put(c);
cb.flip();
return canEncode(cb);
} | [
"public",
"boolean",
"canEncode",
"(",
"char",
"c",
")",
"{",
"CharBuffer",
"cb",
"=",
"CharBuffer",
".",
"allocate",
"(",
"1",
")",
";",
"cb",
".",
"put",
"(",
"c",
")",
";",
"cb",
".",
"flip",
"(",
")",
";",
"return",
"canEncode",
"(",
"cb",
")... | Tells whether or not this encoder can encode the given character.
<p> This method returns <tt>false</tt> if the given character is a
surrogate character; such characters can be interpreted only when they
are members of a pair consisting of a high surrogate followed by a low
surrogate. The {@link #canEncode(java.lang.CharSequence)
canEncode(CharSequence)} method may be used to test whether or not a
character sequence can be encoded.
<p> This method may modify this encoder's state; it should therefore not
be invoked if an <a href="#steps">encoding operation</a> is already in
progress.
<p> The default implementation of this method is not very efficient; it
should generally be overridden to improve performance. </p>
@return <tt>true</tt> if, and only if, this encoder can encode
the given character
@throws IllegalStateException
If an encoding operation is already in progress | [
"Tells",
"whether",
"or",
"not",
"this",
"encoder",
"can",
"encode",
"the",
"given",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java#L957-L962 |
35,620 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserFactory.java | ParserFactory.makeParser | public static Parser makeParser ()
throws ClassNotFoundException,
IllegalAccessException,
InstantiationException,
NullPointerException,
ClassCastException
{
String className = System.getProperty("org.xml.sax.parser");
if (className == null) {
throw new NullPointerException("No value for sax.parser property");
} else {
return makeParser(className);
}
} | java | public static Parser makeParser ()
throws ClassNotFoundException,
IllegalAccessException,
InstantiationException,
NullPointerException,
ClassCastException
{
String className = System.getProperty("org.xml.sax.parser");
if (className == null) {
throw new NullPointerException("No value for sax.parser property");
} else {
return makeParser(className);
}
} | [
"public",
"static",
"Parser",
"makeParser",
"(",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"NullPointerException",
",",
"ClassCastException",
"{",
"String",
"className",
"=",
"System",
".",
"getProperty",
... | Create a new SAX parser using the `org.xml.sax.parser' system property.
<p>The named class must exist and must implement the
{@link org.xml.sax.Parser Parser} interface.</p>
@return the newly created parser.
@exception java.lang.NullPointerException There is no value
for the `org.xml.sax.parser' system property.
@exception java.lang.ClassNotFoundException The SAX parser
class was not found (check your CLASSPATH).
@exception IllegalAccessException The SAX parser class was
found, but you do not have permission to load
it.
@exception InstantiationException The SAX parser class was
found but could not be instantiated.
@exception java.lang.ClassCastException The SAX parser class
was found and instantiated, but does not implement
org.xml.sax.Parser.
@see #makeParser(java.lang.String)
@see org.xml.sax.Parser | [
"Create",
"a",
"new",
"SAX",
"parser",
"using",
"the",
"org",
".",
"xml",
".",
"sax",
".",
"parser",
"system",
"property",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserFactory.java#L78-L91 |
35,621 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserFactory.java | ParserFactory.makeParser | public static Parser makeParser (String className)
throws ClassNotFoundException,
IllegalAccessException,
InstantiationException,
ClassCastException
{
return (Parser) NewInstance.newInstance (
NewInstance.getClassLoader (), className);
} | java | public static Parser makeParser (String className)
throws ClassNotFoundException,
IllegalAccessException,
InstantiationException,
ClassCastException
{
return (Parser) NewInstance.newInstance (
NewInstance.getClassLoader (), className);
} | [
"public",
"static",
"Parser",
"makeParser",
"(",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
",",
"ClassCastException",
"{",
"return",
"(",
"Parser",
")",
"NewInstance",
".",
"newInstance"... | Create a new SAX parser object using the class name provided.
<p>The named class must exist and must implement the
{@link org.xml.sax.Parser Parser} interface.</p>
@return the newly created parser.
@param className A string containing the name of the
SAX parser class.
@exception java.lang.ClassNotFoundException The SAX parser
class was not found (check your CLASSPATH).
@exception IllegalAccessException The SAX parser class was
found, but you do not have permission to load
it.
@exception InstantiationException The SAX parser class was
found but could not be instantiated.
@exception java.lang.ClassCastException The SAX parser class
was found and instantiated, but does not implement
org.xml.sax.Parser.
@see #makeParser()
@see org.xml.sax.Parser | [
"Create",
"a",
"new",
"SAX",
"parser",
"object",
"using",
"the",
"class",
"name",
"provided",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserFactory.java#L117-L125 |
35,622 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertificatePair.java | X509CertificatePair.generateCertificatePair | public static synchronized X509CertificatePair generateCertificatePair
(byte[] encoded) throws CertificateException {
Object key = new Cache.EqualByteArray(encoded);
X509CertificatePair pair = cache.get(key);
if (pair != null) {
return pair;
}
pair = new X509CertificatePair(encoded);
key = new Cache.EqualByteArray(pair.encoded);
cache.put(key, pair);
return pair;
} | java | public static synchronized X509CertificatePair generateCertificatePair
(byte[] encoded) throws CertificateException {
Object key = new Cache.EqualByteArray(encoded);
X509CertificatePair pair = cache.get(key);
if (pair != null) {
return pair;
}
pair = new X509CertificatePair(encoded);
key = new Cache.EqualByteArray(pair.encoded);
cache.put(key, pair);
return pair;
} | [
"public",
"static",
"synchronized",
"X509CertificatePair",
"generateCertificatePair",
"(",
"byte",
"[",
"]",
"encoded",
")",
"throws",
"CertificateException",
"{",
"Object",
"key",
"=",
"new",
"Cache",
".",
"EqualByteArray",
"(",
"encoded",
")",
";",
"X509Certificat... | Create a X509CertificatePair from its encoding. Uses cache lookup
if possible. | [
"Create",
"a",
"X509CertificatePair",
"from",
"its",
"encoding",
".",
"Uses",
"cache",
"lookup",
"if",
"possible",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertificatePair.java#L139-L150 |
35,623 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertificatePair.java | X509CertificatePair.getEncoded | public byte[] getEncoded() throws CertificateEncodingException {
try {
if (encoded == null) {
DerOutputStream tmp = new DerOutputStream();
emit(tmp);
encoded = tmp.toByteArray();
}
} catch (IOException ex) {
throw new CertificateEncodingException(ex.toString());
}
return encoded;
} | java | public byte[] getEncoded() throws CertificateEncodingException {
try {
if (encoded == null) {
DerOutputStream tmp = new DerOutputStream();
emit(tmp);
encoded = tmp.toByteArray();
}
} catch (IOException ex) {
throw new CertificateEncodingException(ex.toString());
}
return encoded;
} | [
"public",
"byte",
"[",
"]",
"getEncoded",
"(",
")",
"throws",
"CertificateEncodingException",
"{",
"try",
"{",
"if",
"(",
"encoded",
"==",
"null",
")",
"{",
"DerOutputStream",
"tmp",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"emit",
"(",
"tmp",
")",
... | Return the DER encoded form of the certificate pair.
@return The encoded form of the certificate pair.
@throws CerticateEncodingException If an encoding exception occurs. | [
"Return",
"the",
"DER",
"encoded",
"form",
"of",
"the",
"certificate",
"pair",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertificatePair.java#L192-L203 |
35,624 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringMatcher.java | StringMatcher.addMatchSetTo | @Override
public void addMatchSetTo(UnicodeSet toUnionTo) {
int ch;
for (int i=0; i<pattern.length(); i+=UTF16.getCharCount(ch)) {
ch = UTF16.charAt(pattern, i);
UnicodeMatcher matcher = data.lookupMatcher(ch);
if (matcher == null) {
toUnionTo.add(ch);
} else {
matcher.addMatchSetTo(toUnionTo);
}
}
} | java | @Override
public void addMatchSetTo(UnicodeSet toUnionTo) {
int ch;
for (int i=0; i<pattern.length(); i+=UTF16.getCharCount(ch)) {
ch = UTF16.charAt(pattern, i);
UnicodeMatcher matcher = data.lookupMatcher(ch);
if (matcher == null) {
toUnionTo.add(ch);
} else {
matcher.addMatchSetTo(toUnionTo);
}
}
} | [
"@",
"Override",
"public",
"void",
"addMatchSetTo",
"(",
"UnicodeSet",
"toUnionTo",
")",
"{",
"int",
"ch",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pattern",
".",
"length",
"(",
")",
";",
"i",
"+=",
"UTF16",
".",
"getCharCount",
"(",
... | Implementation of UnicodeMatcher API. Union the set of all
characters that may be matched by this object into the given
set.
@param toUnionTo the set into which to union the source characters | [
"Implementation",
"of",
"UnicodeMatcher",
"API",
".",
"Union",
"the",
"set",
"of",
"all",
"characters",
"that",
"may",
"be",
"matched",
"by",
"this",
"object",
"into",
"the",
"given",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringMatcher.java#L224-L236 |
35,625 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificatePolicySet.java | CertificatePolicySet.encode | public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
for (int i = 0; i < ids.size(); i++) {
ids.elementAt(i).encode(tmp);
}
out.write(DerValue.tag_Sequence,tmp);
} | java | public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
for (int i = 0; i < ids.size(); i++) {
ids.elementAt(i).encode(tmp);
}
out.write(DerValue.tag_Sequence,tmp);
} | [
"public",
"void",
"encode",
"(",
"DerOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DerOutputStream",
"tmp",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ids",
".",
"size",
"(",
")",
";",
... | Encode the policy set to the output stream.
@param out the DerOutputStream to encode the data to. | [
"Encode",
"the",
"policy",
"set",
"to",
"the",
"output",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificatePolicySet.java#L86-L93 |
35,626 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java | SimpleTimeZone.makeRulesCompatible | private void makeRulesCompatible()
{
switch (startMode) {
case DOM_MODE:
startDay = 1 + (startDay / 7);
startDayOfWeek = Calendar.SUNDAY;
break;
case DOW_GE_DOM_MODE:
// A day-of-month of 1 is equivalent to DOW_IN_MONTH_MODE
// that is, Sun>=1 == firstSun.
if (startDay != 1) {
startDay = 1 + (startDay / 7);
}
break;
case DOW_LE_DOM_MODE:
if (startDay >= 30) {
startDay = -1;
} else {
startDay = 1 + (startDay / 7);
}
break;
}
switch (endMode) {
case DOM_MODE:
endDay = 1 + (endDay / 7);
endDayOfWeek = Calendar.SUNDAY;
break;
case DOW_GE_DOM_MODE:
// A day-of-month of 1 is equivalent to DOW_IN_MONTH_MODE
// that is, Sun>=1 == firstSun.
if (endDay != 1) {
endDay = 1 + (endDay / 7);
}
break;
case DOW_LE_DOM_MODE:
if (endDay >= 30) {
endDay = -1;
} else {
endDay = 1 + (endDay / 7);
}
break;
}
/*
* Adjust the start and end times to wall time. This works perfectly
* well unless it pushes into the next or previous day. If that
* happens, we attempt to adjust the day rule somewhat crudely. The day
* rules have been forced into DOW_IN_MONTH mode already, so we change
* the day of week to move forward or back by a day. It's possible to
* make a more refined adjustment of the original rules first, but in
* most cases this extra effort will go to waste once we adjust the day
* rules anyway.
*/
switch (startTimeMode) {
case UTC_TIME:
startTime += rawOffset;
break;
}
while (startTime < 0) {
startTime += millisPerDay;
startDayOfWeek = 1 + ((startDayOfWeek+5) % 7); // Back 1 day
}
while (startTime >= millisPerDay) {
startTime -= millisPerDay;
startDayOfWeek = 1 + (startDayOfWeek % 7); // Forward 1 day
}
switch (endTimeMode) {
case UTC_TIME:
endTime += rawOffset + dstSavings;
break;
case STANDARD_TIME:
endTime += dstSavings;
}
while (endTime < 0) {
endTime += millisPerDay;
endDayOfWeek = 1 + ((endDayOfWeek+5) % 7); // Back 1 day
}
while (endTime >= millisPerDay) {
endTime -= millisPerDay;
endDayOfWeek = 1 + (endDayOfWeek % 7); // Forward 1 day
}
} | java | private void makeRulesCompatible()
{
switch (startMode) {
case DOM_MODE:
startDay = 1 + (startDay / 7);
startDayOfWeek = Calendar.SUNDAY;
break;
case DOW_GE_DOM_MODE:
// A day-of-month of 1 is equivalent to DOW_IN_MONTH_MODE
// that is, Sun>=1 == firstSun.
if (startDay != 1) {
startDay = 1 + (startDay / 7);
}
break;
case DOW_LE_DOM_MODE:
if (startDay >= 30) {
startDay = -1;
} else {
startDay = 1 + (startDay / 7);
}
break;
}
switch (endMode) {
case DOM_MODE:
endDay = 1 + (endDay / 7);
endDayOfWeek = Calendar.SUNDAY;
break;
case DOW_GE_DOM_MODE:
// A day-of-month of 1 is equivalent to DOW_IN_MONTH_MODE
// that is, Sun>=1 == firstSun.
if (endDay != 1) {
endDay = 1 + (endDay / 7);
}
break;
case DOW_LE_DOM_MODE:
if (endDay >= 30) {
endDay = -1;
} else {
endDay = 1 + (endDay / 7);
}
break;
}
/*
* Adjust the start and end times to wall time. This works perfectly
* well unless it pushes into the next or previous day. If that
* happens, we attempt to adjust the day rule somewhat crudely. The day
* rules have been forced into DOW_IN_MONTH mode already, so we change
* the day of week to move forward or back by a day. It's possible to
* make a more refined adjustment of the original rules first, but in
* most cases this extra effort will go to waste once we adjust the day
* rules anyway.
*/
switch (startTimeMode) {
case UTC_TIME:
startTime += rawOffset;
break;
}
while (startTime < 0) {
startTime += millisPerDay;
startDayOfWeek = 1 + ((startDayOfWeek+5) % 7); // Back 1 day
}
while (startTime >= millisPerDay) {
startTime -= millisPerDay;
startDayOfWeek = 1 + (startDayOfWeek % 7); // Forward 1 day
}
switch (endTimeMode) {
case UTC_TIME:
endTime += rawOffset + dstSavings;
break;
case STANDARD_TIME:
endTime += dstSavings;
}
while (endTime < 0) {
endTime += millisPerDay;
endDayOfWeek = 1 + ((endDayOfWeek+5) % 7); // Back 1 day
}
while (endTime >= millisPerDay) {
endTime -= millisPerDay;
endDayOfWeek = 1 + (endDayOfWeek % 7); // Forward 1 day
}
} | [
"private",
"void",
"makeRulesCompatible",
"(",
")",
"{",
"switch",
"(",
"startMode",
")",
"{",
"case",
"DOM_MODE",
":",
"startDay",
"=",
"1",
"+",
"(",
"startDay",
"/",
"7",
")",
";",
"startDayOfWeek",
"=",
"Calendar",
".",
"SUNDAY",
";",
"break",
";",
... | Make rules compatible to 1.1 FCS code. Since 1.1 FCS code only understands
day-of-week-in-month rules, we must modify other modes of rules to their
approximate equivalent in 1.1 FCS terms. This method is used when streaming
out objects of this class. After it is called, the rules will be modified,
with a possible loss of information. startMode and endMode will NOT be
altered, even though semantically they should be set to DOW_IN_MONTH_MODE,
since the rule modification is only intended to be temporary. | [
"Make",
"rules",
"compatible",
"to",
"1",
".",
"1",
"FCS",
"code",
".",
"Since",
"1",
".",
"1",
"FCS",
"code",
"only",
"understands",
"day",
"-",
"of",
"-",
"week",
"-",
"in",
"-",
"month",
"rules",
"we",
"must",
"modify",
"other",
"modes",
"of",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java#L1477-L1564 |
35,627 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java | SimpleTimeZone.packRules | private byte[] packRules()
{
byte[] rules = new byte[6];
rules[0] = (byte)startDay;
rules[1] = (byte)startDayOfWeek;
rules[2] = (byte)endDay;
rules[3] = (byte)endDayOfWeek;
// As of serial version 2, include time modes
rules[4] = (byte)startTimeMode;
rules[5] = (byte)endTimeMode;
return rules;
} | java | private byte[] packRules()
{
byte[] rules = new byte[6];
rules[0] = (byte)startDay;
rules[1] = (byte)startDayOfWeek;
rules[2] = (byte)endDay;
rules[3] = (byte)endDayOfWeek;
// As of serial version 2, include time modes
rules[4] = (byte)startTimeMode;
rules[5] = (byte)endTimeMode;
return rules;
} | [
"private",
"byte",
"[",
"]",
"packRules",
"(",
")",
"{",
"byte",
"[",
"]",
"rules",
"=",
"new",
"byte",
"[",
"6",
"]",
";",
"rules",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"startDay",
";",
"rules",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"startD... | Pack the start and end rules into an array of bytes. Only pack
data which is not preserved by makeRulesCompatible. | [
"Pack",
"the",
"start",
"and",
"end",
"rules",
"into",
"an",
"array",
"of",
"bytes",
".",
"Only",
"pack",
"data",
"which",
"is",
"not",
"preserved",
"by",
"makeRulesCompatible",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java#L1570-L1583 |
35,628 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java | SimpleTimeZone.unpackRules | private void unpackRules(byte[] rules)
{
startDay = rules[0];
startDayOfWeek = rules[1];
endDay = rules[2];
endDayOfWeek = rules[3];
// As of serial version 2, include time modes
if (rules.length >= 6) {
startTimeMode = rules[4];
endTimeMode = rules[5];
}
} | java | private void unpackRules(byte[] rules)
{
startDay = rules[0];
startDayOfWeek = rules[1];
endDay = rules[2];
endDayOfWeek = rules[3];
// As of serial version 2, include time modes
if (rules.length >= 6) {
startTimeMode = rules[4];
endTimeMode = rules[5];
}
} | [
"private",
"void",
"unpackRules",
"(",
"byte",
"[",
"]",
"rules",
")",
"{",
"startDay",
"=",
"rules",
"[",
"0",
"]",
";",
"startDayOfWeek",
"=",
"rules",
"[",
"1",
"]",
";",
"endDay",
"=",
"rules",
"[",
"2",
"]",
";",
"endDayOfWeek",
"=",
"rules",
... | Given an array of bytes produced by packRules, interpret them
as the start and end rules. | [
"Given",
"an",
"array",
"of",
"bytes",
"produced",
"by",
"packRules",
"interpret",
"them",
"as",
"the",
"start",
"and",
"end",
"rules",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java#L1589-L1601 |
35,629 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.get | private static <T> T get(ListIterator<? extends T> i, int index) {
T obj = null;
int pos = i.nextIndex();
if (pos <= index) {
do {
obj = i.next();
} while (pos++ < index);
} else {
do {
obj = i.previous();
} while (--pos > index);
}
return obj;
} | java | private static <T> T get(ListIterator<? extends T> i, int index) {
T obj = null;
int pos = i.nextIndex();
if (pos <= index) {
do {
obj = i.next();
} while (pos++ < index);
} else {
do {
obj = i.previous();
} while (--pos > index);
}
return obj;
} | [
"private",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"ListIterator",
"<",
"?",
"extends",
"T",
">",
"i",
",",
"int",
"index",
")",
"{",
"T",
"obj",
"=",
"null",
";",
"int",
"pos",
"=",
"i",
".",
"nextIndex",
"(",
")",
";",
"if",
"(",
"pos",
"... | Gets the ith element from the given list by repositioning the specified
list listIterator. | [
"Gets",
"the",
"ith",
"element",
"from",
"the",
"given",
"list",
"by",
"repositioning",
"the",
"specified",
"list",
"listIterator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L296-L309 |
35,630 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.shuffle | public static void shuffle(List<?> list) {
Random rnd = r;
if (rnd == null)
r = rnd = new Random(); // harmless race.
shuffle(list, rnd);
} | java | public static void shuffle(List<?> list) {
Random rnd = r;
if (rnd == null)
r = rnd = new Random(); // harmless race.
shuffle(list, rnd);
} | [
"public",
"static",
"void",
"shuffle",
"(",
"List",
"<",
"?",
">",
"list",
")",
"{",
"Random",
"rnd",
"=",
"r",
";",
"if",
"(",
"rnd",
"==",
"null",
")",
"r",
"=",
"rnd",
"=",
"new",
"Random",
"(",
")",
";",
"// harmless race.",
"shuffle",
"(",
"... | Randomly permutes the specified list using a default source of
randomness. All permutations occur with approximately equal
likelihood.
<p>The hedge "approximately" is used in the foregoing description because
default source of randomness is only approximately an unbiased source
of independently chosen bits. If it were a perfect source of randomly
chosen bits, then the algorithm would choose permutations with perfect
uniformity.
<p>This implementation traverses the list backwards, from the last
element up to the second, repeatedly swapping a randomly selected element
into the "current position". Elements are randomly selected from the
portion of the list that runs from the first element to the current
position, inclusive.
<p>This method runs in linear time. If the specified list does not
implement the {@link RandomAccess} interface and is large, this
implementation dumps the specified list into an array before shuffling
it, and dumps the shuffled array back into the list. This avoids the
quadratic behavior that would result from shuffling a "sequential
access" list in place.
@param list the list to be shuffled.
@throws UnsupportedOperationException if the specified list or
its list-iterator does not support the <tt>set</tt> operation. | [
"Randomly",
"permutes",
"the",
"specified",
"list",
"using",
"a",
"default",
"source",
"of",
"randomness",
".",
"All",
"permutations",
"occur",
"with",
"approximately",
"equal",
"likelihood",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L453-L458 |
35,631 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.singletonMap | public static <K,V> Map<K,V> singletonMap(K key, V value) {
return new SingletonMap<>(key, value);
} | java | public static <K,V> Map<K,V> singletonMap(K key, V value) {
return new SingletonMap<>(key, value);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"singletonMap",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"return",
"new",
"SingletonMap",
"<>",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Returns an immutable map, mapping only the specified key to the
specified value. The returned map is serializable.
@param <K> the class of the map keys
@param <V> the class of the map values
@param key the sole key to be stored in the returned map.
@param value the value to which the returned map maps <tt>key</tt>.
@return an immutable map containing only the specified key-value
mapping.
@since 1.3 | [
"Returns",
"an",
"immutable",
"map",
"mapping",
"only",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
".",
"The",
"returned",
"map",
"is",
"serializable",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L4889-L4891 |
35,632 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.enumeration | public static <T> Enumeration<T> enumeration(final Collection<T> c) {
return new Enumeration<T>() {
private final Iterator<T> i = c.iterator();
public boolean hasMoreElements() {
return i.hasNext();
}
public T nextElement() {
return i.next();
}
};
} | java | public static <T> Enumeration<T> enumeration(final Collection<T> c) {
return new Enumeration<T>() {
private final Iterator<T> i = c.iterator();
public boolean hasMoreElements() {
return i.hasNext();
}
public T nextElement() {
return i.next();
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Enumeration",
"<",
"T",
">",
"enumeration",
"(",
"final",
"Collection",
"<",
"T",
">",
"c",
")",
"{",
"return",
"new",
"Enumeration",
"<",
"T",
">",
"(",
")",
"{",
"private",
"final",
"Iterator",
"<",
"T",
">",
"... | Returns an enumeration over the specified collection. This provides
interoperability with legacy APIs that require an enumeration
as input.
@param <T> the class of the objects in the collection
@param c the collection for which an enumeration is to be returned.
@return an enumeration over the specified collection.
@see Enumeration | [
"Returns",
"an",
"enumeration",
"over",
"the",
"specified",
"collection",
".",
"This",
"provides",
"interoperability",
"with",
"legacy",
"APIs",
"that",
"require",
"an",
"enumeration",
"as",
"input",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L5247-L5259 |
35,633 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.list | public static <T> ArrayList<T> list(Enumeration<T> e) {
ArrayList<T> l = new ArrayList<>();
while (e.hasMoreElements())
l.add(e.nextElement());
return l;
} | java | public static <T> ArrayList<T> list(Enumeration<T> e) {
ArrayList<T> l = new ArrayList<>();
while (e.hasMoreElements())
l.add(e.nextElement());
return l;
} | [
"public",
"static",
"<",
"T",
">",
"ArrayList",
"<",
"T",
">",
"list",
"(",
"Enumeration",
"<",
"T",
">",
"e",
")",
"{",
"ArrayList",
"<",
"T",
">",
"l",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"while",
"(",
"e",
".",
"hasMoreElements",
"("... | Returns an array list containing the elements returned by the
specified enumeration in the order they are returned by the
enumeration. This method provides interoperability between
legacy APIs that return enumerations and new APIs that require
collections.
@param <T> the class of the objects returned by the enumeration
@param e enumeration providing elements for the returned
array list
@return an array list containing the elements returned
by the specified enumeration.
@since 1.4
@see Enumeration
@see ArrayList | [
"Returns",
"an",
"array",
"list",
"containing",
"the",
"elements",
"returned",
"by",
"the",
"specified",
"enumeration",
"in",
"the",
"order",
"they",
"are",
"returned",
"by",
"the",
"enumeration",
".",
"This",
"method",
"provides",
"interoperability",
"between",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L5277-L5282 |
35,634 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionCall.java | ElemExtensionCall.getElemExtensionDecl | private ElemExtensionDecl getElemExtensionDecl(StylesheetRoot stylesheet,
String namespace)
{
ElemExtensionDecl decl = null;
int n = stylesheet.getGlobalImportCount();
for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getGlobalImport(i);
for (ElemTemplateElement child = imported.getFirstChildElem();
child != null; child = child.getNextSiblingElem())
{
if (Constants.ELEMNAME_EXTENSIONDECL == child.getXSLToken())
{
decl = (ElemExtensionDecl) child;
String prefix = decl.getPrefix();
String declNamespace = child.getNamespaceForPrefix(prefix);
if (namespace.equals(declNamespace))
{
return decl;
}
}
}
}
return null;
} | java | private ElemExtensionDecl getElemExtensionDecl(StylesheetRoot stylesheet,
String namespace)
{
ElemExtensionDecl decl = null;
int n = stylesheet.getGlobalImportCount();
for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getGlobalImport(i);
for (ElemTemplateElement child = imported.getFirstChildElem();
child != null; child = child.getNextSiblingElem())
{
if (Constants.ELEMNAME_EXTENSIONDECL == child.getXSLToken())
{
decl = (ElemExtensionDecl) child;
String prefix = decl.getPrefix();
String declNamespace = child.getNamespaceForPrefix(prefix);
if (namespace.equals(declNamespace))
{
return decl;
}
}
}
}
return null;
} | [
"private",
"ElemExtensionDecl",
"getElemExtensionDecl",
"(",
"StylesheetRoot",
"stylesheet",
",",
"String",
"namespace",
")",
"{",
"ElemExtensionDecl",
"decl",
"=",
"null",
";",
"int",
"n",
"=",
"stylesheet",
".",
"getGlobalImportCount",
"(",
")",
";",
"for",
"(",... | Return the ElemExtensionDecl for this extension element
@param stylesheet Stylesheet root associated with this extension element
@param namespace Namespace associated with this extension element
@return the ElemExtensionDecl for this extension element. | [
"Return",
"the",
"ElemExtensionDecl",
"for",
"this",
"extension",
"element"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionCall.java#L111-L141 |
35,635 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionCall.java | ElemExtensionCall.execute | public void execute(TransformerImpl transformer)
throws TransformerException
{
if (transformer.getStylesheet().isSecureProcessing())
throw new TransformerException(
XSLMessages.createMessage(
XSLTErrorResources.ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING,
new Object[] {getRawName()}));
try
{
transformer.getResultTreeHandler().flushPending();
ExtensionsTable etable = transformer.getExtensionsTable();
ExtensionHandler nsh = etable.get(m_extns);
if (null == nsh)
{
if (hasFallbackChildren())
{
executeFallbacks(transformer);
}
else
{
TransformerException te = new TransformerException(XSLMessages.createMessage(
XSLTErrorResources.ER_CALL_TO_EXT_FAILED, new Object[]{getNodeName()}));
transformer.getErrorListener().fatalError(te);
}
return;
}
try
{
nsh.processElement(this.getLocalName(), this, transformer,
getStylesheet(), this);
}
catch (Exception e)
{
if (hasFallbackChildren())
executeFallbacks(transformer);
else
{
if(e instanceof TransformerException)
{
TransformerException te = (TransformerException)e;
if(null == te.getLocator())
te.setLocator(this);
transformer.getErrorListener().fatalError(te);
}
else if (e instanceof RuntimeException)
{
transformer.getErrorListener().fatalError(new TransformerException(e));
}
else
{
transformer.getErrorListener().warning(new TransformerException(e));
}
}
}
}
catch(TransformerException e)
{
transformer.getErrorListener().fatalError(e);
}
catch(SAXException se) {
throw new TransformerException(se);
}
} | java | public void execute(TransformerImpl transformer)
throws TransformerException
{
if (transformer.getStylesheet().isSecureProcessing())
throw new TransformerException(
XSLMessages.createMessage(
XSLTErrorResources.ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING,
new Object[] {getRawName()}));
try
{
transformer.getResultTreeHandler().flushPending();
ExtensionsTable etable = transformer.getExtensionsTable();
ExtensionHandler nsh = etable.get(m_extns);
if (null == nsh)
{
if (hasFallbackChildren())
{
executeFallbacks(transformer);
}
else
{
TransformerException te = new TransformerException(XSLMessages.createMessage(
XSLTErrorResources.ER_CALL_TO_EXT_FAILED, new Object[]{getNodeName()}));
transformer.getErrorListener().fatalError(te);
}
return;
}
try
{
nsh.processElement(this.getLocalName(), this, transformer,
getStylesheet(), this);
}
catch (Exception e)
{
if (hasFallbackChildren())
executeFallbacks(transformer);
else
{
if(e instanceof TransformerException)
{
TransformerException te = (TransformerException)e;
if(null == te.getLocator())
te.setLocator(this);
transformer.getErrorListener().fatalError(te);
}
else if (e instanceof RuntimeException)
{
transformer.getErrorListener().fatalError(new TransformerException(e));
}
else
{
transformer.getErrorListener().warning(new TransformerException(e));
}
}
}
}
catch(TransformerException e)
{
transformer.getErrorListener().fatalError(e);
}
catch(SAXException se) {
throw new TransformerException(se);
}
} | [
"public",
"void",
"execute",
"(",
"TransformerImpl",
"transformer",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"transformer",
".",
"getStylesheet",
"(",
")",
".",
"isSecureProcessing",
"(",
")",
")",
"throw",
"new",
"TransformerException",
"(",
"XSLMes... | Execute an extension.
@param transformer non-null reference to the the current transform-time state.
@throws TransformerException | [
"Execute",
"an",
"extension",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionCall.java#L198-L268 |
35,636 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java | Normalizer.normalize | @Deprecated
public static String normalize(int char32, Mode mode, int options) {
if(mode == NFD && options == 0) {
String decomposition = Normalizer2.getNFCInstance().getDecomposition(char32);
if(decomposition == null) {
decomposition = UTF16.valueOf(char32);
}
return decomposition;
}
return normalize(UTF16.valueOf(char32), mode, options);
} | java | @Deprecated
public static String normalize(int char32, Mode mode, int options) {
if(mode == NFD && options == 0) {
String decomposition = Normalizer2.getNFCInstance().getDecomposition(char32);
if(decomposition == null) {
decomposition = UTF16.valueOf(char32);
}
return decomposition;
}
return normalize(UTF16.valueOf(char32), mode, options);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"normalize",
"(",
"int",
"char32",
",",
"Mode",
"mode",
",",
"int",
"options",
")",
"{",
"if",
"(",
"mode",
"==",
"NFD",
"&&",
"options",
"==",
"0",
")",
"{",
"String",
"decomposition",
"=",
"Normalizer2",... | Normalize a codepoint according to the given mode
@param char32 The input string to be normalized.
@param mode The normalization mode
@param options Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2
@return String The normalized string
@see #UNICODE_3_2
@deprecated ICU 56 Use {@link Normalizer2} instead.
@hide original deprecated declaration | [
"Normalize",
"a",
"codepoint",
"according",
"to",
"the",
"given",
"mode"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L946-L956 |
35,637 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java | Normalizer.current | @Deprecated
public int current() {
if(bufferPos<buffer.length() || nextNormalize()) {
return buffer.codePointAt(bufferPos);
} else {
return DONE;
}
} | java | @Deprecated
public int current() {
if(bufferPos<buffer.length() || nextNormalize()) {
return buffer.codePointAt(bufferPos);
} else {
return DONE;
}
} | [
"@",
"Deprecated",
"public",
"int",
"current",
"(",
")",
"{",
"if",
"(",
"bufferPos",
"<",
"buffer",
".",
"length",
"(",
")",
"||",
"nextNormalize",
"(",
")",
")",
"{",
"return",
"buffer",
".",
"codePointAt",
"(",
"bufferPos",
")",
";",
"}",
"else",
... | Return the current character in the normalized text.
@return The codepoint as an int
@deprecated ICU 56
@hide original deprecated declaration | [
"Return",
"the",
"current",
"character",
"in",
"the",
"normalized",
"text",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1520-L1527 |
35,638 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringReplacer.java | StringReplacer.addReplacementSetTo | @Override
public void addReplacementSetTo(UnicodeSet toUnionTo) {
int ch;
for (int i=0; i<output.length(); i+=UTF16.getCharCount(ch)) {
ch = UTF16.charAt(output, i);
UnicodeReplacer r = data.lookupReplacer(ch);
if (r == null) {
toUnionTo.add(ch);
} else {
r.addReplacementSetTo(toUnionTo);
}
}
} | java | @Override
public void addReplacementSetTo(UnicodeSet toUnionTo) {
int ch;
for (int i=0; i<output.length(); i+=UTF16.getCharCount(ch)) {
ch = UTF16.charAt(output, i);
UnicodeReplacer r = data.lookupReplacer(ch);
if (r == null) {
toUnionTo.add(ch);
} else {
r.addReplacementSetTo(toUnionTo);
}
}
} | [
"@",
"Override",
"public",
"void",
"addReplacementSetTo",
"(",
"UnicodeSet",
"toUnionTo",
")",
"{",
"int",
"ch",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"output",
".",
"length",
"(",
")",
";",
"i",
"+=",
"UTF16",
".",
"getCharCount",
"(... | Union the set of all characters that may output by this object
into the given set.
@param toUnionTo the set into which to union the output characters | [
"Union",
"the",
"set",
"of",
"all",
"characters",
"that",
"may",
"output",
"by",
"this",
"object",
"into",
"the",
"given",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringReplacer.java#L324-L336 |
35,639 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/provider/CalendarDataUtility.java | CalendarDataUtility.retrieveFieldValueName | public static String retrieveFieldValueName(String id, int field, int value, int style,
Locale locale) {
// Android-changed: delegate to ICU.
if (field == Calendar.ERA) {
// For era the field value does not always equal the index into the names array.
switch (normalizeCalendarType(id)) {
// These calendars have only one era, but represented it by the value 1.
case BUDDHIST_CALENDAR:
case ISLAMIC_CALENDAR:
value -= 1;
break;
case JAPANESE_CALENDAR:
// CLDR contains full data for historical eras, java.time only supports the 4
// modern eras and numbers the modern eras starting with 1 (MEIJI). There are
// 232 historical eras in CLDR/ICU so to get the real offset, we add 231.
value += 231;
break;
default:
// Other eras use 0-based values (e.g. 0=BCE, 1=CE for gregorian).
break;
}
}
if (value < 0) {
return null;
}
String[] names = getNames(id, field, style, locale);
if (value >= names.length) {
return null;
}
return names[value];
} | java | public static String retrieveFieldValueName(String id, int field, int value, int style,
Locale locale) {
// Android-changed: delegate to ICU.
if (field == Calendar.ERA) {
// For era the field value does not always equal the index into the names array.
switch (normalizeCalendarType(id)) {
// These calendars have only one era, but represented it by the value 1.
case BUDDHIST_CALENDAR:
case ISLAMIC_CALENDAR:
value -= 1;
break;
case JAPANESE_CALENDAR:
// CLDR contains full data for historical eras, java.time only supports the 4
// modern eras and numbers the modern eras starting with 1 (MEIJI). There are
// 232 historical eras in CLDR/ICU so to get the real offset, we add 231.
value += 231;
break;
default:
// Other eras use 0-based values (e.g. 0=BCE, 1=CE for gregorian).
break;
}
}
if (value < 0) {
return null;
}
String[] names = getNames(id, field, style, locale);
if (value >= names.length) {
return null;
}
return names[value];
} | [
"public",
"static",
"String",
"retrieveFieldValueName",
"(",
"String",
"id",
",",
"int",
"field",
",",
"int",
"value",
",",
"int",
"style",
",",
"Locale",
"locale",
")",
"{",
"// Android-changed: delegate to ICU.",
"if",
"(",
"field",
"==",
"Calendar",
".",
"E... | use libcore.icu.LocaleData or android.icu.util.Calendar.WeekData instead | [
"use",
"libcore",
".",
"icu",
".",
"LocaleData",
"or",
"android",
".",
"icu",
".",
"util",
".",
"Calendar",
".",
"WeekData",
"instead"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/provider/CalendarDataUtility.java#L58-L88 |
35,640 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java | ToSAXHandler.setContentHandler | public void setContentHandler(ContentHandler _saxHandler)
{
this.m_saxHandler = _saxHandler;
if (m_lexHandler == null && _saxHandler instanceof LexicalHandler)
{
// we are not overwriting an existing LexicalHandler, and _saxHandler
// is also implements LexicalHandler, so lets use it
m_lexHandler = (LexicalHandler) _saxHandler;
}
} | java | public void setContentHandler(ContentHandler _saxHandler)
{
this.m_saxHandler = _saxHandler;
if (m_lexHandler == null && _saxHandler instanceof LexicalHandler)
{
// we are not overwriting an existing LexicalHandler, and _saxHandler
// is also implements LexicalHandler, so lets use it
m_lexHandler = (LexicalHandler) _saxHandler;
}
} | [
"public",
"void",
"setContentHandler",
"(",
"ContentHandler",
"_saxHandler",
")",
"{",
"this",
".",
"m_saxHandler",
"=",
"_saxHandler",
";",
"if",
"(",
"m_lexHandler",
"==",
"null",
"&&",
"_saxHandler",
"instanceof",
"LexicalHandler",
")",
"{",
"// we are not overwr... | Sets the SAX ContentHandler.
@param _saxHandler The ContentHandler to set | [
"Sets",
"the",
"SAX",
"ContentHandler",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java#L221-L230 |
35,641 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java | ToSAXHandler.startElement | public void startElement(String uri, String localName, String qName)
throws SAXException {
if (m_state != null) {
m_state.resetState(getTransformer());
}
// fire off the start element event
if (m_tracer != null)
super.fireStartElem(qName);
} | java | public void startElement(String uri, String localName, String qName)
throws SAXException {
if (m_state != null) {
m_state.resetState(getTransformer());
}
// fire off the start element event
if (m_tracer != null)
super.fireStartElem(qName);
} | [
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"m_state",
"!=",
"null",
")",
"{",
"m_state",
".",
"resetState",
"(",
"getTransformer",
"(",
")",
")"... | Receives notification that an element starts, but attributes are not
fully known yet.
@param uri the URI of the namespace of the element (optional)
@param localName the element name, but without prefix (optional)
@param qName the element name, with prefix, if any (required)
@see ExtendedContentHandler#startElement(String, String, String) | [
"Receives",
"notification",
"that",
"an",
"element",
"starts",
"but",
"attributes",
"are",
"not",
"fully",
"known",
"yet",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java#L313-L323 |
35,642 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java | ToSAXHandler.characters | public void characters(org.w3c.dom.Node node)
throws org.xml.sax.SAXException
{
// remember the current node
if (m_state != null)
{
m_state.setCurrentNode(node);
}
// Get the node's value as a String and use that String as if
// it were an input character notification.
String data = node.getNodeValue();
if (data != null) {
this.characters(data);
}
} | java | public void characters(org.w3c.dom.Node node)
throws org.xml.sax.SAXException
{
// remember the current node
if (m_state != null)
{
m_state.setCurrentNode(node);
}
// Get the node's value as a String and use that String as if
// it were an input character notification.
String data = node.getNodeValue();
if (data != null) {
this.characters(data);
}
} | [
"public",
"void",
"characters",
"(",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"node",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"// remember the current node",
"if",
"(",
"m_state",
"!=",
"null",
")",
"{",
"m_state",
".",... | This method gets the node's value as a String and uses that String as if
it were an input character notification.
@param node the Node to serialize
@throws org.xml.sax.SAXException | [
"This",
"method",
"gets",
"the",
"node",
"s",
"value",
"as",
"a",
"String",
"and",
"uses",
"that",
"String",
"as",
"if",
"it",
"were",
"an",
"input",
"character",
"notification",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java#L347-L362 |
35,643 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java | ToSAXHandler.addUniqueAttribute | public void addUniqueAttribute(String qName, String value, int flags)
throws SAXException
{
addAttribute(qName, value);
} | java | public void addUniqueAttribute(String qName, String value, int flags)
throws SAXException
{
addAttribute(qName, value);
} | [
"public",
"void",
"addUniqueAttribute",
"(",
"String",
"qName",
",",
"String",
"value",
",",
"int",
"flags",
")",
"throws",
"SAXException",
"{",
"addAttribute",
"(",
"qName",
",",
"value",
")",
";",
"}"
] | Add a unique attribute | [
"Add",
"a",
"unique",
"attribute"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToSAXHandler.java#L433-L437 |
35,644 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.findTopLevel | @Deprecated
protected UResourceBundle findTopLevel(String aKey) {
// NOTE: this only works for top-level resources. For resources at lower
// levels, it fails when you fall back to the parent, since you're now
// looking at root resources, not at the corresponding nested resource.
for (UResourceBundle res = this; res != null; res = res.getParent()) {
UResourceBundle obj = res.handleGet(aKey, null, this);
if (obj != null) {
return obj;
}
}
return null;
} | java | @Deprecated
protected UResourceBundle findTopLevel(String aKey) {
// NOTE: this only works for top-level resources. For resources at lower
// levels, it fails when you fall back to the parent, since you're now
// looking at root resources, not at the corresponding nested resource.
for (UResourceBundle res = this; res != null; res = res.getParent()) {
UResourceBundle obj = res.handleGet(aKey, null, this);
if (obj != null) {
return obj;
}
}
return null;
} | [
"@",
"Deprecated",
"protected",
"UResourceBundle",
"findTopLevel",
"(",
"String",
"aKey",
")",
"{",
"// NOTE: this only works for top-level resources. For resources at lower",
"// levels, it fails when you fall back to the parent, since you're now",
"// looking at root resources, not at the... | Returns a resource in a given resource that has a given key, or null if the
resource is not found.
@param aKey the key associated with the wanted resource
@return the resource, or null
@see #get(String)
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"a",
"resource",
"in",
"a",
"given",
"resource",
"that",
"has",
"a",
"given",
"key",
"or",
"null",
"if",
"the",
"resource",
"is",
"not",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L506-L518 |
35,645 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.getString | public String getString(int index) {
ICUResourceBundle temp = (ICUResourceBundle)get(index);
if (temp.getType() == STRING) {
return temp.getString();
}
throw new UResourceTypeMismatchException("");
} | java | public String getString(int index) {
ICUResourceBundle temp = (ICUResourceBundle)get(index);
if (temp.getType() == STRING) {
return temp.getString();
}
throw new UResourceTypeMismatchException("");
} | [
"public",
"String",
"getString",
"(",
"int",
"index",
")",
"{",
"ICUResourceBundle",
"temp",
"=",
"(",
"ICUResourceBundle",
")",
"get",
"(",
"index",
")",
";",
"if",
"(",
"temp",
".",
"getType",
"(",
")",
"==",
"STRING",
")",
"{",
"return",
"temp",
"."... | Returns the string in a given resource at the specified index.
@param index an index to the wanted string.
@return a string which lives in the resource.
@throws IndexOutOfBoundsException If the index value is out of bounds of accepted values.
@throws UResourceTypeMismatchException If resource bundle type mismatch. | [
"Returns",
"the",
"string",
"in",
"a",
"given",
"resource",
"at",
"the",
"specified",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L528-L534 |
35,646 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.findTopLevel | @Deprecated
protected UResourceBundle findTopLevel(int index) {
// NOTE: this _barely_ works for top-level resources. For resources at lower
// levels, it fails when you fall back to the parent, since you're now
// looking at root resources, not at the corresponding nested resource.
// Not only that, but unless the indices correspond 1-to-1, the index will
// lose meaning. Essentially this only works if the child resource arrays
// are prefixes of their parent arrays.
for (UResourceBundle res = this; res != null; res = res.getParent()) {
UResourceBundle obj = res.handleGet(index, null, this);
if (obj != null) {
return obj;
}
}
return null;
} | java | @Deprecated
protected UResourceBundle findTopLevel(int index) {
// NOTE: this _barely_ works for top-level resources. For resources at lower
// levels, it fails when you fall back to the parent, since you're now
// looking at root resources, not at the corresponding nested resource.
// Not only that, but unless the indices correspond 1-to-1, the index will
// lose meaning. Essentially this only works if the child resource arrays
// are prefixes of their parent arrays.
for (UResourceBundle res = this; res != null; res = res.getParent()) {
UResourceBundle obj = res.handleGet(index, null, this);
if (obj != null) {
return obj;
}
}
return null;
} | [
"@",
"Deprecated",
"protected",
"UResourceBundle",
"findTopLevel",
"(",
"int",
"index",
")",
"{",
"// NOTE: this _barely_ works for top-level resources. For resources at lower",
"// levels, it fails when you fall back to the parent, since you're now",
"// looking at root resources, not at t... | Returns a resource in a given resource that has a given index, or null if the
resource is not found.
@param index the index of the resource
@return the resource, or null
@see #get(int)
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"a",
"resource",
"in",
"a",
"given",
"resource",
"that",
"has",
"a",
"given",
"index",
"or",
"null",
"if",
"the",
"resource",
"is",
"not",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L570-L585 |
35,647 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.keySet | @Override
@Deprecated
public Set<String> keySet() {
// TODO: Java 6 ResourceBundle has keySet() which calls handleKeySet()
// and caches the results.
// When we upgrade to Java 6, we still need to check for isTopLevelResource().
// Keep the else branch as is. The if body should just return super.keySet().
// Remove then-redundant caching of the keys.
Set<String> keys = null;
ICUResourceBundle icurb = null;
if(isTopLevelResource() && this instanceof ICUResourceBundle) {
// We do not cache the top-level keys in this base class so that
// not every string/int/binary... resource has to have a keys cache field.
icurb = (ICUResourceBundle)this;
keys = icurb.getTopLevelKeySet();
}
if(keys == null) {
if(isTopLevelResource()) {
TreeSet<String> newKeySet;
if(parent == null) {
newKeySet = new TreeSet<String>();
} else if(parent instanceof UResourceBundle) {
newKeySet = new TreeSet<String>(((UResourceBundle)parent).keySet());
} else {
// TODO: Java 6 ResourceBundle has keySet(); use it when we upgrade to Java 6
// and remove this else branch.
newKeySet = new TreeSet<String>();
Enumeration<String> parentKeys = parent.getKeys();
while(parentKeys.hasMoreElements()) {
newKeySet.add(parentKeys.nextElement());
}
}
newKeySet.addAll(handleKeySet());
keys = Collections.unmodifiableSet(newKeySet);
if(icurb != null) {
icurb.setTopLevelKeySet(keys);
}
} else {
return handleKeySet();
}
}
return keys;
} | java | @Override
@Deprecated
public Set<String> keySet() {
// TODO: Java 6 ResourceBundle has keySet() which calls handleKeySet()
// and caches the results.
// When we upgrade to Java 6, we still need to check for isTopLevelResource().
// Keep the else branch as is. The if body should just return super.keySet().
// Remove then-redundant caching of the keys.
Set<String> keys = null;
ICUResourceBundle icurb = null;
if(isTopLevelResource() && this instanceof ICUResourceBundle) {
// We do not cache the top-level keys in this base class so that
// not every string/int/binary... resource has to have a keys cache field.
icurb = (ICUResourceBundle)this;
keys = icurb.getTopLevelKeySet();
}
if(keys == null) {
if(isTopLevelResource()) {
TreeSet<String> newKeySet;
if(parent == null) {
newKeySet = new TreeSet<String>();
} else if(parent instanceof UResourceBundle) {
newKeySet = new TreeSet<String>(((UResourceBundle)parent).keySet());
} else {
// TODO: Java 6 ResourceBundle has keySet(); use it when we upgrade to Java 6
// and remove this else branch.
newKeySet = new TreeSet<String>();
Enumeration<String> parentKeys = parent.getKeys();
while(parentKeys.hasMoreElements()) {
newKeySet.add(parentKeys.nextElement());
}
}
newKeySet.addAll(handleKeySet());
keys = Collections.unmodifiableSet(newKeySet);
if(icurb != null) {
icurb.setTopLevelKeySet(keys);
}
} else {
return handleKeySet();
}
}
return keys;
} | [
"@",
"Override",
"@",
"Deprecated",
"public",
"Set",
"<",
"String",
">",
"keySet",
"(",
")",
"{",
"// TODO: Java 6 ResourceBundle has keySet() which calls handleKeySet()",
"// and caches the results.",
"// When we upgrade to Java 6, we still need to check for isTopLevelResource().",
... | Returns a Set of all keys contained in this ResourceBundle and its parent bundles.
@return a Set of all keys contained in this ResourceBundle and its parent bundles,
which is empty if this is not a bundle or a table resource
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"a",
"Set",
"of",
"all",
"keys",
"contained",
"in",
"this",
"ResourceBundle",
"and",
"its",
"parent",
"bundles",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L604-L646 |
35,648 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.handleGetObjectImpl | private Object handleGetObjectImpl(String aKey, UResourceBundle requested) {
Object obj = resolveObject(aKey, requested);
if (obj == null) {
UResourceBundle parentBundle = getParent();
if (parentBundle != null) {
obj = parentBundle.handleGetObjectImpl(aKey, requested);
}
if (obj == null)
throw new MissingResourceException(
"Can't find resource for bundle "
+ this.getClass().getName() + ", key " + aKey,
this.getClass().getName(), aKey);
}
return obj;
} | java | private Object handleGetObjectImpl(String aKey, UResourceBundle requested) {
Object obj = resolveObject(aKey, requested);
if (obj == null) {
UResourceBundle parentBundle = getParent();
if (parentBundle != null) {
obj = parentBundle.handleGetObjectImpl(aKey, requested);
}
if (obj == null)
throw new MissingResourceException(
"Can't find resource for bundle "
+ this.getClass().getName() + ", key " + aKey,
this.getClass().getName(), aKey);
}
return obj;
} | [
"private",
"Object",
"handleGetObjectImpl",
"(",
"String",
"aKey",
",",
"UResourceBundle",
"requested",
")",
"{",
"Object",
"obj",
"=",
"resolveObject",
"(",
"aKey",
",",
"requested",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"UResourceBundle",
"pa... | done twice before throwing a MissingResourceExpection. | [
"done",
"twice",
"before",
"throwing",
"a",
"MissingResourceExpection",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L822-L836 |
35,649 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java | UResourceBundle.resolveObject | private Object resolveObject(String aKey, UResourceBundle requested) {
if (getType() == STRING) {
return getString();
}
UResourceBundle obj = handleGet(aKey, null, requested);
if (obj != null) {
if (obj.getType() == STRING) {
return obj.getString();
}
try {
if (obj.getType() == ARRAY) {
return obj.handleGetStringArray();
}
} catch (UResourceTypeMismatchException ex) {
return obj;
}
}
return obj;
} | java | private Object resolveObject(String aKey, UResourceBundle requested) {
if (getType() == STRING) {
return getString();
}
UResourceBundle obj = handleGet(aKey, null, requested);
if (obj != null) {
if (obj.getType() == STRING) {
return obj.getString();
}
try {
if (obj.getType() == ARRAY) {
return obj.handleGetStringArray();
}
} catch (UResourceTypeMismatchException ex) {
return obj;
}
}
return obj;
} | [
"private",
"Object",
"resolveObject",
"(",
"String",
"aKey",
",",
"UResourceBundle",
"requested",
")",
"{",
"if",
"(",
"getType",
"(",
")",
"==",
"STRING",
")",
"{",
"return",
"getString",
"(",
")",
";",
"}",
"UResourceBundle",
"obj",
"=",
"handleGet",
"("... | string or string array | [
"string",
"or",
"string",
"array"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundle.java#L840-L858 |
35,650 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/client/HttpClient.java | HttpClient.newClient | public static HttpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
return newClient(new InetSocketAddress(host, port));
} | java | public static HttpClient<ByteBuf, ByteBuf> newClient(String host, int port) {
return newClient(new InetSocketAddress(host, port));
} | [
"public",
"static",
"HttpClient",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"newClient",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"newClient",
"(",
"new",
"InetSocketAddress",
"(",
"host",
",",
"port",
")",
")",
";",
"}"
] | Creates a new HTTP client instance with the passed host and port for the target server.
@param host Hostname for the target server.
@param port Port for the target server.
@return A new {@code HttpClient} instance. | [
"Creates",
"a",
"new",
"HTTP",
"client",
"instance",
"with",
"the",
"passed",
"host",
"and",
"port",
"for",
"the",
"target",
"server",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/client/HttpClient.java#L316-L318 |
35,651 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/client/HttpClient.java | HttpClient.newClient | public static HttpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
Observable<Host> hostStream) {
return HttpClientImpl.create(providerFactory, hostStream);
} | java | public static HttpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
Observable<Host> hostStream) {
return HttpClientImpl.create(providerFactory, hostStream);
} | [
"public",
"static",
"HttpClient",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"newClient",
"(",
"ConnectionProviderFactory",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"providerFactory",
",",
"Observable",
"<",
"Host",
">",
"hostStream",
")",
"{",
"return",
"HttpClientImpl",
... | Creates a new HTTP client instance using the supplied connection provider.
@param providerFactory {@link ConnectionProviderFactory} for the client.
@param hostStream Stream of hosts for the client.
@return A new {@code HttpClient} instance. | [
"Creates",
"a",
"new",
"HTTP",
"client",
"instance",
"using",
"the",
"supplied",
"connection",
"provider",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/client/HttpClient.java#L339-L342 |
35,652 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServerInterceptorChain.java | HttpServerInterceptorChain.start | public static <R, W> HttpServerInterceptorChain<R, W, R, W> start() {
return new HttpServerInterceptorChain<>(new TransformingInterceptor<R, W, R, W>() {
@Override
public RequestHandler<R, W> intercept(RequestHandler<R, W> handler) {
return handler;
}
});
} | java | public static <R, W> HttpServerInterceptorChain<R, W, R, W> start() {
return new HttpServerInterceptorChain<>(new TransformingInterceptor<R, W, R, W>() {
@Override
public RequestHandler<R, W> intercept(RequestHandler<R, W> handler) {
return handler;
}
});
} | [
"public",
"static",
"<",
"R",
",",
"W",
">",
"HttpServerInterceptorChain",
"<",
"R",
",",
"W",
",",
"R",
",",
"W",
">",
"start",
"(",
")",
"{",
"return",
"new",
"HttpServerInterceptorChain",
"<>",
"(",
"new",
"TransformingInterceptor",
"<",
"R",
",",
"W"... | Starts a new interceptor chain.
@return A new interceptor chain. | [
"Starts",
"a",
"new",
"interceptor",
"chain",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServerInterceptorChain.java#L205-L212 |
35,653 | ReactiveX/RxNetty | rxnetty-examples/src/main/java/io/reactivex/netty/examples/tcp/interceptors/simple/InterceptingServer.java | InterceptingServer.sendHello | private static Interceptor<ByteBuf, ByteBuf> sendHello() {
return in -> newConnection -> newConnection.writeString(Observable.just("Hello\n"))
.concatWith(in.handle(newConnection));
} | java | private static Interceptor<ByteBuf, ByteBuf> sendHello() {
return in -> newConnection -> newConnection.writeString(Observable.just("Hello\n"))
.concatWith(in.handle(newConnection));
} | [
"private",
"static",
"Interceptor",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"sendHello",
"(",
")",
"{",
"return",
"in",
"->",
"newConnection",
"->",
"newConnection",
".",
"writeString",
"(",
"Observable",
".",
"just",
"(",
"\"Hello\\n\"",
")",
")",
".",
"concat... | Sends a hello on accepting a new connection. | [
"Sends",
"a",
"hello",
"on",
"accepting",
"a",
"new",
"connection",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-examples/src/main/java/io/reactivex/netty/examples/tcp/interceptors/simple/InterceptingServer.java#L70-L73 |
35,654 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java | TrailingHeaders.setHeader | public TrailingHeaders setHeader(CharSequence name, Object value) {
lastHttpContent.trailingHeaders().set(name, value);
return this;
} | java | public TrailingHeaders setHeader(CharSequence name, Object value) {
lastHttpContent.trailingHeaders().set(name, value);
return this;
} | [
"public",
"TrailingHeaders",
"setHeader",
"(",
"CharSequence",
"name",
",",
"Object",
"value",
")",
"{",
"lastHttpContent",
".",
"trailingHeaders",
"(",
")",
".",
"set",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Overwrites the current value, if any, of the passed trailing header to the passed value for this request.
@param name Name of the header.
@param value Value of the header.
@return {@code this}. | [
"Overwrites",
"the",
"current",
"value",
"if",
"any",
"of",
"the",
"passed",
"trailing",
"header",
"to",
"the",
"passed",
"value",
"for",
"this",
"request",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java#L75-L78 |
35,655 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java | TrailingHeaders.setHeader | public TrailingHeaders setHeader(CharSequence name, Iterable<Object> values) {
lastHttpContent.trailingHeaders().set(name, values);
return this;
} | java | public TrailingHeaders setHeader(CharSequence name, Iterable<Object> values) {
lastHttpContent.trailingHeaders().set(name, values);
return this;
} | [
"public",
"TrailingHeaders",
"setHeader",
"(",
"CharSequence",
"name",
",",
"Iterable",
"<",
"Object",
">",
"values",
")",
"{",
"lastHttpContent",
".",
"trailingHeaders",
"(",
")",
".",
"set",
"(",
"name",
",",
"values",
")",
";",
"return",
"this",
";",
"}... | Overwrites the current value, if any, of the passed trailing header to the passed values for this request.
@param name Name of the header.
@param values Values of the header.
@return {@code this}. | [
"Overwrites",
"the",
"current",
"value",
"if",
"any",
"of",
"the",
"passed",
"trailing",
"header",
"to",
"the",
"passed",
"values",
"for",
"this",
"request",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java#L88-L91 |
35,656 | ReactiveX/RxNetty | rxnetty-common/src/main/java/io/reactivex/netty/channel/DisposableContentSource.java | DisposableContentSource.dispose | public void dispose() {
if (onSubscribe.disposed.compareAndSet(false, true)) {
for (Object chunk : onSubscribe.chunks) {
ReferenceCountUtil.release(chunk);
}
onSubscribe.chunks.clear();
}
} | java | public void dispose() {
if (onSubscribe.disposed.compareAndSet(false, true)) {
for (Object chunk : onSubscribe.chunks) {
ReferenceCountUtil.release(chunk);
}
onSubscribe.chunks.clear();
}
} | [
"public",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"onSubscribe",
".",
"disposed",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"for",
"(",
"Object",
"chunk",
":",
"onSubscribe",
".",
"chunks",
")",
"{",
"ReferenceCountUtil",
".",
... | Disposes this source. | [
"Disposes",
"this",
"source",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/channel/DisposableContentSource.java#L74-L81 |
35,657 | ReactiveX/RxNetty | rxnetty-common/src/main/java/io/reactivex/netty/client/pool/PooledConnection.java | PooledConnection.reuse | public void reuse(Subscriber<? super PooledConnection<R, W>> connectionSubscriber) {
unsafeNettyChannel().pipeline().fireUserEventTriggered(new ConnectionReuseEvent<>(connectionSubscriber, this));
} | java | public void reuse(Subscriber<? super PooledConnection<R, W>> connectionSubscriber) {
unsafeNettyChannel().pipeline().fireUserEventTriggered(new ConnectionReuseEvent<>(connectionSubscriber, this));
} | [
"public",
"void",
"reuse",
"(",
"Subscriber",
"<",
"?",
"super",
"PooledConnection",
"<",
"R",
",",
"W",
">",
">",
"connectionSubscriber",
")",
"{",
"unsafeNettyChannel",
"(",
")",
".",
"pipeline",
"(",
")",
".",
"fireUserEventTriggered",
"(",
"new",
"Connec... | This method must be called for reusing the connection i.e. for sending this connection to the passed subscriber.
@param connectionSubscriber Subscriber for the pooled connection for reuse. | [
"This",
"method",
"must",
"be",
"called",
"for",
"reusing",
"the",
"connection",
"i",
".",
"e",
".",
"for",
"sending",
"this",
"connection",
"to",
"the",
"passed",
"subscriber",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/client/pool/PooledConnection.java#L314-L316 |
35,658 | ReactiveX/RxNetty | rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/client/TcpClient.java | TcpClient.newClient | public static TcpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
Observable<Host> hostStream) {
return TcpClientImpl.create(providerFactory, hostStream);
} | java | public static TcpClient<ByteBuf, ByteBuf> newClient(ConnectionProviderFactory<ByteBuf, ByteBuf> providerFactory,
Observable<Host> hostStream) {
return TcpClientImpl.create(providerFactory, hostStream);
} | [
"public",
"static",
"TcpClient",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"newClient",
"(",
"ConnectionProviderFactory",
"<",
"ByteBuf",
",",
"ByteBuf",
">",
"providerFactory",
",",
"Observable",
"<",
"Host",
">",
"hostStream",
")",
"{",
"return",
"TcpClientImpl",
"... | Creates a new TCP client instance using the supplied connection provider.
@param providerFactory {@link ConnectionProviderFactory} for the client.
@param hostStream Stream of hosts for the client.
@return A new {@code TcpClient} instance. | [
"Creates",
"a",
"new",
"TCP",
"client",
"instance",
"using",
"the",
"supplied",
"connection",
"provider",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/client/TcpClient.java#L357-L360 |
35,659 | ReactiveX/RxNetty | rxnetty-common/src/main/java/io/reactivex/netty/channel/Connection.java | Connection.ignoreInput | public Observable<Void> ignoreInput() {
return getInput().map(new Func1<R, Void>() {
@Override
public Void call(R r) {
ReferenceCountUtil.release(r);
return null;
}
}).ignoreElements();
} | java | public Observable<Void> ignoreInput() {
return getInput().map(new Func1<R, Void>() {
@Override
public Void call(R r) {
ReferenceCountUtil.release(r);
return null;
}
}).ignoreElements();
} | [
"public",
"Observable",
"<",
"Void",
">",
"ignoreInput",
"(",
")",
"{",
"return",
"getInput",
"(",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"R",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"R",
"r",
")",
"{"... | Ignores all input on this connection.
Unless, {@link ChannelOption#AUTO_READ} is set to {@code true}, the content will only be read from the
underneath channel, if there is a subscriber to the input. So, upon recieving this connection, either one should
call this method or eventually subscribe to the stream returned by {@link #getInput()}
@return An {@link Observable}, subscription to which will discard the input. This {@code Observable} will
error/complete when the input errors/completes and unsubscription from here will unsubscribe from the content. | [
"Ignores",
"all",
"input",
"on",
"this",
"connection",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/channel/Connection.java#L104-L112 |
35,660 | ReactiveX/RxNetty | rxnetty-common/src/main/java/io/reactivex/netty/client/pool/CompositePoolLimitDeterminationStrategy.java | CompositePoolLimitDeterminationStrategy.getAvailablePermits | @Override
public int getAvailablePermits() {
int minPermits = Integer.MAX_VALUE;
for (PoolLimitDeterminationStrategy strategy : strategies) {
int availablePermits = strategy.getAvailablePermits();
minPermits = Math.min(minPermits, availablePermits);
}
return minPermits; // If will atleast be one strategy (invariant in constructor) and hence this should be the value provided by that strategy.
} | java | @Override
public int getAvailablePermits() {
int minPermits = Integer.MAX_VALUE;
for (PoolLimitDeterminationStrategy strategy : strategies) {
int availablePermits = strategy.getAvailablePermits();
minPermits = Math.min(minPermits, availablePermits);
}
return minPermits; // If will atleast be one strategy (invariant in constructor) and hence this should be the value provided by that strategy.
} | [
"@",
"Override",
"public",
"int",
"getAvailablePermits",
"(",
")",
"{",
"int",
"minPermits",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"for",
"(",
"PoolLimitDeterminationStrategy",
"strategy",
":",
"strategies",
")",
"{",
"int",
"availablePermits",
"=",
"strategy",
... | Returns the minimum number of permits available across all strategies.
@return The minimum number of permits available across all strategies. | [
"Returns",
"the",
"minimum",
"number",
"of",
"permits",
"available",
"across",
"all",
"strategies",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/client/pool/CompositePoolLimitDeterminationStrategy.java#L59-L67 |
35,661 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/UriInfoHolder.java | UriInfoHolder.getPath | private static String getPath(String uri) {
int offset = 0;
if (uri.startsWith("http://")) {
offset = "http://".length();
} else if (uri.startsWith("https://")) {
offset = "https://".length();
}
if (offset == 0) {
return uri;
} else {
int firstSlash = uri.indexOf('/', offset);
return -1 != firstSlash? uri.substring(firstSlash) : uri;
}
} | java | private static String getPath(String uri) {
int offset = 0;
if (uri.startsWith("http://")) {
offset = "http://".length();
} else if (uri.startsWith("https://")) {
offset = "https://".length();
}
if (offset == 0) {
return uri;
} else {
int firstSlash = uri.indexOf('/', offset);
return -1 != firstSlash? uri.substring(firstSlash) : uri;
}
} | [
"private",
"static",
"String",
"getPath",
"(",
"String",
"uri",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"if",
"(",
"uri",
".",
"startsWith",
"(",
"\"http://\"",
")",
")",
"{",
"offset",
"=",
"\"http://\"",
".",
"length",
"(",
")",
";",
"}",
"else",... | start of the path. | [
"start",
"of",
"the",
"path",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/UriInfoHolder.java#L48-L62 |
35,662 | ReactiveX/RxNetty | rxnetty-common/src/main/java/io/reactivex/netty/events/Clock.java | Clock.getDuration | public long getDuration(TimeUnit targetUnit) {
if (isRunning()) {
throw new IllegalStateException("The clock is not yet stopped.");
}
return targetUnit.convert(durationNanos, TimeUnit.NANOSECONDS);
} | java | public long getDuration(TimeUnit targetUnit) {
if (isRunning()) {
throw new IllegalStateException("The clock is not yet stopped.");
}
return targetUnit.convert(durationNanos, TimeUnit.NANOSECONDS);
} | [
"public",
"long",
"getDuration",
"(",
"TimeUnit",
"targetUnit",
")",
"{",
"if",
"(",
"isRunning",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The clock is not yet stopped.\"",
")",
";",
"}",
"return",
"targetUnit",
".",
"convert",
"(",
... | Returns the duration for which this clock was running in the given timeunit.
@return The duration for which this clock was running in the given timeunit.
@throws IllegalStateException If the clock is not yet stopped. | [
"Returns",
"the",
"duration",
"for",
"which",
"this",
"clock",
"was",
"running",
"in",
"the",
"given",
"timeunit",
"."
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-common/src/main/java/io/reactivex/netty/events/Clock.java#L97-L102 |
35,663 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/internal/WsUtils.java | WsUtils.sha1 | public static byte[] sha1(byte[] data) {
try {
//Attempt to get a MessageDigest that uses SHA1
MessageDigest md = MessageDigest.getInstance("SHA1");
//Hash the data
return md.digest(data);
} catch (NoSuchAlgorithmException e) {
//Alright, you might have an old system.
throw new InternalError("SHA-1 is not supported on this platform - Outdated?");
}
} | java | public static byte[] sha1(byte[] data) {
try {
//Attempt to get a MessageDigest that uses SHA1
MessageDigest md = MessageDigest.getInstance("SHA1");
//Hash the data
return md.digest(data);
} catch (NoSuchAlgorithmException e) {
//Alright, you might have an old system.
throw new InternalError("SHA-1 is not supported on this platform - Outdated?");
}
} | [
"public",
"static",
"byte",
"[",
"]",
"sha1",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"{",
"//Attempt to get a MessageDigest that uses SHA1",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA1\"",
")",
";",
"//Hash the data",
"... | Performs a SHA-1 hash on the specified data
@param data The data to hash
@return The hashed data | [
"Performs",
"a",
"SHA",
"-",
"1",
"hash",
"on",
"the",
"specified",
"data"
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/internal/WsUtils.java#L41-L51 |
35,664 | ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/internal/WsUtils.java | WsUtils.randomBytes | public static byte[] randomBytes(int size) {
byte[] bytes = new byte[size];
for (int index = 0; index < size; index++) {
bytes[index] = (byte) randomNumber(0, 255);
}
return bytes;
} | java | public static byte[] randomBytes(int size) {
byte[] bytes = new byte[size];
for (int index = 0; index < size; index++) {
bytes[index] = (byte) randomNumber(0, 255);
}
return bytes;
} | [
"public",
"static",
"byte",
"[",
"]",
"randomBytes",
"(",
"int",
"size",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"size",
";",
"index",
"++",
")",
"... | Creates an arbitrary number of random bytes
@param size the number of random bytes to create
@return An array of random bytes | [
"Creates",
"an",
"arbitrary",
"number",
"of",
"random",
"bytes"
] | a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6 | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/internal/WsUtils.java#L73-L81 |
35,665 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/util/Utils.java | Utils.isSelinuxFlagInEnabled | public static boolean isSelinuxFlagInEnabled() {
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
String selinux = (String) get.invoke(c, "ro.build.selinux");
return "1".equals(selinux);
} catch (Exception ignored) {
}
return false;
} | java | public static boolean isSelinuxFlagInEnabled() {
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
String selinux = (String) get.invoke(c, "ro.build.selinux");
return "1".equals(selinux);
} catch (Exception ignored) {
}
return false;
} | [
"public",
"static",
"boolean",
"isSelinuxFlagInEnabled",
"(",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
"Class",
".",
"forName",
"(",
"\"android.os.SystemProperties\"",
")",
";",
"Method",
"get",
"=",
"c",
".",
"getMethod",
"(",
"\"get\"",
",... | In Development - an idea of ours was to check the if selinux is enforcing - this could be disabled for some rooting apps
Checking for selinux mode
@return true if selinux enabled | [
"In",
"Development",
"-",
"an",
"idea",
"of",
"ours",
"was",
"to",
"check",
"the",
"if",
"selinux",
"is",
"enforcing",
"-",
"this",
"could",
"be",
"disabled",
"for",
"some",
"rooting",
"apps",
"Checking",
"for",
"selinux",
"mode"
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/util/Utils.java#L19-L29 |
35,666 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.isRootedWithoutBusyBoxCheck | public boolean isRootedWithoutBusyBoxCheck() {
return detectRootManagementApps() || detectPotentiallyDangerousApps() || checkForBinary(BINARY_SU)
|| checkForDangerousProps() || checkForRWPaths()
|| detectTestKeys() || checkSuExists() || checkForRootNative() || checkForMagiskBinary();
} | java | public boolean isRootedWithoutBusyBoxCheck() {
return detectRootManagementApps() || detectPotentiallyDangerousApps() || checkForBinary(BINARY_SU)
|| checkForDangerousProps() || checkForRWPaths()
|| detectTestKeys() || checkSuExists() || checkForRootNative() || checkForMagiskBinary();
} | [
"public",
"boolean",
"isRootedWithoutBusyBoxCheck",
"(",
")",
"{",
"return",
"detectRootManagementApps",
"(",
")",
"||",
"detectPotentiallyDangerousApps",
"(",
")",
"||",
"checkForBinary",
"(",
"BINARY_SU",
")",
"||",
"checkForDangerousProps",
"(",
")",
"||",
"checkFo... | Run all the checks apart from checking for the busybox binary. This is because it can sometimes be a false positive
as some manufacturers leave the binary in production builds.
@return true, we think there's a good *indication* of root | false good *indication* of no root (could still be cloaked) | [
"Run",
"all",
"the",
"checks",
"apart",
"from",
"checking",
"for",
"the",
"busybox",
"binary",
".",
"This",
"is",
"because",
"it",
"can",
"sometimes",
"be",
"a",
"false",
"positive",
"as",
"some",
"manufacturers",
"leave",
"the",
"binary",
"in",
"production"... | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L56-L61 |
35,667 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.detectRootManagementApps | public boolean detectRootManagementApps(String[] additionalRootManagementApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>(Arrays.asList(Const.knownRootAppsPackages));
if (additionalRootManagementApps!=null && additionalRootManagementApps.length>0){
packages.addAll(Arrays.asList(additionalRootManagementApps));
}
return isAnyPackageFromListInstalled(packages);
} | java | public boolean detectRootManagementApps(String[] additionalRootManagementApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>(Arrays.asList(Const.knownRootAppsPackages));
if (additionalRootManagementApps!=null && additionalRootManagementApps.length>0){
packages.addAll(Arrays.asList(additionalRootManagementApps));
}
return isAnyPackageFromListInstalled(packages);
} | [
"public",
"boolean",
"detectRootManagementApps",
"(",
"String",
"[",
"]",
"additionalRootManagementApps",
")",
"{",
"// Create a list of package names to iterate over from constants any others provided",
"ArrayList",
"<",
"String",
">",
"packages",
"=",
"new",
"ArrayList",
"<>"... | Using the PackageManager, check for a list of well known root apps. @link {Const.knownRootAppsPackages}
@param additionalRootManagementApps - array of additional packagenames to search for
@return true if one of the apps it's installed | [
"Using",
"the",
"PackageManager",
"check",
"for",
"a",
"list",
"of",
"well",
"known",
"root",
"apps",
"."
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L87-L96 |
35,668 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.detectPotentiallyDangerousApps | public boolean detectPotentiallyDangerousApps(String[] additionalDangerousApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>();
packages.addAll(Arrays.asList(Const.knownDangerousAppsPackages));
if (additionalDangerousApps!=null && additionalDangerousApps.length>0){
packages.addAll(Arrays.asList(additionalDangerousApps));
}
return isAnyPackageFromListInstalled(packages);
} | java | public boolean detectPotentiallyDangerousApps(String[] additionalDangerousApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>();
packages.addAll(Arrays.asList(Const.knownDangerousAppsPackages));
if (additionalDangerousApps!=null && additionalDangerousApps.length>0){
packages.addAll(Arrays.asList(additionalDangerousApps));
}
return isAnyPackageFromListInstalled(packages);
} | [
"public",
"boolean",
"detectPotentiallyDangerousApps",
"(",
"String",
"[",
"]",
"additionalDangerousApps",
")",
"{",
"// Create a list of package names to iterate over from constants any others provided",
"ArrayList",
"<",
"String",
">",
"packages",
"=",
"new",
"ArrayList",
"<>... | Using the PackageManager, check for a list of well known apps that require root. @link {Const.knownRootAppsPackages}
@param additionalDangerousApps - array of additional packagenames to search for
@return true if one of the apps it's installed | [
"Using",
"the",
"PackageManager",
"check",
"for",
"a",
"list",
"of",
"well",
"known",
"apps",
"that",
"require",
"root",
"."
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L111-L121 |
35,669 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.detectRootCloakingApps | public boolean detectRootCloakingApps(String[] additionalRootCloakingApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>(Arrays.asList(Const.knownRootCloakingPackages));
if (additionalRootCloakingApps!=null && additionalRootCloakingApps.length>0){
packages.addAll(Arrays.asList(additionalRootCloakingApps));
}
return isAnyPackageFromListInstalled(packages);
} | java | public boolean detectRootCloakingApps(String[] additionalRootCloakingApps) {
// Create a list of package names to iterate over from constants any others provided
ArrayList<String> packages = new ArrayList<>(Arrays.asList(Const.knownRootCloakingPackages));
if (additionalRootCloakingApps!=null && additionalRootCloakingApps.length>0){
packages.addAll(Arrays.asList(additionalRootCloakingApps));
}
return isAnyPackageFromListInstalled(packages);
} | [
"public",
"boolean",
"detectRootCloakingApps",
"(",
"String",
"[",
"]",
"additionalRootCloakingApps",
")",
"{",
"// Create a list of package names to iterate over from constants any others provided",
"ArrayList",
"<",
"String",
">",
"packages",
"=",
"new",
"ArrayList",
"<>",
... | Using the PackageManager, check for a list of well known root cloak apps. @link {Const.knownRootAppsPackages}
@param additionalRootCloakingApps - array of additional packagenames to search for
@return true if one of the apps it's installed | [
"Using",
"the",
"PackageManager",
"check",
"for",
"a",
"list",
"of",
"well",
"known",
"root",
"cloak",
"apps",
"."
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L137-L145 |
35,670 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.isAnyPackageFromListInstalled | private boolean isAnyPackageFromListInstalled(List<String> packages){
boolean result = false;
PackageManager pm = mContext.getPackageManager();
for (String packageName : packages) {
try {
// Root app detected
pm.getPackageInfo(packageName, 0);
QLog.e(packageName + " ROOT management app detected!");
result = true;
} catch (PackageManager.NameNotFoundException e) {
// Exception thrown, package is not installed into the system
}
}
return result;
} | java | private boolean isAnyPackageFromListInstalled(List<String> packages){
boolean result = false;
PackageManager pm = mContext.getPackageManager();
for (String packageName : packages) {
try {
// Root app detected
pm.getPackageInfo(packageName, 0);
QLog.e(packageName + " ROOT management app detected!");
result = true;
} catch (PackageManager.NameNotFoundException e) {
// Exception thrown, package is not installed into the system
}
}
return result;
} | [
"private",
"boolean",
"isAnyPackageFromListInstalled",
"(",
"List",
"<",
"String",
">",
"packages",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"PackageManager",
"pm",
"=",
"mContext",
".",
"getPackageManager",
"(",
")",
";",
"for",
"(",
"String",
"packa... | Check if any package in the list is installed
@param packages - list of packages to search for
@return true if any of the packages are installed | [
"Check",
"if",
"any",
"package",
"in",
"the",
"list",
"is",
"installed"
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L231-L248 |
35,671 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.checkForDangerousProps | public boolean checkForDangerousProps() {
final Map<String, String> dangerousProps = new HashMap<>();
dangerousProps.put("ro.debuggable", "1");
dangerousProps.put("ro.secure", "0");
boolean result = false;
String[] lines = propsReader();
if (lines == null){
// Could not read, assume false;
return false;
}
for (String line : lines) {
for (String key : dangerousProps.keySet()) {
if (line.contains(key)) {
String badValue = dangerousProps.get(key);
badValue = "[" + badValue + "]";
if (line.contains(badValue)) {
QLog.v(key + " = " + badValue + " detected!");
result = true;
}
}
}
}
return result;
} | java | public boolean checkForDangerousProps() {
final Map<String, String> dangerousProps = new HashMap<>();
dangerousProps.put("ro.debuggable", "1");
dangerousProps.put("ro.secure", "0");
boolean result = false;
String[] lines = propsReader();
if (lines == null){
// Could not read, assume false;
return false;
}
for (String line : lines) {
for (String key : dangerousProps.keySet()) {
if (line.contains(key)) {
String badValue = dangerousProps.get(key);
badValue = "[" + badValue + "]";
if (line.contains(badValue)) {
QLog.v(key + " = " + badValue + " detected!");
result = true;
}
}
}
}
return result;
} | [
"public",
"boolean",
"checkForDangerousProps",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"dangerousProps",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"dangerousProps",
".",
"put",
"(",
"\"ro.debuggable\"",
",",
"\"1\"",
")",
";",
"... | Checks for several system properties for
@return - true if dangerous props are found | [
"Checks",
"for",
"several",
"system",
"properties",
"for"
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L254-L282 |
35,672 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.checkForRWPaths | public boolean checkForRWPaths() {
boolean result = false;
String[] lines = mountReader();
if (lines == null){
// Could not read, assume false;
return false;
}
for (String line : lines) {
// Split lines into parts
String[] args = line.split(" ");
if (args.length < 4){
// If we don't have enough options per line, skip this and log an error
QLog.e("Error formatting mount line: "+line);
continue;
}
String mountPoint = args[1];
String mountOptions = args[3];
for(String pathToCheck: Const.pathsThatShouldNotBeWrtiable) {
if (mountPoint.equalsIgnoreCase(pathToCheck)) {
// Split options out and compare against "rw" to avoid false positives
for (String option : mountOptions.split(",")){
if (option.equalsIgnoreCase("rw")){
QLog.v(pathToCheck+" path is mounted with rw permissions! "+line);
result = true;
break;
}
}
}
}
}
return result;
} | java | public boolean checkForRWPaths() {
boolean result = false;
String[] lines = mountReader();
if (lines == null){
// Could not read, assume false;
return false;
}
for (String line : lines) {
// Split lines into parts
String[] args = line.split(" ");
if (args.length < 4){
// If we don't have enough options per line, skip this and log an error
QLog.e("Error formatting mount line: "+line);
continue;
}
String mountPoint = args[1];
String mountOptions = args[3];
for(String pathToCheck: Const.pathsThatShouldNotBeWrtiable) {
if (mountPoint.equalsIgnoreCase(pathToCheck)) {
// Split options out and compare against "rw" to avoid false positives
for (String option : mountOptions.split(",")){
if (option.equalsIgnoreCase("rw")){
QLog.v(pathToCheck+" path is mounted with rw permissions! "+line);
result = true;
break;
}
}
}
}
}
return result;
} | [
"public",
"boolean",
"checkForRWPaths",
"(",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"String",
"[",
"]",
"lines",
"=",
"mountReader",
"(",
")",
";",
"if",
"(",
"lines",
"==",
"null",
")",
"{",
"// Could not read, assume false;",
"return",
"false",
... | When you're root you can change the permissions on common system directories, this method checks if any of these patha Const.pathsThatShouldNotBeWrtiable are writable.
@return true if one of the dir is writable | [
"When",
"you",
"re",
"root",
"you",
"can",
"change",
"the",
"permissions",
"on",
"common",
"system",
"directories",
"this",
"method",
"checks",
"if",
"any",
"of",
"these",
"patha",
"Const",
".",
"pathsThatShouldNotBeWrtiable",
"are",
"writable",
"."
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L288-L330 |
35,673 | scottyab/rootbeer | rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java | RootBeer.checkSuExists | public boolean checkSuExists() {
Process process = null;
try {
process = Runtime.getRuntime().exec(new String[] { "which", BINARY_SU });
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
return in.readLine() != null;
} catch (Throwable t) {
return false;
} finally {
if (process != null) process.destroy();
}
} | java | public boolean checkSuExists() {
Process process = null;
try {
process = Runtime.getRuntime().exec(new String[] { "which", BINARY_SU });
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
return in.readLine() != null;
} catch (Throwable t) {
return false;
} finally {
if (process != null) process.destroy();
}
} | [
"public",
"boolean",
"checkSuExists",
"(",
")",
"{",
"Process",
"process",
"=",
"null",
";",
"try",
"{",
"process",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"new",
"String",
"[",
"]",
"{",
"\"which\"",
",",
"BINARY_SU",
"}",
")",
... | A variation on the checking for SU, this attempts a 'which su'
@return true if su found | [
"A",
"variation",
"on",
"the",
"checking",
"for",
"SU",
"this",
"attempts",
"a",
"which",
"su"
] | 8b985d927ff18acc804440a84c6d2b5efee0c6d9 | https://github.com/scottyab/rootbeer/blob/8b985d927ff18acc804440a84c6d2b5efee0c6d9/rootbeerlib/src/main/java/com/scottyab/rootbeer/RootBeer.java#L337-L348 |
35,674 | Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java | BackupLongTermRetentionPoliciesInner.getAsync | public Observable<BackupLongTermRetentionPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() {
@Override
public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<BackupLongTermRetentionPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() {
@Override
public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupLongTermRetentionPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverNam... | Returns a database backup long term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupLongTermRetentionPolicyInner object | [
"Returns",
"a",
"database",
"backup",
"long",
"term",
"retention",
"policy",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java#L114-L121 |
35,675 | Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java | MessageSecurityHelper.bytesToBase64Url | public static String bytesToBase64Url(byte[] bytes) {
String result = (new String(Base64.encodeBase64(bytes), MESSAGE_ENCODING)).replace("=", "").replace("\\", "").replace('+', '-')
.replace('/', '_');
return result;
} | java | public static String bytesToBase64Url(byte[] bytes) {
String result = (new String(Base64.encodeBase64(bytes), MESSAGE_ENCODING)).replace("=", "").replace("\\", "").replace('+', '-')
.replace('/', '_');
return result;
} | [
"public",
"static",
"String",
"bytesToBase64Url",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"String",
"result",
"=",
"(",
"new",
"String",
"(",
"Base64",
".",
"encodeBase64",
"(",
"bytes",
")",
",",
"MESSAGE_ENCODING",
")",
")",
".",
"replace",
"(",
"\"=... | Convert bytes array to Base64Url string.
@param bytes
bytes array
@returns Encoded string. | [
"Convert",
"bytes",
"array",
"to",
"Base64Url",
"string",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java#L67-L71 |
35,676 | Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java | MessageSecurityHelper.jsonWebKeyFromString | public static JsonWebKey jsonWebKeyFromString(String jwkString) throws IOException {
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(jwkString, JsonWebKey.class);
} | java | public static JsonWebKey jsonWebKeyFromString(String jwkString) throws IOException {
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(jwkString, JsonWebKey.class);
} | [
"public",
"static",
"JsonWebKey",
"jsonWebKeyFromString",
"(",
"String",
"jwkString",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"return",
"mapper",
".",
"readValue",
"(",
"jwkString",
",",
"JsonWebKey",... | Convert serialized JsonWebKey string to JsonWebKey object.
@param jwkString
serialized JsonWebKey.
@returns JsonWebKey object. | [
"Convert",
"serialized",
"JsonWebKey",
"string",
"to",
"JsonWebKey",
"object",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java#L93-L96 |
35,677 | Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java | MessageSecurityHelper.generateJsonWebKey | public static JsonWebKey generateJsonWebKey() {
try {
final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(2048);
KeyPair clientRsaKeyPair = generator.generateKeyPair();
JsonWebKey result = JsonWebKey.fromRSA(clientRsaKeyPair);
result.withKid(UUID.randomUUID().toString());
return result;
} catch (NoSuchAlgorithmException e) {
// Unexpected. Should never be thrown.
throw new RuntimeException(e);
}
} | java | public static JsonWebKey generateJsonWebKey() {
try {
final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(2048);
KeyPair clientRsaKeyPair = generator.generateKeyPair();
JsonWebKey result = JsonWebKey.fromRSA(clientRsaKeyPair);
result.withKid(UUID.randomUUID().toString());
return result;
} catch (NoSuchAlgorithmException e) {
// Unexpected. Should never be thrown.
throw new RuntimeException(e);
}
} | [
"public",
"static",
"JsonWebKey",
"generateJsonWebKey",
"(",
")",
"{",
"try",
"{",
"final",
"KeyPairGenerator",
"generator",
"=",
"KeyPairGenerator",
".",
"getInstance",
"(",
"\"RSA\"",
")",
";",
"generator",
".",
"initialize",
"(",
"2048",
")",
";",
"KeyPair",
... | Generates new JsonWebKey with random KeyID.
@returns JsonWebKey object. | [
"Generates",
"new",
"JsonWebKey",
"with",
"random",
"KeyID",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java#L103-L115 |
35,678 | Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java | MessageSecurityHelper.getJwkWithPublicKeyOnly | public static JsonWebKey getJwkWithPublicKeyOnly(JsonWebKey jwk) {
KeyPair publicOnly = jwk.toRSA(false);
JsonWebKey jsonkeyPublic = JsonWebKey.fromRSA(publicOnly);
jsonkeyPublic.withKid(jwk.kid());
jsonkeyPublic.withKeyOps(
Arrays.asList(JsonWebKeyOperation.ENCRYPT, JsonWebKeyOperation.WRAP_KEY, JsonWebKeyOperation.VERIFY));
return jsonkeyPublic;
} | java | public static JsonWebKey getJwkWithPublicKeyOnly(JsonWebKey jwk) {
KeyPair publicOnly = jwk.toRSA(false);
JsonWebKey jsonkeyPublic = JsonWebKey.fromRSA(publicOnly);
jsonkeyPublic.withKid(jwk.kid());
jsonkeyPublic.withKeyOps(
Arrays.asList(JsonWebKeyOperation.ENCRYPT, JsonWebKeyOperation.WRAP_KEY, JsonWebKeyOperation.VERIFY));
return jsonkeyPublic;
} | [
"public",
"static",
"JsonWebKey",
"getJwkWithPublicKeyOnly",
"(",
"JsonWebKey",
"jwk",
")",
"{",
"KeyPair",
"publicOnly",
"=",
"jwk",
".",
"toRSA",
"(",
"false",
")",
";",
"JsonWebKey",
"jsonkeyPublic",
"=",
"JsonWebKey",
".",
"fromRSA",
"(",
"publicOnly",
")",
... | Converts JsonWebKey with private key to JsonWebKey with public key only.
@param jwk
JsonWebKey with private key.
@returns JsonWebKey object with public key only. | [
"Converts",
"JsonWebKey",
"with",
"private",
"key",
"to",
"JsonWebKey",
"with",
"public",
"key",
"only",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/MessageSecurityHelper.java#L124-L131 |
35,679 | Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java | DatabaseOperationsInner.listByDatabaseNextAsync | public Observable<Page<DatabaseOperationInner>> listByDatabaseNextAsync(final String nextPageLink) {
return listByDatabaseNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<DatabaseOperationInner>>, Page<DatabaseOperationInner>>() {
@Override
public Page<DatabaseOperationInner> call(ServiceResponse<Page<DatabaseOperationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DatabaseOperationInner>> listByDatabaseNextAsync(final String nextPageLink) {
return listByDatabaseNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<DatabaseOperationInner>>, Page<DatabaseOperationInner>>() {
@Override
public Page<DatabaseOperationInner> call(ServiceResponse<Page<DatabaseOperationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DatabaseOperationInner",
">",
">",
"listByDatabaseNextAsync",
"(",
"final",
"String",
"nextPageLink",
")",
"{",
"return",
"listByDatabaseNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
".",
"map",
"(",
"new",
"Func1"... | Gets a list of operations performed on the database.
@param nextPageLink The NextLink from the previous successful call to List operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DatabaseOperationInner> object | [
"Gets",
"a",
"list",
"of",
"operations",
"performed",
"on",
"the",
"database",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java#L353-L361 |
35,680 | Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java | APIKeysInner.listAsync | public Observable<List<ApplicationInsightsComponentAPIKeyInner>> listAsync(String resourceGroupName, String resourceName) {
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>>, List<ApplicationInsightsComponentAPIKeyInner>>() {
@Override
public List<ApplicationInsightsComponentAPIKeyInner> call(ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>> response) {
return response.body();
}
});
} | java | public Observable<List<ApplicationInsightsComponentAPIKeyInner>> listAsync(String resourceGroupName, String resourceName) {
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>>, List<ApplicationInsightsComponentAPIKeyInner>>() {
@Override
public List<ApplicationInsightsComponentAPIKeyInner> call(ServiceResponse<List<ApplicationInsightsComponentAPIKeyInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName"... | Gets a list of API keys of an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ApplicationInsightsComponentAPIKeyInner> object | [
"Gets",
"a",
"list",
"of",
"API",
"keys",
"of",
"an",
"Application",
"Insights",
"component",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java#L113-L120 |
35,681 | Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/models/CertificateItem.java | CertificateItem.withX509Thumbprint | public CertificateItem withX509Thumbprint(byte[] x509Thumbprint) {
if (x509Thumbprint == null) {
this.x509Thumbprint = null;
} else {
this.x509Thumbprint = Base64Url.encode(x509Thumbprint);
}
return this;
} | java | public CertificateItem withX509Thumbprint(byte[] x509Thumbprint) {
if (x509Thumbprint == null) {
this.x509Thumbprint = null;
} else {
this.x509Thumbprint = Base64Url.encode(x509Thumbprint);
}
return this;
} | [
"public",
"CertificateItem",
"withX509Thumbprint",
"(",
"byte",
"[",
"]",
"x509Thumbprint",
")",
"{",
"if",
"(",
"x509Thumbprint",
"==",
"null",
")",
"{",
"this",
".",
"x509Thumbprint",
"=",
"null",
";",
"}",
"else",
"{",
"this",
".",
"x509Thumbprint",
"=",
... | Set the x509Thumbprint value.
@param x509Thumbprint the x509Thumbprint value to set
@return the CertificateItem object itself. | [
"Set",
"the",
"x509Thumbprint",
"value",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/models/CertificateItem.java#L117-L124 |
35,682 | Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/SubnetsInner.java | SubnetsInner.beginDelete | public void beginDelete(String resourceGroupName, String virtualNetworkName, String subnetName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String virtualNetworkName, String subnetName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"String",
"subnetName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkName",
",",
"subnetName",
")",
".",
"toB... | Deletes the specified subnet.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param subnetName The name of the subnet.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"subnet",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/SubnetsInner.java#L177-L179 |
35,683 | Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java | ServiceEndpointPoliciesInner.beginDelete | public void beginDelete(String resourceGroupName, String serviceEndpointPolicyName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String serviceEndpointPolicyName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serviceEndpointPolicyName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Deletes the specified service endpoint policy.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"service",
"endpoint",
"policy",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L191-L193 |
35,684 | Azure/azure-sdk-for-java | mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java | ProtectionKey.getProtectionKeyId | public static EntityTypeActionOperation<String> getProtectionKeyId(
ContentKeyType contentKeyType) {
return new GetProtectionKeyIdActionOperation("GetProtectionKeyId")
.addQueryParameter("contentKeyType",
String.format("%d", contentKeyType.getCode()))
.setAcceptType(MediaType.APPLICATION_XML_TYPE);
} | java | public static EntityTypeActionOperation<String> getProtectionKeyId(
ContentKeyType contentKeyType) {
return new GetProtectionKeyIdActionOperation("GetProtectionKeyId")
.addQueryParameter("contentKeyType",
String.format("%d", contentKeyType.getCode()))
.setAcceptType(MediaType.APPLICATION_XML_TYPE);
} | [
"public",
"static",
"EntityTypeActionOperation",
"<",
"String",
">",
"getProtectionKeyId",
"(",
"ContentKeyType",
"contentKeyType",
")",
"{",
"return",
"new",
"GetProtectionKeyIdActionOperation",
"(",
"\"GetProtectionKeyId\"",
")",
".",
"addQueryParameter",
"(",
"\"contentK... | Gets the protection key id.
@param contentKeyType
the content key type
@return the protection key id | [
"Gets",
"the",
"protection",
"key",
"id",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java#L50-L56 |
35,685 | Azure/azure-sdk-for-java | mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java | ProtectionKey.getProtectionKey | public static EntityTypeActionOperation<String> getProtectionKey(
String protectionKeyId) {
return new GetProtectionKeyActionOperation("GetProtectionKey")
.addQueryParameter("ProtectionKeyId",
String.format("'%s'", protectionKeyId)).setAcceptType(
MediaType.APPLICATION_XML_TYPE);
} | java | public static EntityTypeActionOperation<String> getProtectionKey(
String protectionKeyId) {
return new GetProtectionKeyActionOperation("GetProtectionKey")
.addQueryParameter("ProtectionKeyId",
String.format("'%s'", protectionKeyId)).setAcceptType(
MediaType.APPLICATION_XML_TYPE);
} | [
"public",
"static",
"EntityTypeActionOperation",
"<",
"String",
">",
"getProtectionKey",
"(",
"String",
"protectionKeyId",
")",
"{",
"return",
"new",
"GetProtectionKeyActionOperation",
"(",
"\"GetProtectionKey\"",
")",
".",
"addQueryParameter",
"(",
"\"ProtectionKeyId\"",
... | Gets the protection key.
@param protectionKeyId
the protection key id
@return the protection key | [
"Gets",
"the",
"protection",
"key",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java#L65-L71 |
35,686 | Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java | ServersInner.beginUpdateAsync | public Observable<ServerInner> beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
public ServerInner call(ServiceResponse<ServerInner> response) {
return response.body();
}
});
} | java | public Observable<ServerInner> beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
public ServerInner call(ServiceResponse<ServerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerUpdateParameters",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"se... | Updates an existing server. The request body can contain one to many of the properties present in the normal server definition.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The required parameters for updating a server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerInner object | [
"Updates",
"an",
"existing",
"server",
".",
"The",
"request",
"body",
"can",
"contain",
"one",
"to",
"many",
"of",
"the",
"properties",
"present",
"in",
"the",
"normal",
"server",
"definition",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java#L393-L400 |
35,687 | Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java | ServersInner.listByResourceGroupAsync | public Observable<Page<ServerInner>> listByResourceGroupAsync(String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<ServerInner>>, Page<ServerInner>>() {
@Override
public Page<ServerInner> call(ServiceResponse<List<ServerInner>> response) {
PageImpl<ServerInner> page = new PageImpl<>();
page.setItems(response.body());
return page;
}
});
} | java | public Observable<Page<ServerInner>> listByResourceGroupAsync(String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<ServerInner>>, Page<ServerInner>>() {
@Override
public Page<ServerInner> call(ServiceResponse<List<ServerInner>> response) {
PageImpl<ServerInner> page = new PageImpl<>();
page.setItems(response.body());
return page;
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ServerInner",
">",
">",
"listByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
... | List all the servers in a given resource group.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@return the observable to the List<ServerInner> object | [
"List",
"all",
"the",
"servers",
"in",
"a",
"given",
"resource",
"group",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java#L726-L735 |
35,688 | Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java | SnapshotsInner.delete | public void delete(String resourceGroupName, String snapshotName) {
deleteWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().last().body();
} | java | public void delete(String resourceGroupName, String snapshotName) {
deleteWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().last().body();
} | [
"public",
"void",
"delete",
"(",
"String",
"resourceGroupName",
",",
"String",
"snapshotName",
")",
"{",
"deleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"snapshotName",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
... | Deletes a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"a",
"snapshot",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L572-L574 |
35,689 | Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java | SnapshotsInner.beginGrantAccessAsync | public ServiceFuture<AccessUriInner> beginGrantAccessAsync(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, final ServiceCallback<AccessUriInner> serviceCallback) {
return ServiceFuture.fromResponse(beginGrantAccessWithServiceResponseAsync(resourceGroupName, snapshotName, grantAccessData), serviceCallback);
} | java | public ServiceFuture<AccessUriInner> beginGrantAccessAsync(String resourceGroupName, String snapshotName, GrantAccessData grantAccessData, final ServiceCallback<AccessUriInner> serviceCallback) {
return ServiceFuture.fromResponse(beginGrantAccessWithServiceResponseAsync(resourceGroupName, snapshotName, grantAccessData), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"AccessUriInner",
">",
"beginGrantAccessAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"snapshotName",
",",
"GrantAccessData",
"grantAccessData",
",",
"final",
"ServiceCallback",
"<",
"AccessUriInner",
">",
"serviceCallback",
")... | Grants access to a snapshot.
@param resourceGroupName The name of the resource group.
@param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
@param grantAccessData Access data object supplied in the body of the get snapshot access operation.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Grants",
"access",
"to",
"a",
"snapshot",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L1042-L1044 |
35,690 | Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java | UsersInner.getAsync | public Observable<UserInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | java | public Observable<UserInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UserInner",
">",
"getAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGroupName",
")",
"."... | Gets the properties of the specified user.
@param deviceName The device name.
@param name The user name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UserInner object | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"user",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java#L255-L262 |
35,691 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java | TransactionContext.commit | public void commit() throws ServiceBusException, InterruptedException {
if (this.messagingFactory == null) {
throw new ServiceBusException(false, "MessagingFactory should not be null");
}
this.messagingFactory.endTransaction(this, true);
} | java | public void commit() throws ServiceBusException, InterruptedException {
if (this.messagingFactory == null) {
throw new ServiceBusException(false, "MessagingFactory should not be null");
}
this.messagingFactory.endTransaction(this, true);
} | [
"public",
"void",
"commit",
"(",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"if",
"(",
"this",
".",
"messagingFactory",
"==",
"null",
")",
"{",
"throw",
"new",
"ServiceBusException",
"(",
"false",
",",
"\"MessagingFactory should not be n... | Commits the transaction
@throws ServiceBusException if Commit failed
@throws InterruptedException if the current thread was interrupted while waiting | [
"Commits",
"the",
"transaction"
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java#L44-L50 |
35,692 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java | TransactionContext.commitAsync | public CompletableFuture<Void> commitAsync() {
if (this.messagingFactory == null) {
CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>();
exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null"));
return exceptionCompletion;
}
return this.messagingFactory.endTransactionAsync(this, true);
} | java | public CompletableFuture<Void> commitAsync() {
if (this.messagingFactory == null) {
CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>();
exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null"));
return exceptionCompletion;
}
return this.messagingFactory.endTransactionAsync(this, true);
} | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"commitAsync",
"(",
")",
"{",
"if",
"(",
"this",
".",
"messagingFactory",
"==",
"null",
")",
"{",
"CompletableFuture",
"<",
"Void",
">",
"exceptionCompletion",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
... | Asynchronously commits the transaction
@return a CompletableFuture for the commit operation | [
"Asynchronously",
"commits",
"the",
"transaction"
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java#L56-L64 |
35,693 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java | TransactionContext.rollback | public void rollback() throws ServiceBusException, InterruptedException {
if (this.messagingFactory == null) {
throw new ServiceBusException(false, "MessagingFactory should not be null");
}
this.messagingFactory.endTransaction(this, false);
} | java | public void rollback() throws ServiceBusException, InterruptedException {
if (this.messagingFactory == null) {
throw new ServiceBusException(false, "MessagingFactory should not be null");
}
this.messagingFactory.endTransaction(this, false);
} | [
"public",
"void",
"rollback",
"(",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"if",
"(",
"this",
".",
"messagingFactory",
"==",
"null",
")",
"{",
"throw",
"new",
"ServiceBusException",
"(",
"false",
",",
"\"MessagingFactory should not be... | Rollback the transaction
@throws ServiceBusException if rollback failed
@throws InterruptedException if the current thread was interrupted while waiting | [
"Rollback",
"the",
"transaction"
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java#L71-L77 |
35,694 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java | TransactionContext.rollbackAsync | public CompletableFuture<Void> rollbackAsync() {
if (this.messagingFactory == null) {
CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>();
exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null"));
return exceptionCompletion;
}
return this.messagingFactory.endTransactionAsync(this, false);
} | java | public CompletableFuture<Void> rollbackAsync() {
if (this.messagingFactory == null) {
CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>();
exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null"));
return exceptionCompletion;
}
return this.messagingFactory.endTransactionAsync(this, false);
} | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"rollbackAsync",
"(",
")",
"{",
"if",
"(",
"this",
".",
"messagingFactory",
"==",
"null",
")",
"{",
"CompletableFuture",
"<",
"Void",
">",
"exceptionCompletion",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
... | Asynchronously rollback the transaction.
@return a CompletableFuture for the rollback operation | [
"Asynchronously",
"rollback",
"the",
"transaction",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java#L83-L91 |
35,695 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createMessageSenderFromEntityPath | public static IMessageSender createMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageSenderFromEntityPathAsync(messagingFactory, entityPath));
} | java | public static IMessageSender createMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageSenderFromEntityPathAsync(messagingFactory, entityPath));
} | [
"public",
"static",
"IMessageSender",
"createMessageSenderFromEntityPath",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
")",
"throws",
"InterruptedException",
",",
"ServiceBusException",
"{",
"return",
"Utils",
".",
"completeFuture",
"(",
"creat... | Creates a message sender to the entity.
@param messagingFactory messaging factory (which represents a connection) on which sender needs to be created
@param entityPath path of entity
@return IMessageSender instance
@throws InterruptedException if the current thread was interrupted while waiting
@throws ServiceBusException if the sender cannot be created | [
"Creates",
"a",
"message",
"sender",
"to",
"the",
"entity",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L94-L96 |
35,696 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createTransferMessageSenderFromEntityPath | public static IMessageSender createTransferMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath, String viaEntityPath) throws InterruptedException, ServiceBusException
{
return Utils.completeFuture(createTransferMessageSenderFromEntityPathAsync(messagingFactory, entityPath, viaEntityPath));
} | java | public static IMessageSender createTransferMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath, String viaEntityPath) throws InterruptedException, ServiceBusException
{
return Utils.completeFuture(createTransferMessageSenderFromEntityPathAsync(messagingFactory, entityPath, viaEntityPath));
} | [
"public",
"static",
"IMessageSender",
"createTransferMessageSenderFromEntityPath",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
",",
"String",
"viaEntityPath",
")",
"throws",
"InterruptedException",
",",
"ServiceBusException",
"{",
"return",
"Util... | Creates a transfer message sender. This sender sends message to destination entity via another entity.
This is mainly to be used when sending messages in a transaction.
When messages need to be sent across entities in a single transaction, this can be used to ensure
all the messages land initially in the same entity/partition for local transactions, and then
let service bus handle transferring the message to the actual destination.
@param messagingFactory messaging factory (which represents a connection) on which sender needs to be created.
@param entityPath path of the final destination of the message.
@param viaEntityPath The initial destination of the message.
@return IMessageSender instance
@throws InterruptedException if the current thread was interrupted while waiting
@throws ServiceBusException if the sender cannot be created | [
"Creates",
"a",
"transfer",
"message",
"sender",
".",
"This",
"sender",
"sends",
"message",
"to",
"destination",
"entity",
"via",
"another",
"entity",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L116-L119 |
35,697 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createMessageSenderFromConnectionStringBuilderAsync | public static CompletableFuture<IMessageSender> createMessageSenderFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder) {
Utils.assertNonNull("amqpConnectionStringBuilder", amqpConnectionStringBuilder);
return createMessageSenderFromEntityPathAsync(amqpConnectionStringBuilder.getEndpoint(), amqpConnectionStringBuilder.getEntityPath(), Util.getClientSettingsFromConnectionStringBuilder(amqpConnectionStringBuilder));
} | java | public static CompletableFuture<IMessageSender> createMessageSenderFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder) {
Utils.assertNonNull("amqpConnectionStringBuilder", amqpConnectionStringBuilder);
return createMessageSenderFromEntityPathAsync(amqpConnectionStringBuilder.getEndpoint(), amqpConnectionStringBuilder.getEntityPath(), Util.getClientSettingsFromConnectionStringBuilder(amqpConnectionStringBuilder));
} | [
"public",
"static",
"CompletableFuture",
"<",
"IMessageSender",
">",
"createMessageSenderFromConnectionStringBuilderAsync",
"(",
"ConnectionStringBuilder",
"amqpConnectionStringBuilder",
")",
"{",
"Utils",
".",
"assertNonNull",
"(",
"\"amqpConnectionStringBuilder\"",
",",
"amqpCo... | Create message sender asynchronously from ConnectionStringBuilder
@param amqpConnectionStringBuilder the connection string builder
@return a CompletableFuture representing the pending creating of {@link IMessageSender} instance | [
"Create",
"message",
"sender",
"asynchronously",
"from",
"ConnectionStringBuilder"
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L138-L141 |
35,698 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createTransferMessageSenderFromEntityPathAsync | public static CompletableFuture<IMessageSender> createTransferMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String viaEntityPath)
{
Utils.assertNonNull("messagingFactory", messagingFactory);
MessageSender sender = new MessageSender(messagingFactory, viaEntityPath, entityPath, null);
return sender.initializeAsync().thenApply((v) -> sender);
} | java | public static CompletableFuture<IMessageSender> createTransferMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String viaEntityPath)
{
Utils.assertNonNull("messagingFactory", messagingFactory);
MessageSender sender = new MessageSender(messagingFactory, viaEntityPath, entityPath, null);
return sender.initializeAsync().thenApply((v) -> sender);
} | [
"public",
"static",
"CompletableFuture",
"<",
"IMessageSender",
">",
"createTransferMessageSenderFromEntityPathAsync",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
",",
"String",
"viaEntityPath",
")",
"{",
"Utils",
".",
"assertNonNull",
"(",
"... | Creates a transfer message sender asynchronously. This sender sends message to destination entity via another entity.
This is mainly to be used when sending messages in a transaction.
When messages need to be sent across entities in a single transaction, this can be used to ensure
all the messages land initially in the same entity/partition for local transactions, and then
let service bus handle transferring the message to the actual destination.
@param messagingFactory messaging factory (which represents a connection) on which sender needs to be created.
@param entityPath path of the final destination of the message.
@param viaEntityPath The initial destination of the message.
@return a CompletableFuture representing the pending creating of IMessageSender instance. | [
"Creates",
"a",
"transfer",
"message",
"sender",
"asynchronously",
".",
"This",
"sender",
"sends",
"message",
"to",
"destination",
"entity",
"via",
"another",
"entity",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L209-L214 |
35,699 | Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createMessageReceiverFromEntityPath | public static IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageReceiverFromEntityPathAsync(namespaceEndpointURI, entityPath, clientSettings));
} | java | public static IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageReceiverFromEntityPathAsync(namespaceEndpointURI, entityPath, clientSettings));
} | [
"public",
"static",
"IMessageReceiver",
"createMessageReceiverFromEntityPath",
"(",
"URI",
"namespaceEndpointURI",
",",
"String",
"entityPath",
",",
"ClientSettings",
"clientSettings",
")",
"throws",
"InterruptedException",
",",
"ServiceBusException",
"{",
"return",
"Utils",
... | Creates a message receiver to the entity using the client settings in PeekLock mode
@param namespaceEndpointURI endpoint uri of entity namespace
@param entityPath path of the entity
@param clientSettings client settings
@return IMessageReceiver instance
@throws InterruptedException if the current thread was interrupted while waiting
@throws ServiceBusException if the receiver cannot be created | [
"Creates",
"a",
"message",
"receiver",
"to",
"the",
"entity",
"using",
"the",
"client",
"settings",
"in",
"PeekLock",
"mode"
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L308-L310 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.