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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,200 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java | DerInputBuffer.getBitString | public byte[] getBitString(int len) throws IOException {
if (len > available())
throw new IOException("short read of bit string");
if (len == 0) {
throw new IOException("Invalid encoding: zero length bit string");
}
int numOfPadBits = buf[pos];
if ((numOfPadBits < 0) || (numOfPadBits > 7)) {
throw new IOException("Invalid number of padding bits");
}
// minus the first byte which indicates the number of padding bits
byte[] retval = new byte[len - 1];
System.arraycopy(buf, pos + 1, retval, 0, len - 1);
if (numOfPadBits != 0) {
// get rid of the padding bits
retval[len - 2] &= (0xff << numOfPadBits);
}
skip(len);
return retval;
} | java | public byte[] getBitString(int len) throws IOException {
if (len > available())
throw new IOException("short read of bit string");
if (len == 0) {
throw new IOException("Invalid encoding: zero length bit string");
}
int numOfPadBits = buf[pos];
if ((numOfPadBits < 0) || (numOfPadBits > 7)) {
throw new IOException("Invalid number of padding bits");
}
// minus the first byte which indicates the number of padding bits
byte[] retval = new byte[len - 1];
System.arraycopy(buf, pos + 1, retval, 0, len - 1);
if (numOfPadBits != 0) {
// get rid of the padding bits
retval[len - 2] &= (0xff << numOfPadBits);
}
skip(len);
return retval;
} | [
"public",
"byte",
"[",
"]",
"getBitString",
"(",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"available",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"short read of bit string\"",
")",
";",
"if",
"(",
"len",
"==",
"0"... | Returns the bit string which takes up the specified
number of bytes in this buffer. | [
"Returns",
"the",
"bit",
"string",
"which",
"takes",
"up",
"the",
"specified",
"number",
"of",
"bytes",
"in",
"this",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L199-L220 |
34,201 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java | DerInputBuffer.getUnalignedBitString | BitArray getUnalignedBitString() throws IOException {
if (pos >= count)
return null;
/*
* Just copy the data into an aligned, padded octet buffer,
* and consume the rest of the buffer.
*/
int len = available();
int unusedBits = buf[pos] & 0xff;
if (unusedBits > 7 ) {
throw new IOException("Invalid value for unused bits: " + unusedBits);
}
byte[] bits = new byte[len - 1];
// number of valid bits
int length = (bits.length == 0) ? 0 : bits.length * 8 - unusedBits;
System.arraycopy(buf, pos + 1, bits, 0, len - 1);
BitArray bitArray = new BitArray(length, bits);
pos = count;
return bitArray;
} | java | BitArray getUnalignedBitString() throws IOException {
if (pos >= count)
return null;
/*
* Just copy the data into an aligned, padded octet buffer,
* and consume the rest of the buffer.
*/
int len = available();
int unusedBits = buf[pos] & 0xff;
if (unusedBits > 7 ) {
throw new IOException("Invalid value for unused bits: " + unusedBits);
}
byte[] bits = new byte[len - 1];
// number of valid bits
int length = (bits.length == 0) ? 0 : bits.length * 8 - unusedBits;
System.arraycopy(buf, pos + 1, bits, 0, len - 1);
BitArray bitArray = new BitArray(length, bits);
pos = count;
return bitArray;
} | [
"BitArray",
"getUnalignedBitString",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"pos",
">=",
"count",
")",
"return",
"null",
";",
"/*\n * Just copy the data into an aligned, padded octet buffer,\n * and consume the rest of the buffer.\n */",
"int",
... | Returns the bit string which takes up the rest of this buffer.
The bit string need not be byte-aligned. | [
"Returns",
"the",
"bit",
"string",
"which",
"takes",
"up",
"the",
"rest",
"of",
"this",
"buffer",
".",
"The",
"bit",
"string",
"need",
"not",
"be",
"byte",
"-",
"aligned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L233-L254 |
34,202 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java | DerInputBuffer.getUTCTime | public Date getUTCTime(int len) throws IOException {
if (len > available())
throw new IOException("short read of DER UTC Time");
if (len < 11 || len > 17)
throw new IOException("DER UTC Time length error");
return getTime(len, false);
} | java | public Date getUTCTime(int len) throws IOException {
if (len > available())
throw new IOException("short read of DER UTC Time");
if (len < 11 || len > 17)
throw new IOException("DER UTC Time length error");
return getTime(len, false);
} | [
"public",
"Date",
"getUTCTime",
"(",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"available",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"short read of DER UTC Time\"",
")",
";",
"if",
"(",
"len",
"<",
"11",
"||",
"l... | Returns the UTC Time value that takes up the specified number
of bytes in this buffer.
@param len the number of bytes to use | [
"Returns",
"the",
"UTC",
"Time",
"value",
"that",
"takes",
"up",
"the",
"specified",
"number",
"of",
"bytes",
"in",
"this",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L261-L269 |
34,203 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java | DerInputBuffer.getGeneralizedTime | public Date getGeneralizedTime(int len) throws IOException {
if (len > available())
throw new IOException("short read of DER Generalized Time");
if (len < 13 || len > 23)
throw new IOException("DER Generalized Time length error");
return getTime(len, true);
} | java | public Date getGeneralizedTime(int len) throws IOException {
if (len > available())
throw new IOException("short read of DER Generalized Time");
if (len < 13 || len > 23)
throw new IOException("DER Generalized Time length error");
return getTime(len, true);
} | [
"public",
"Date",
"getGeneralizedTime",
"(",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"available",
"(",
")",
")",
"throw",
"new",
"IOException",
"(",
"\"short read of DER Generalized Time\"",
")",
";",
"if",
"(",
"len",
"<",
"1... | Returns the Generalized Time value that takes up the specified
number of bytes in this buffer.
@param len the number of bytes to use | [
"Returns",
"the",
"Generalized",
"Time",
"value",
"that",
"takes",
"up",
"the",
"specified",
"number",
"of",
"bytes",
"in",
"this",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L276-L285 |
34,204 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/SerializationStripper.java | SerializationStripper.visit | @Override
public boolean visit(TypeDeclaration node) {
TypeMirror serializableType = typeUtil.resolveJavaType("java.io.Serializable").asType();
TypeMirror nodeType = node.getTypeElement().asType();
boolean isSerializable = typeUtil.isAssignable(nodeType, serializableType);
boolean stripReflection = !translationUtil.needsReflection(node.getTypeElement());
return stripReflection && isSerializable;
} | java | @Override
public boolean visit(TypeDeclaration node) {
TypeMirror serializableType = typeUtil.resolveJavaType("java.io.Serializable").asType();
TypeMirror nodeType = node.getTypeElement().asType();
boolean isSerializable = typeUtil.isAssignable(nodeType, serializableType);
boolean stripReflection = !translationUtil.needsReflection(node.getTypeElement());
return stripReflection && isSerializable;
} | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"TypeDeclaration",
"node",
")",
"{",
"TypeMirror",
"serializableType",
"=",
"typeUtil",
".",
"resolveJavaType",
"(",
"\"java.io.Serializable\"",
")",
".",
"asType",
"(",
")",
";",
"TypeMirror",
"nodeType",
"=",
... | Only modify Serializable types when stripping reflection metadata. | [
"Only",
"modify",
"Serializable",
"types",
"when",
"stripping",
"reflection",
"metadata",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/SerializationStripper.java#L50-L57 |
34,205 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/SerializationStripper.java | SerializationStripper.visit | @Override
public boolean visit(FieldDeclaration node) {
if (isSerializationField(node.getFragment(0).getVariableElement())) {
node.remove();
}
return false;
} | java | @Override
public boolean visit(FieldDeclaration node) {
if (isSerializationField(node.getFragment(0).getVariableElement())) {
node.remove();
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"FieldDeclaration",
"node",
")",
"{",
"if",
"(",
"isSerializationField",
"(",
"node",
".",
"getFragment",
"(",
"0",
")",
".",
"getVariableElement",
"(",
")",
")",
")",
"{",
"node",
".",
"remove",
"(",
"... | Removes serialVersionUID field. | [
"Removes",
"serialVersionUID",
"field",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/SerializationStripper.java#L60-L66 |
34,206 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/SerializationStripper.java | SerializationStripper.visit | @Override
public boolean visit(MethodDeclaration node) {
if (isSerializationMethod(node.getExecutableElement())) {
node.remove();
}
return false;
} | java | @Override
public boolean visit(MethodDeclaration node) {
if (isSerializationMethod(node.getExecutableElement())) {
node.remove();
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"MethodDeclaration",
"node",
")",
"{",
"if",
"(",
"isSerializationMethod",
"(",
"node",
".",
"getExecutableElement",
"(",
")",
")",
")",
"{",
"node",
".",
"remove",
"(",
")",
";",
"}",
"return",
"false",
... | Removes serialization related methods. | [
"Removes",
"serialization",
"related",
"methods",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/SerializationStripper.java#L69-L75 |
34,207 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetRecog_Unicode.java | CharsetRecog_Unicode.adjustConfidence | static int adjustConfidence(int codeUnit, int confidence) {
if (codeUnit == 0) {
confidence -= 10;
} else if ((codeUnit >= 0x20 && codeUnit <= 0xff) || codeUnit == 0x0a) {
confidence += 10;
}
if (confidence < 0) {
confidence = 0;
} else if (confidence > 100) {
confidence = 100;
}
return confidence;
} | java | static int adjustConfidence(int codeUnit, int confidence) {
if (codeUnit == 0) {
confidence -= 10;
} else if ((codeUnit >= 0x20 && codeUnit <= 0xff) || codeUnit == 0x0a) {
confidence += 10;
}
if (confidence < 0) {
confidence = 0;
} else if (confidence > 100) {
confidence = 100;
}
return confidence;
} | [
"static",
"int",
"adjustConfidence",
"(",
"int",
"codeUnit",
",",
"int",
"confidence",
")",
"{",
"if",
"(",
"codeUnit",
"==",
"0",
")",
"{",
"confidence",
"-=",
"10",
";",
"}",
"else",
"if",
"(",
"(",
"codeUnit",
">=",
"0x20",
"&&",
"codeUnit",
"<=",
... | NULs should be rare in actual text. | [
"NULs",
"should",
"be",
"rare",
"in",
"actual",
"text",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetRecog_Unicode.java#L41-L53 |
34,208 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java | ScientificNumberFormatter.getMarkupInstance | public static ScientificNumberFormatter getMarkupInstance(
ULocale locale,
String beginMarkup,
String endMarkup) {
return getInstanceForLocale(
locale, new MarkupStyle(beginMarkup, endMarkup));
} | java | public static ScientificNumberFormatter getMarkupInstance(
ULocale locale,
String beginMarkup,
String endMarkup) {
return getInstanceForLocale(
locale, new MarkupStyle(beginMarkup, endMarkup));
} | [
"public",
"static",
"ScientificNumberFormatter",
"getMarkupInstance",
"(",
"ULocale",
"locale",
",",
"String",
"beginMarkup",
",",
"String",
"endMarkup",
")",
"{",
"return",
"getInstanceForLocale",
"(",
"locale",
",",
"new",
"MarkupStyle",
"(",
"beginMarkup",
",",
"... | Gets a ScientificNumberFormatter instance that uses
markup for exponents for this locale.
@param locale The locale
@param beginMarkup the markup to start superscript e.g {@code <sup>}
@param endMarkup the markup to end superscript e.g {@code </sup>}
@return The ScientificNumberFormatter instance. | [
"Gets",
"a",
"ScientificNumberFormatter",
"instance",
"that",
"uses",
"markup",
"for",
"exponents",
"for",
"this",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java#L74-L80 |
34,209 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java | ScientificNumberFormatter.getMarkupInstance | public static ScientificNumberFormatter getMarkupInstance(
DecimalFormat df,
String beginMarkup,
String endMarkup) {
return getInstance(
df, new MarkupStyle(beginMarkup, endMarkup));
} | java | public static ScientificNumberFormatter getMarkupInstance(
DecimalFormat df,
String beginMarkup,
String endMarkup) {
return getInstance(
df, new MarkupStyle(beginMarkup, endMarkup));
} | [
"public",
"static",
"ScientificNumberFormatter",
"getMarkupInstance",
"(",
"DecimalFormat",
"df",
",",
"String",
"beginMarkup",
",",
"String",
"endMarkup",
")",
"{",
"return",
"getInstance",
"(",
"df",
",",
"new",
"MarkupStyle",
"(",
"beginMarkup",
",",
"endMarkup",... | Gets a ScientificNumberFormatter instance that uses
markup for exponents.
@param df The DecimalFormat must be configured for scientific
notation. Caller may safely change df after this call as this method
clones it when creating the ScientificNumberFormatter.
@param beginMarkup the markup to start superscript e.g {@code <sup>}
@param endMarkup the markup to end superscript e.g {@code </sup>}
@return The ScientificNumberFormatter instance. | [
"Gets",
"a",
"ScientificNumberFormatter",
"instance",
"that",
"uses",
"markup",
"for",
"exponents",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java#L92-L98 |
34,210 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java | ScientificNumberFormatter.format | public String format(Object number) {
synchronized (fmt) {
return style.format(
fmt.formatToCharacterIterator(number),
preExponent);
}
} | java | public String format(Object number) {
synchronized (fmt) {
return style.format(
fmt.formatToCharacterIterator(number),
preExponent);
}
} | [
"public",
"String",
"format",
"(",
"Object",
"number",
")",
"{",
"synchronized",
"(",
"fmt",
")",
"{",
"return",
"style",
".",
"format",
"(",
"fmt",
".",
"formatToCharacterIterator",
"(",
"number",
")",
",",
"preExponent",
")",
";",
"}",
"}"
] | Formats a number
@param number Can be a double, int, Number or
anything that DecimalFormat#format(Object) accepts.
@return the formatted string. | [
"Formats",
"a",
"number"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ScientificNumberFormatter.java#L106-L112 |
34,211 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java | URLConnection.getHeaderFieldKey | public String getHeaderFieldKey(int n) {
try {
getInputStream();
} catch (Exception e) {
return null;
}
MessageHeader props = properties;
return props == null ? null : props.getKey(n);
} | java | public String getHeaderFieldKey(int n) {
try {
getInputStream();
} catch (Exception e) {
return null;
}
MessageHeader props = properties;
return props == null ? null : props.getKey(n);
} | [
"public",
"String",
"getHeaderFieldKey",
"(",
"int",
"n",
")",
"{",
"try",
"{",
"getInputStream",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"MessageHeader",
"props",
"=",
"properties",
";",
"return",
"props... | Return the key for the nth header field. Returns null if
there are fewer than n fields. This can be used to iterate
through all the headers in the message. | [
"Return",
"the",
"key",
"for",
"the",
"nth",
"header",
"field",
".",
"Returns",
"null",
"if",
"there",
"are",
"fewer",
"than",
"n",
"fields",
".",
"This",
"can",
"be",
"used",
"to",
"iterate",
"through",
"all",
"the",
"headers",
"in",
"the",
"message",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java#L119-L127 |
34,212 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java | URLConnection.getHeaderField | public String getHeaderField(int n) {
try {
getInputStream();
} catch (Exception e) {
return null;
}
MessageHeader props = properties;
return props == null ? null : props.getValue(n);
} | java | public String getHeaderField(int n) {
try {
getInputStream();
} catch (Exception e) {
return null;
}
MessageHeader props = properties;
return props == null ? null : props.getValue(n);
} | [
"public",
"String",
"getHeaderField",
"(",
"int",
"n",
")",
"{",
"try",
"{",
"getInputStream",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"MessageHeader",
"props",
"=",
"properties",
";",
"return",
"props",
... | Return the value for the nth header field. Returns null if
there are fewer than n fields. This can be used in conjunction
with getHeaderFieldKey to iterate through all the headers in the message. | [
"Return",
"the",
"value",
"for",
"the",
"nth",
"header",
"field",
".",
"Returns",
"null",
"if",
"there",
"are",
"fewer",
"than",
"n",
"fields",
".",
"This",
"can",
"be",
"used",
"in",
"conjunction",
"with",
"getHeaderFieldKey",
"to",
"iterate",
"through",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java#L134-L142 |
34,213 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java | URLConnection.getContentType | public String getContentType() {
if (contentType == null)
contentType = getHeaderField("content-type");
if (contentType == null) {
String ct = null;
try {
ct = guessContentTypeFromStream(getInputStream());
} catch(java.io.IOException e) {
}
String ce = properties.findValue("content-encoding");
if (ct == null) {
ct = properties.findValue("content-type");
if (ct == null)
if (url.getFile().endsWith("/"))
ct = "text/html";
else
ct = guessContentTypeFromName(url.getFile());
}
/*
* If the Mime header had a Content-encoding field and its value
* was not one of the values that essentially indicate no
* encoding, we force the content type to be unknown. This will
* cause a save dialog to be presented to the user. It is not
* ideal but is better than what we were previously doing, namely
* bringing up an image tool for compressed tar files.
*/
if (ct == null || ce != null &&
!(ce.equalsIgnoreCase("7bit")
|| ce.equalsIgnoreCase("8bit")
|| ce.equalsIgnoreCase("binary")))
ct = "content/unknown";
setContentType(ct);
}
return contentType;
} | java | public String getContentType() {
if (contentType == null)
contentType = getHeaderField("content-type");
if (contentType == null) {
String ct = null;
try {
ct = guessContentTypeFromStream(getInputStream());
} catch(java.io.IOException e) {
}
String ce = properties.findValue("content-encoding");
if (ct == null) {
ct = properties.findValue("content-type");
if (ct == null)
if (url.getFile().endsWith("/"))
ct = "text/html";
else
ct = guessContentTypeFromName(url.getFile());
}
/*
* If the Mime header had a Content-encoding field and its value
* was not one of the values that essentially indicate no
* encoding, we force the content type to be unknown. This will
* cause a save dialog to be presented to the user. It is not
* ideal but is better than what we were previously doing, namely
* bringing up an image tool for compressed tar files.
*/
if (ct == null || ce != null &&
!(ce.equalsIgnoreCase("7bit")
|| ce.equalsIgnoreCase("8bit")
|| ce.equalsIgnoreCase("binary")))
ct = "content/unknown";
setContentType(ct);
}
return contentType;
} | [
"public",
"String",
"getContentType",
"(",
")",
"{",
"if",
"(",
"contentType",
"==",
"null",
")",
"contentType",
"=",
"getHeaderField",
"(",
"\"content-type\"",
")",
";",
"if",
"(",
"contentType",
"==",
"null",
")",
"{",
"String",
"ct",
"=",
"null",
";",
... | Call this routine to get the content-type associated with this
object. | [
"Call",
"this",
"routine",
"to",
"get",
"the",
"content",
"-",
"type",
"associated",
"with",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java#L147-L184 |
34,214 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java | URLConnection.getContentLength | public int getContentLength() {
try {
getInputStream();
} catch (Exception e) {
return -1;
}
int l = contentLength;
if (l < 0) {
try {
l = Integer.parseInt(properties.findValue("content-length"));
setContentLength(l);
} catch(Exception e) {
}
}
return l;
} | java | public int getContentLength() {
try {
getInputStream();
} catch (Exception e) {
return -1;
}
int l = contentLength;
if (l < 0) {
try {
l = Integer.parseInt(properties.findValue("content-length"));
setContentLength(l);
} catch(Exception e) {
}
}
return l;
} | [
"public",
"int",
"getContentLength",
"(",
")",
"{",
"try",
"{",
"getInputStream",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"l",
"=",
"contentLength",
";",
"if",
"(",
"l",
"<",
"0",
")",
"{... | Call this routine to get the content-length associated with this
object. | [
"Call",
"this",
"routine",
"to",
"get",
"the",
"content",
"-",
"length",
"associated",
"with",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java#L201-L216 |
34,215 | google/j2objc | jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java | IosHttpURLConnection.getHeaderField | @Override
public String getHeaderField(String key) {
try {
getResponse();
return getHeaderFieldDoNotForceResponse(key);
} catch(IOException e) {
return null;
}
} | java | @Override
public String getHeaderField(String key) {
try {
getResponse();
return getHeaderFieldDoNotForceResponse(key);
} catch(IOException e) {
return null;
}
} | [
"@",
"Override",
"public",
"String",
"getHeaderField",
"(",
"String",
"key",
")",
"{",
"try",
"{",
"getResponse",
"(",
")",
";",
"return",
"getHeaderFieldDoNotForceResponse",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
... | Returns the value of the named header field.
If called on a connection that sets the same header multiple times with
possibly different values, only the last value is returned. | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"header",
"field",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java#L282-L290 |
34,216 | google/j2objc | jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java | IosHttpURLConnection.loadRequestCookies | private void loadRequestCookies() throws IOException {
CookieHandler cookieHandler = CookieHandler.getDefault();
if (cookieHandler != null) {
try {
URI uri = getURL().toURI();
Map<String, List<String>> cookieHeaders =
cookieHandler.get(uri, getHeaderFieldsDoNotForceResponse());
for (Map.Entry<String, List<String>> entry : cookieHeaders.entrySet()) {
String key = entry.getKey();
if (("Cookie".equalsIgnoreCase(key)
|| "Cookie2".equalsIgnoreCase(key))
&& !entry.getValue().isEmpty()) {
List<String> cookies = entry.getValue();
StringBuilder sb = new StringBuilder();
for (int i = 0, size = cookies.size(); i < size; i++) {
if (i > 0) {
sb.append("; ");
}
sb.append(cookies.get(i));
}
setHeader(key, sb.toString());
}
}
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
} | java | private void loadRequestCookies() throws IOException {
CookieHandler cookieHandler = CookieHandler.getDefault();
if (cookieHandler != null) {
try {
URI uri = getURL().toURI();
Map<String, List<String>> cookieHeaders =
cookieHandler.get(uri, getHeaderFieldsDoNotForceResponse());
for (Map.Entry<String, List<String>> entry : cookieHeaders.entrySet()) {
String key = entry.getKey();
if (("Cookie".equalsIgnoreCase(key)
|| "Cookie2".equalsIgnoreCase(key))
&& !entry.getValue().isEmpty()) {
List<String> cookies = entry.getValue();
StringBuilder sb = new StringBuilder();
for (int i = 0, size = cookies.size(); i < size; i++) {
if (i > 0) {
sb.append("; ");
}
sb.append(cookies.get(i));
}
setHeader(key, sb.toString());
}
}
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
} | [
"private",
"void",
"loadRequestCookies",
"(",
")",
"throws",
"IOException",
"{",
"CookieHandler",
"cookieHandler",
"=",
"CookieHandler",
".",
"getDefault",
"(",
")",
";",
"if",
"(",
"cookieHandler",
"!=",
"null",
")",
"{",
"try",
"{",
"URI",
"uri",
"=",
"get... | Add any cookies for this URI to the request headers. | [
"Add",
"any",
"cookies",
"for",
"this",
"URI",
"to",
"the",
"request",
"headers",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java#L486-L513 |
34,217 | google/j2objc | jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java | IosHttpURLConnection.saveResponseCookies | private void saveResponseCookies() throws IOException {
CookieHandler cookieHandler = CookieHandler.getDefault();
if (cookieHandler != null) {
try {
URI uri = getURL().toURI();
cookieHandler.put(uri, getHeaderFieldsDoNotForceResponse());
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
} | java | private void saveResponseCookies() throws IOException {
CookieHandler cookieHandler = CookieHandler.getDefault();
if (cookieHandler != null) {
try {
URI uri = getURL().toURI();
cookieHandler.put(uri, getHeaderFieldsDoNotForceResponse());
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
} | [
"private",
"void",
"saveResponseCookies",
"(",
")",
"throws",
"IOException",
"{",
"CookieHandler",
"cookieHandler",
"=",
"CookieHandler",
".",
"getDefault",
"(",
")",
";",
"if",
"(",
"cookieHandler",
"!=",
"null",
")",
"{",
"try",
"{",
"URI",
"uri",
"=",
"ge... | Store any returned cookies. | [
"Store",
"any",
"returned",
"cookies",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java#L518-L528 |
34,218 | google/j2objc | jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java | IosHttpURLConnection.secureConnectionException | static IOException secureConnectionException(String description) {
try {
Class<?> sslExceptionClass = Class.forName("javax.net.ssl.SSLException");
Constructor<?> constructor = sslExceptionClass.getConstructor(String.class);
return (IOException) constructor.newInstance(description);
} catch (ClassNotFoundException e) {
return new IOException(description);
} catch (Exception e) {
throw new AssertionError("unexpected exception", e);
}
} | java | static IOException secureConnectionException(String description) {
try {
Class<?> sslExceptionClass = Class.forName("javax.net.ssl.SSLException");
Constructor<?> constructor = sslExceptionClass.getConstructor(String.class);
return (IOException) constructor.newInstance(description);
} catch (ClassNotFoundException e) {
return new IOException(description);
} catch (Exception e) {
throw new AssertionError("unexpected exception", e);
}
} | [
"static",
"IOException",
"secureConnectionException",
"(",
"String",
"description",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"sslExceptionClass",
"=",
"Class",
".",
"forName",
"(",
"\"javax.net.ssl.SSLException\"",
")",
";",
"Constructor",
"<",
"?",
">",
"c... | Returns an SSLException if that class is linked into the application,
otherwise IOException. | [
"Returns",
"an",
"SSLException",
"if",
"that",
"class",
"is",
"linked",
"into",
"the",
"application",
"otherwise",
"IOException",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java#L759-L769 |
34,219 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.getSystemId | public String getSystemId()
{
Stylesheet sheet=getStylesheet();
return (sheet==null) ? null : sheet.getHref();
} | java | public String getSystemId()
{
Stylesheet sheet=getStylesheet();
return (sheet==null) ? null : sheet.getHref();
} | [
"public",
"String",
"getSystemId",
"(",
")",
"{",
"Stylesheet",
"sheet",
"=",
"getStylesheet",
"(",
")",
";",
"return",
"(",
"sheet",
"==",
"null",
")",
"?",
"null",
":",
"sheet",
".",
"getHref",
"(",
")",
";",
"}"
] | Return the system identifier for the current document event.
<p>If the system identifier is a URL, the parser must resolve it
fully before passing it to the application.</p>
@return A string containing the system identifier, or null
if none is available.
@see #getPublicId | [
"Return",
"the",
"system",
"identifier",
"for",
"the",
"current",
"document",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L725-L729 |
34,220 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.setPrefixes | public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl)
throws TransformerException
{
Enumeration decls = nsSupport.getDeclaredPrefixes();
while (decls.hasMoreElements())
{
String prefix = (String) decls.nextElement();
if (null == m_declaredPrefixes)
m_declaredPrefixes = new ArrayList();
String uri = nsSupport.getURI(prefix);
if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL))
continue;
// System.out.println("setPrefixes - "+prefix+", "+uri);
XMLNSDecl decl = new XMLNSDecl(prefix, uri, false);
m_declaredPrefixes.add(decl);
}
} | java | public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl)
throws TransformerException
{
Enumeration decls = nsSupport.getDeclaredPrefixes();
while (decls.hasMoreElements())
{
String prefix = (String) decls.nextElement();
if (null == m_declaredPrefixes)
m_declaredPrefixes = new ArrayList();
String uri = nsSupport.getURI(prefix);
if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL))
continue;
// System.out.println("setPrefixes - "+prefix+", "+uri);
XMLNSDecl decl = new XMLNSDecl(prefix, uri, false);
m_declaredPrefixes.add(decl);
}
} | [
"public",
"void",
"setPrefixes",
"(",
"NamespaceSupport",
"nsSupport",
",",
"boolean",
"excludeXSLDecl",
")",
"throws",
"TransformerException",
"{",
"Enumeration",
"decls",
"=",
"nsSupport",
".",
"getDeclaredPrefixes",
"(",
")",
";",
"while",
"(",
"decls",
".",
"h... | Copy the namespace declarations from the NamespaceSupport object.
Take care to call resolveInheritedNamespaceDecls.
after all namespace declarations have been added.
@param nsSupport non-null reference to NamespaceSupport from
the ContentHandler.
@param excludeXSLDecl true if XSLT namespaces should be ignored.
@throws TransformerException | [
"Copy",
"the",
"namespace",
"declarations",
"from",
"the",
"NamespaceSupport",
"object",
".",
"Take",
"care",
"to",
"call",
"resolveInheritedNamespaceDecls",
".",
"after",
"all",
"namespace",
"declarations",
"have",
"been",
"added",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L852-L875 |
34,221 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.getNamespaceForPrefix | public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context)
{
this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null);
return null;
} | java | public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context)
{
this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null);
return null;
} | [
"public",
"String",
"getNamespaceForPrefix",
"(",
"String",
"prefix",
",",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"context",
")",
"{",
"this",
".",
"error",
"(",
"XSLTErrorResources",
".",
"ER_CANT_RESOLVE_NSPREFIX",
",",
"null",
")",
";",
"return",
"nu... | Fullfill the PrefixResolver interface. Calling this for this class
will throw an error.
@param prefix The prefix to look up, which may be an empty string ("")
for the default Namespace.
@param context The node context from which to look up the URI.
@return null if the error listener does not choose to throw an exception. | [
"Fullfill",
"the",
"PrefixResolver",
"interface",
".",
"Calling",
"this",
"for",
"this",
"class",
"will",
"throw",
"an",
"error",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L887-L892 |
34,222 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.addOrReplaceDecls | void addOrReplaceDecls(XMLNSDecl newDecl)
{
int n = m_prefixTable.size();
for (int i = n - 1; i >= 0; i--)
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);
if (decl.getPrefix().equals(newDecl.getPrefix()))
{
return;
}
}
m_prefixTable.add(newDecl);
} | java | void addOrReplaceDecls(XMLNSDecl newDecl)
{
int n = m_prefixTable.size();
for (int i = n - 1; i >= 0; i--)
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);
if (decl.getPrefix().equals(newDecl.getPrefix()))
{
return;
}
}
m_prefixTable.add(newDecl);
} | [
"void",
"addOrReplaceDecls",
"(",
"XMLNSDecl",
"newDecl",
")",
"{",
"int",
"n",
"=",
"m_prefixTable",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"n",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"XMLNSDecl",
"decl",
"=",... | Add or replace this namespace declaration in list
of namespaces in scope for this element.
@param newDecl namespace declaration to add to list | [
"Add",
"or",
"replace",
"this",
"namespace",
"declaration",
"in",
"list",
"of",
"namespaces",
"in",
"scope",
"for",
"this",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L1130-L1145 |
34,223 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.unexecuteNSDecls | void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
{
try
{
if (null != m_prefixTable)
{
SerializationHandler rhandler = transformer.getResultTreeHandler();
int n = m_prefixTable.size();
for (int i = 0; i < n; i++)
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);
if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
{
rhandler.endPrefixMapping(decl.getPrefix());
}
}
}
}
catch(org.xml.sax.SAXException se)
{
throw new TransformerException(se);
}
} | java | void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
{
try
{
if (null != m_prefixTable)
{
SerializationHandler rhandler = transformer.getResultTreeHandler();
int n = m_prefixTable.size();
for (int i = 0; i < n; i++)
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);
if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
{
rhandler.endPrefixMapping(decl.getPrefix());
}
}
}
}
catch(org.xml.sax.SAXException se)
{
throw new TransformerException(se);
}
} | [
"void",
"unexecuteNSDecls",
"(",
"TransformerImpl",
"transformer",
",",
"String",
"ignorePrefix",
")",
"throws",
"TransformerException",
"{",
"try",
"{",
"if",
"(",
"null",
"!=",
"m_prefixTable",
")",
"{",
"SerializationHandler",
"rhandler",
"=",
"transformer",
".",... | Send endPrefixMapping events to the result tree handler
for all declared prefix mappings in the stylesheet.
@param transformer non-null reference to the the current transform-time state.
@param ignorePrefix string prefix to not endPrefixMapping
@throws TransformerException | [
"Send",
"endPrefixMapping",
"events",
"to",
"the",
"result",
"tree",
"handler",
"for",
"all",
"declared",
"prefix",
"mappings",
"in",
"the",
"stylesheet",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L1226-L1251 |
34,224 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/StringVector.java | StringVector.pop | public final String pop()
{
if (m_firstFree <= 0)
return null;
m_firstFree--;
String s = m_map[m_firstFree];
m_map[m_firstFree] = null;
return s;
} | java | public final String pop()
{
if (m_firstFree <= 0)
return null;
m_firstFree--;
String s = m_map[m_firstFree];
m_map[m_firstFree] = null;
return s;
} | [
"public",
"final",
"String",
"pop",
"(",
")",
"{",
"if",
"(",
"m_firstFree",
"<=",
"0",
")",
"return",
"null",
";",
"m_firstFree",
"--",
";",
"String",
"s",
"=",
"m_map",
"[",
"m_firstFree",
"]",
";",
"m_map",
"[",
"m_firstFree",
"]",
"=",
"null",
";... | Pop the tail of this vector.
@return The String last added to this vector or null not found.
The string is removed from the vector. | [
"Pop",
"the",
"tail",
"of",
"this",
"vector",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/StringVector.java#L199-L212 |
34,225 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/JavaTimeZone.java | JavaTimeZone.createTimeZone | public static JavaTimeZone createTimeZone(String id) {
java.util.TimeZone jtz = null;
if (AVAILABLESET.contains(id)) {
jtz = java.util.TimeZone.getTimeZone(id);
}
if (jtz == null) {
// Use ICU's canonical ID mapping
boolean[] isSystemID = new boolean[1];
String canonicalID = TimeZone.getCanonicalID(id, isSystemID);
if (isSystemID[0] && AVAILABLESET.contains(canonicalID)) {
jtz = java.util.TimeZone.getTimeZone(canonicalID);
}
}
if (jtz == null) {
return null;
}
return new JavaTimeZone(jtz, id);
} | java | public static JavaTimeZone createTimeZone(String id) {
java.util.TimeZone jtz = null;
if (AVAILABLESET.contains(id)) {
jtz = java.util.TimeZone.getTimeZone(id);
}
if (jtz == null) {
// Use ICU's canonical ID mapping
boolean[] isSystemID = new boolean[1];
String canonicalID = TimeZone.getCanonicalID(id, isSystemID);
if (isSystemID[0] && AVAILABLESET.contains(canonicalID)) {
jtz = java.util.TimeZone.getTimeZone(canonicalID);
}
}
if (jtz == null) {
return null;
}
return new JavaTimeZone(jtz, id);
} | [
"public",
"static",
"JavaTimeZone",
"createTimeZone",
"(",
"String",
"id",
")",
"{",
"java",
".",
"util",
".",
"TimeZone",
"jtz",
"=",
"null",
";",
"if",
"(",
"AVAILABLESET",
".",
"contains",
"(",
"id",
")",
")",
"{",
"jtz",
"=",
"java",
".",
"util",
... | Creates an instance of JavaTimeZone with the given timezone ID.
@param id A timezone ID, either a system ID or a custom ID.
@return An instance of JavaTimeZone for the given ID, or null
when the ID cannot be understood. | [
"Creates",
"an",
"instance",
"of",
"JavaTimeZone",
"with",
"the",
"given",
"timezone",
"ID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/JavaTimeZone.java#L86-L107 |
34,226 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/gen/SourceBuilder.java | SourceBuilder.reindent | public String reindent(String code) {
try {
// Remove indention from each line.
StringBuilder sb = new StringBuilder();
LineReader lr = new LineReader(new StringReader(code));
String line = lr.readLine();
while (line != null) {
sb.append(line.trim());
line = lr.readLine();
if (line != null) {
sb.append('\n');
}
}
String strippedCode = sb.toString();
// Now indent it again.
int indent = indention * DEFAULT_INDENTION;
sb.setLength(0); // reset buffer
lr = new LineReader(new StringReader(strippedCode));
line = lr.readLine();
while (line != null) {
if (line.startsWith("}")) {
indent -= DEFAULT_INDENTION;
}
if (!line.startsWith("#line")) {
sb.append(pad(indent));
}
sb.append(line);
if (line.endsWith("{")) {
indent += DEFAULT_INDENTION;
}
line = lr.readLine();
if (line != null) {
sb.append('\n');
}
}
return sb.toString();
} catch (IOException e) {
// Should never happen with string readers.
throw new AssertionError(e);
}
} | java | public String reindent(String code) {
try {
// Remove indention from each line.
StringBuilder sb = new StringBuilder();
LineReader lr = new LineReader(new StringReader(code));
String line = lr.readLine();
while (line != null) {
sb.append(line.trim());
line = lr.readLine();
if (line != null) {
sb.append('\n');
}
}
String strippedCode = sb.toString();
// Now indent it again.
int indent = indention * DEFAULT_INDENTION;
sb.setLength(0); // reset buffer
lr = new LineReader(new StringReader(strippedCode));
line = lr.readLine();
while (line != null) {
if (line.startsWith("}")) {
indent -= DEFAULT_INDENTION;
}
if (!line.startsWith("#line")) {
sb.append(pad(indent));
}
sb.append(line);
if (line.endsWith("{")) {
indent += DEFAULT_INDENTION;
}
line = lr.readLine();
if (line != null) {
sb.append('\n');
}
}
return sb.toString();
} catch (IOException e) {
// Should never happen with string readers.
throw new AssertionError(e);
}
} | [
"public",
"String",
"reindent",
"(",
"String",
"code",
")",
"{",
"try",
"{",
"// Remove indention from each line.",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"LineReader",
"lr",
"=",
"new",
"LineReader",
"(",
"new",
"StringReader",
"(",
... | Fix line indention, based on brace count. | [
"Fix",
"line",
"indention",
"based",
"on",
"brace",
"count",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/SourceBuilder.java#L213-L254 |
34,227 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/ContentInfo.java | ContentInfo.getContentBytes | public byte[] getContentBytes() throws IOException {
if (content == null)
return null;
DerInputStream dis = new DerInputStream(content.toByteArray());
return dis.getOctetString();
} | java | public byte[] getContentBytes() throws IOException {
if (content == null)
return null;
DerInputStream dis = new DerInputStream(content.toByteArray());
return dis.getOctetString();
} | [
"public",
"byte",
"[",
"]",
"getContentBytes",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"content",
"==",
"null",
")",
"return",
"null",
";",
"DerInputStream",
"dis",
"=",
"new",
"DerInputStream",
"(",
"content",
".",
"toByteArray",
"(",
")",
")",... | Returns a byte array representation of the data held in
the content field. | [
"Returns",
"a",
"byte",
"array",
"representation",
"of",
"the",
"data",
"held",
"in",
"the",
"content",
"field",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/ContentInfo.java#L203-L209 |
34,228 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.demandLogger | Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
Logger result = getLogger(name);
if (result == null) {
// only allocate the new logger once
Logger newLogger = new Logger(name, resourceBundleName, caller);
do {
if (addLogger(newLogger)) {
// We successfully added the new Logger that we
// created above so return it without refetching.
return newLogger;
}
// We didn't add the new Logger that we created above
// because another thread added a Logger with the same
// name after our null check above and before our call
// to addLogger(). We have to refetch the Logger because
// addLogger() returns a boolean instead of the Logger
// reference itself. However, if the thread that created
// the other Logger is not holding a strong reference to
// the other Logger, then it is possible for the other
// Logger to be GC'ed after we saw it in addLogger() and
// before we can refetch it. If it has been GC'ed then
// we'll just loop around and try again.
result = getLogger(name);
} while (result == null);
}
return result;
} | java | Logger demandLogger(String name, String resourceBundleName, Class<?> caller) {
Logger result = getLogger(name);
if (result == null) {
// only allocate the new logger once
Logger newLogger = new Logger(name, resourceBundleName, caller);
do {
if (addLogger(newLogger)) {
// We successfully added the new Logger that we
// created above so return it without refetching.
return newLogger;
}
// We didn't add the new Logger that we created above
// because another thread added a Logger with the same
// name after our null check above and before our call
// to addLogger(). We have to refetch the Logger because
// addLogger() returns a boolean instead of the Logger
// reference itself. However, if the thread that created
// the other Logger is not holding a strong reference to
// the other Logger, then it is possible for the other
// Logger to be GC'ed after we saw it in addLogger() and
// before we can refetch it. If it has been GC'ed then
// we'll just loop around and try again.
result = getLogger(name);
} while (result == null);
}
return result;
} | [
"Logger",
"demandLogger",
"(",
"String",
"name",
",",
"String",
"resourceBundleName",
",",
"Class",
"<",
"?",
">",
"caller",
")",
"{",
"Logger",
"result",
"=",
"getLogger",
"(",
"name",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"// only allo... | readConfiguration, and other methods. | [
"readConfiguration",
"and",
"other",
"methods",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L407-L434 |
34,229 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.loadLoggerHandlers | private void loadLoggerHandlers(final Logger logger, final String name,
final String handlersPropertyName)
{
/* J2ObjC removed.
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
*/
String names[] = parseClassNames(handlersPropertyName);
for (int i = 0; i < names.length; i++) {
String word = names[i];
try {
Class clz = getClassInstance(word);
Handler hdl = (Handler) clz.newInstance();
// Check if there is a property defining the
// this handler's level.
String levs = getProperty(word + ".level");
if (levs != null) {
Level l = Level.findLevel(levs);
if (l != null) {
hdl.setLevel(l);
} else {
// Probably a bad level. Drop through.
System.err.println("Can't set level for " + word);
}
}
// Add this Handler to the logger
logger.addHandler(hdl);
} catch (Exception ex) {
System.err.println("Can't load log handler \"" + word + "\"");
System.err.println("" + ex);
ex.printStackTrace();
}
}
/* J2ObjC removed.
return null;
}
});
*/
} | java | private void loadLoggerHandlers(final Logger logger, final String name,
final String handlersPropertyName)
{
/* J2ObjC removed.
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
*/
String names[] = parseClassNames(handlersPropertyName);
for (int i = 0; i < names.length; i++) {
String word = names[i];
try {
Class clz = getClassInstance(word);
Handler hdl = (Handler) clz.newInstance();
// Check if there is a property defining the
// this handler's level.
String levs = getProperty(word + ".level");
if (levs != null) {
Level l = Level.findLevel(levs);
if (l != null) {
hdl.setLevel(l);
} else {
// Probably a bad level. Drop through.
System.err.println("Can't set level for " + word);
}
}
// Add this Handler to the logger
logger.addHandler(hdl);
} catch (Exception ex) {
System.err.println("Can't load log handler \"" + word + "\"");
System.err.println("" + ex);
ex.printStackTrace();
}
}
/* J2ObjC removed.
return null;
}
});
*/
} | [
"private",
"void",
"loadLoggerHandlers",
"(",
"final",
"Logger",
"logger",
",",
"final",
"String",
"name",
",",
"final",
"String",
"handlersPropertyName",
")",
"{",
"/* J2ObjC removed.\n AccessController.doPrivileged(new PrivilegedAction<Object>() {\n public Objec... | only be modified by trusted code. | [
"only",
"be",
"modified",
"by",
"trusted",
"code",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L811-L849 |
34,230 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.resetLogger | private void resetLogger(Logger logger) {
// Close all the Logger's handlers.
Handler[] targets = logger.getHandlers();
for (int i = 0; i < targets.length; i++) {
Handler h = targets[i];
logger.removeHandler(h);
try {
h.close();
} catch (Exception ex) {
// Problems closing a handler? Keep going...
}
}
String name = logger.getName();
if (name != null && name.equals("")) {
// This is the root logger.
logger.setLevel(defaultLevel);
} else {
logger.setLevel(null);
}
} | java | private void resetLogger(Logger logger) {
// Close all the Logger's handlers.
Handler[] targets = logger.getHandlers();
for (int i = 0; i < targets.length; i++) {
Handler h = targets[i];
logger.removeHandler(h);
try {
h.close();
} catch (Exception ex) {
// Problems closing a handler? Keep going...
}
}
String name = logger.getName();
if (name != null && name.equals("")) {
// This is the root logger.
logger.setLevel(defaultLevel);
} else {
logger.setLevel(null);
}
} | [
"private",
"void",
"resetLogger",
"(",
"Logger",
"logger",
")",
"{",
"// Close all the Logger's handlers.",
"Handler",
"[",
"]",
"targets",
"=",
"logger",
".",
"getHandlers",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"targets",
".",
... | Private method to reset an individual target logger. | [
"Private",
"method",
"to",
"reset",
"an",
"individual",
"target",
"logger",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L1190-L1209 |
34,231 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.parseClassNames | private String[] parseClassNames(String propertyName) {
String hands = getProperty(propertyName);
if (hands == null) {
return new String[0];
}
hands = hands.trim();
int ix = 0;
Vector<String> result = new Vector<>();
while (ix < hands.length()) {
int end = ix;
while (end < hands.length()) {
if (Character.isWhitespace(hands.charAt(end))) {
break;
}
if (hands.charAt(end) == ',') {
break;
}
end++;
}
String word = hands.substring(ix, end);
ix = end+1;
word = word.trim();
if (word.length() == 0) {
continue;
}
result.add(word);
}
return result.toArray(new String[result.size()]);
} | java | private String[] parseClassNames(String propertyName) {
String hands = getProperty(propertyName);
if (hands == null) {
return new String[0];
}
hands = hands.trim();
int ix = 0;
Vector<String> result = new Vector<>();
while (ix < hands.length()) {
int end = ix;
while (end < hands.length()) {
if (Character.isWhitespace(hands.charAt(end))) {
break;
}
if (hands.charAt(end) == ',') {
break;
}
end++;
}
String word = hands.substring(ix, end);
ix = end+1;
word = word.trim();
if (word.length() == 0) {
continue;
}
result.add(word);
}
return result.toArray(new String[result.size()]);
} | [
"private",
"String",
"[",
"]",
"parseClassNames",
"(",
"String",
"propertyName",
")",
"{",
"String",
"hands",
"=",
"getProperty",
"(",
"propertyName",
")",
";",
"if",
"(",
"hands",
"==",
"null",
")",
"{",
"return",
"new",
"String",
"[",
"0",
"]",
";",
... | get a list of whitespace separated classnames from a property. | [
"get",
"a",
"list",
"of",
"whitespace",
"separated",
"classnames",
"from",
"a",
"property",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L1212-L1240 |
34,232 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.getProperty | public String getProperty(String name) {
Object oval = props.get(name);
String sval = (oval instanceof String) ? (String) oval : null;
return sval;
} | java | public String getProperty(String name) {
Object oval = props.get(name);
String sval = (oval instanceof String) ? (String) oval : null;
return sval;
} | [
"public",
"String",
"getProperty",
"(",
"String",
"name",
")",
"{",
"Object",
"oval",
"=",
"props",
".",
"get",
"(",
"name",
")",
";",
"String",
"sval",
"=",
"(",
"oval",
"instanceof",
"String",
")",
"?",
"(",
"String",
")",
"oval",
":",
"null",
";",... | Get the value of a logging property.
The method returns null if the property is not found.
@param name property name
@return property value | [
"Get",
"the",
"value",
"of",
"a",
"logging",
"property",
".",
"The",
"method",
"returns",
"null",
"if",
"the",
"property",
"is",
"not",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L1299-L1303 |
34,233 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.getStringProperty | String getStringProperty(String name, String defaultValue) {
String val = getProperty(name);
if (val == null) {
return defaultValue;
}
return val.trim();
} | java | String getStringProperty(String name, String defaultValue) {
String val = getProperty(name);
if (val == null) {
return defaultValue;
}
return val.trim();
} | [
"String",
"getStringProperty",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"val",
"=",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"val",
".",... | default value. | [
"default",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L1308-L1314 |
34,234 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.setLevelsOnExistingLoggers | synchronized private void setLevelsOnExistingLoggers() {
Enumeration<?> enm = props.keys();
while (enm.hasMoreElements()) {
String key = (String) enm.nextElement();
if (!key.endsWith(".level")) {
// Not a level definition.
continue;
}
int ix = key.length() - 6;
String name = key.substring(0, ix);
Level level = getLevelProperty(key, null);
if (level == null) {
System.err.println("Bad level value for property: " + key);
continue;
}
for (LoggerContext cx : contexts()) {
Logger l = cx.findLogger(name);
if (l == null) {
continue;
}
l.setLevel(level);
}
}
} | java | synchronized private void setLevelsOnExistingLoggers() {
Enumeration<?> enm = props.keys();
while (enm.hasMoreElements()) {
String key = (String) enm.nextElement();
if (!key.endsWith(".level")) {
// Not a level definition.
continue;
}
int ix = key.length() - 6;
String name = key.substring(0, ix);
Level level = getLevelProperty(key, null);
if (level == null) {
System.err.println("Bad level value for property: " + key);
continue;
}
for (LoggerContext cx : contexts()) {
Logger l = cx.findLogger(name);
if (l == null) {
continue;
}
l.setLevel(level);
}
}
} | [
"synchronized",
"private",
"void",
"setLevelsOnExistingLoggers",
"(",
")",
"{",
"Enumeration",
"<",
"?",
">",
"enm",
"=",
"props",
".",
"keys",
"(",
")",
";",
"while",
"(",
"enm",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"String",
"key",
"=",
"(",
"... | changed to apply any level settings to any pre-existing loggers. | [
"changed",
"to",
"apply",
"any",
"level",
"settings",
"to",
"any",
"pre",
"-",
"existing",
"loggers",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L1509-L1532 |
34,235 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java | LogManager.reflectionStrippedProcessing | private void reflectionStrippedProcessing() {
HashMap<Object, Object> newEntries = new HashMap<>();
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key = (String) entry.getKey();
int index = key.lastIndexOf('.');
if (index == -1 || index == 0 || index == key.length() - 1) {
continue;
}
String prefix = key.substring(0, index);
String suffix = key.substring(index + 1);
String newKey = ReflectionUtil.getCamelCase(prefix) + "." + suffix;
if (!props.containsKey(newKey)) {
newEntries.put(newKey, entry.getValue());
}
}
props.putAll(newEntries);
} | java | private void reflectionStrippedProcessing() {
HashMap<Object, Object> newEntries = new HashMap<>();
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key = (String) entry.getKey();
int index = key.lastIndexOf('.');
if (index == -1 || index == 0 || index == key.length() - 1) {
continue;
}
String prefix = key.substring(0, index);
String suffix = key.substring(index + 1);
String newKey = ReflectionUtil.getCamelCase(prefix) + "." + suffix;
if (!props.containsKey(newKey)) {
newEntries.put(newKey, entry.getValue());
}
}
props.putAll(newEntries);
} | [
"private",
"void",
"reflectionStrippedProcessing",
"(",
")",
"{",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"newEntries",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
... | JavaIoFileOutputStream.level instead of java.io.FileOutputStream.level). | [
"JavaIoFileOutputStream",
".",
"level",
"instead",
"of",
"java",
".",
"io",
".",
"FileOutputStream",
".",
"level",
")",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L1577-L1593 |
34,236 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java | Long.toUnsignedBigInteger | private static BigInteger toUnsignedBigInteger(long i) {
if (i >= 0L)
return BigInteger.valueOf(i);
else {
int upper = (int) (i >>> 32);
int lower = (int) i;
// return (upper << 32) + lower
return (BigInteger.valueOf(Integer.toUnsignedLong(upper))).shiftLeft(32).
add(BigInteger.valueOf(Integer.toUnsignedLong(lower)));
}
} | java | private static BigInteger toUnsignedBigInteger(long i) {
if (i >= 0L)
return BigInteger.valueOf(i);
else {
int upper = (int) (i >>> 32);
int lower = (int) i;
// return (upper << 32) + lower
return (BigInteger.valueOf(Integer.toUnsignedLong(upper))).shiftLeft(32).
add(BigInteger.valueOf(Integer.toUnsignedLong(lower)));
}
} | [
"private",
"static",
"BigInteger",
"toUnsignedBigInteger",
"(",
"long",
"i",
")",
"{",
"if",
"(",
"i",
">=",
"0L",
")",
"return",
"BigInteger",
".",
"valueOf",
"(",
"i",
")",
";",
"else",
"{",
"int",
"upper",
"=",
"(",
"int",
")",
"(",
"i",
">>>",
... | Return a BigInteger equal to the unsigned value of the
argument. | [
"Return",
"a",
"BigInteger",
"equal",
"to",
"the",
"unsigned",
"value",
"of",
"the",
"argument",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java#L127-L138 |
34,237 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java | Long.divideUnsigned | public static long divideUnsigned(long dividend, long divisor) {
if (divisor < 0L) { // signed comparison
// Answer must be 0 or 1 depending on relative magnitude
// of dividend and divisor.
return (compareUnsigned(dividend, divisor)) < 0 ? 0L :1L;
}
if (dividend > 0) // Both inputs non-negative
return dividend/divisor;
else {
/*
* For simple code, leveraging BigInteger. Longer and faster
* code written directly in terms of operations on longs is
* possible; see "Hacker's Delight" for divide and remainder
* algorithms.
*/
return toUnsignedBigInteger(dividend).
divide(toUnsignedBigInteger(divisor)).longValue();
}
} | java | public static long divideUnsigned(long dividend, long divisor) {
if (divisor < 0L) { // signed comparison
// Answer must be 0 or 1 depending on relative magnitude
// of dividend and divisor.
return (compareUnsigned(dividend, divisor)) < 0 ? 0L :1L;
}
if (dividend > 0) // Both inputs non-negative
return dividend/divisor;
else {
/*
* For simple code, leveraging BigInteger. Longer and faster
* code written directly in terms of operations on longs is
* possible; see "Hacker's Delight" for divide and remainder
* algorithms.
*/
return toUnsignedBigInteger(dividend).
divide(toUnsignedBigInteger(divisor)).longValue();
}
} | [
"public",
"static",
"long",
"divideUnsigned",
"(",
"long",
"dividend",
",",
"long",
"divisor",
")",
"{",
"if",
"(",
"divisor",
"<",
"0L",
")",
"{",
"// signed comparison",
"// Answer must be 0 or 1 depending on relative magnitude",
"// of dividend and divisor.",
"return",... | Returns the unsigned quotient of dividing the first argument by
the second where each argument and the result is interpreted as
an unsigned value.
<p>Note that in two's complement arithmetic, the three other
basic arithmetic operations of add, subtract, and multiply are
bit-wise identical if the two operands are regarded as both
being signed or both being unsigned. Therefore separate {@code
addUnsigned}, etc. methods are not provided.
@param dividend the value to be divided
@param divisor the value doing the dividing
@return the unsigned quotient of the first argument divided by
the second argument
@see #remainderUnsigned
@since 1.8 | [
"Returns",
"the",
"unsigned",
"quotient",
"of",
"dividing",
"the",
"first",
"argument",
"by",
"the",
"second",
"where",
"each",
"argument",
"and",
"the",
"result",
"is",
"interpreted",
"as",
"an",
"unsigned",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java#L1138-L1157 |
34,238 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java | Long.remainderUnsigned | public static long remainderUnsigned(long dividend, long divisor) {
if (dividend > 0 && divisor > 0) { // signed comparisons
return dividend % divisor;
} else {
if (compareUnsigned(dividend, divisor) < 0) // Avoid explicit check for 0 divisor
return dividend;
else
return toUnsignedBigInteger(dividend).
remainder(toUnsignedBigInteger(divisor)).longValue();
}
} | java | public static long remainderUnsigned(long dividend, long divisor) {
if (dividend > 0 && divisor > 0) { // signed comparisons
return dividend % divisor;
} else {
if (compareUnsigned(dividend, divisor) < 0) // Avoid explicit check for 0 divisor
return dividend;
else
return toUnsignedBigInteger(dividend).
remainder(toUnsignedBigInteger(divisor)).longValue();
}
} | [
"public",
"static",
"long",
"remainderUnsigned",
"(",
"long",
"dividend",
",",
"long",
"divisor",
")",
"{",
"if",
"(",
"dividend",
">",
"0",
"&&",
"divisor",
">",
"0",
")",
"{",
"// signed comparisons",
"return",
"dividend",
"%",
"divisor",
";",
"}",
"else... | Returns the unsigned remainder from dividing the first argument
by the second where each argument and the result is interpreted
as an unsigned value.
@param dividend the value to be divided
@param divisor the value doing the dividing
@return the unsigned remainder of the first argument divided by
the second argument
@see #divideUnsigned
@since 1.8 | [
"Returns",
"the",
"unsigned",
"remainder",
"from",
"dividing",
"the",
"first",
"argument",
"by",
"the",
"second",
"where",
"each",
"argument",
"and",
"the",
"result",
"is",
"interpreted",
"as",
"an",
"unsigned",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java#L1171-L1181 |
34,239 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemForEach.java | ElemForEach.sortNodes | public DTMIterator sortNodes(
XPathContext xctxt, Vector keys, DTMIterator sourceNodes)
throws TransformerException
{
NodeSorter sorter = new NodeSorter(xctxt);
sourceNodes.setShouldCacheNodes(true);
sourceNodes.runTo(-1);
xctxt.pushContextNodeList(sourceNodes);
try
{
sorter.sort(sourceNodes, keys, xctxt);
sourceNodes.setCurrentPos(0);
}
finally
{
xctxt.popContextNodeList();
}
return sourceNodes;
} | java | public DTMIterator sortNodes(
XPathContext xctxt, Vector keys, DTMIterator sourceNodes)
throws TransformerException
{
NodeSorter sorter = new NodeSorter(xctxt);
sourceNodes.setShouldCacheNodes(true);
sourceNodes.runTo(-1);
xctxt.pushContextNodeList(sourceNodes);
try
{
sorter.sort(sourceNodes, keys, xctxt);
sourceNodes.setCurrentPos(0);
}
finally
{
xctxt.popContextNodeList();
}
return sourceNodes;
} | [
"public",
"DTMIterator",
"sortNodes",
"(",
"XPathContext",
"xctxt",
",",
"Vector",
"keys",
",",
"DTMIterator",
"sourceNodes",
")",
"throws",
"TransformerException",
"{",
"NodeSorter",
"sorter",
"=",
"new",
"NodeSorter",
"(",
"xctxt",
")",
";",
"sourceNodes",
".",
... | Sort given nodes
@param xctxt The XPath runtime state for the sort.
@param keys Vector of sort keyx
@param sourceNodes Iterator of nodes to sort
@return iterator of sorted nodes
@throws TransformerException | [
"Sort",
"given",
"nodes"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemForEach.java#L293-L314 |
34,240 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java | ICULocaleService.registerObject | public Factory registerObject(Object obj, ULocale locale, int kind, boolean visible) {
Factory factory = new SimpleLocaleKeyFactory(obj, locale, kind, visible);
return registerFactory(factory);
} | java | public Factory registerObject(Object obj, ULocale locale, int kind, boolean visible) {
Factory factory = new SimpleLocaleKeyFactory(obj, locale, kind, visible);
return registerFactory(factory);
} | [
"public",
"Factory",
"registerObject",
"(",
"Object",
"obj",
",",
"ULocale",
"locale",
",",
"int",
"kind",
",",
"boolean",
"visible",
")",
"{",
"Factory",
"factory",
"=",
"new",
"SimpleLocaleKeyFactory",
"(",
"obj",
",",
"locale",
",",
"kind",
",",
"visible"... | Convenience function for callers using locales. This instantiates
a SimpleLocaleKeyFactory, and registers the factory. | [
"Convenience",
"function",
"for",
"callers",
"using",
"locales",
".",
"This",
"instantiates",
"a",
"SimpleLocaleKeyFactory",
"and",
"registers",
"the",
"factory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java#L119-L122 |
34,241 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java | ICULocaleService.getAvailableLocales | public Locale[] getAvailableLocales() {
// TODO make this wrap getAvailableULocales later
Set<String> visIDs = getVisibleIDs();
Locale[] locales = new Locale[visIDs.size()];
int n = 0;
for (String id : visIDs) {
Locale loc = LocaleUtility.getLocaleFromName(id);
locales[n++] = loc;
}
return locales;
} | java | public Locale[] getAvailableLocales() {
// TODO make this wrap getAvailableULocales later
Set<String> visIDs = getVisibleIDs();
Locale[] locales = new Locale[visIDs.size()];
int n = 0;
for (String id : visIDs) {
Locale loc = LocaleUtility.getLocaleFromName(id);
locales[n++] = loc;
}
return locales;
} | [
"public",
"Locale",
"[",
"]",
"getAvailableLocales",
"(",
")",
"{",
"// TODO make this wrap getAvailableULocales later",
"Set",
"<",
"String",
">",
"visIDs",
"=",
"getVisibleIDs",
"(",
")",
";",
"Locale",
"[",
"]",
"locales",
"=",
"new",
"Locale",
"[",
"visIDs",... | Convenience method for callers using locales. This returns the standard
Locale list, built from the Set of visible ids. | [
"Convenience",
"method",
"for",
"callers",
"using",
"locales",
".",
"This",
"returns",
"the",
"standard",
"Locale",
"list",
"built",
"from",
"the",
"Set",
"of",
"visible",
"ids",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java#L128-L138 |
34,242 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java | ICULocaleService.getAvailableULocales | public ULocale[] getAvailableULocales() {
Set<String> visIDs = getVisibleIDs();
ULocale[] locales = new ULocale[visIDs.size()];
int n = 0;
for (String id : visIDs) {
locales[n++] = new ULocale(id);
}
return locales;
} | java | public ULocale[] getAvailableULocales() {
Set<String> visIDs = getVisibleIDs();
ULocale[] locales = new ULocale[visIDs.size()];
int n = 0;
for (String id : visIDs) {
locales[n++] = new ULocale(id);
}
return locales;
} | [
"public",
"ULocale",
"[",
"]",
"getAvailableULocales",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"visIDs",
"=",
"getVisibleIDs",
"(",
")",
";",
"ULocale",
"[",
"]",
"locales",
"=",
"new",
"ULocale",
"[",
"visIDs",
".",
"size",
"(",
")",
"]",
";",
"in... | Convenience method for callers using locales. This returns the standard
ULocale list, built from the Set of visible ids. | [
"Convenience",
"method",
"for",
"callers",
"using",
"locales",
".",
"This",
"returns",
"the",
"standard",
"ULocale",
"list",
"built",
"from",
"the",
"Set",
"of",
"visible",
"ids",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java#L144-L152 |
34,243 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java | ICULocaleService.validateFallbackLocale | public String validateFallbackLocale() {
ULocale loc = ULocale.getDefault();
if (loc != fallbackLocale) {
synchronized (this) {
if (loc != fallbackLocale) {
fallbackLocale = loc;
fallbackLocaleName = loc.getBaseName();
clearServiceCache();
}
}
}
return fallbackLocaleName;
} | java | public String validateFallbackLocale() {
ULocale loc = ULocale.getDefault();
if (loc != fallbackLocale) {
synchronized (this) {
if (loc != fallbackLocale) {
fallbackLocale = loc;
fallbackLocaleName = loc.getBaseName();
clearServiceCache();
}
}
}
return fallbackLocaleName;
} | [
"public",
"String",
"validateFallbackLocale",
"(",
")",
"{",
"ULocale",
"loc",
"=",
"ULocale",
".",
"getDefault",
"(",
")",
";",
"if",
"(",
"loc",
"!=",
"fallbackLocale",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"loc",
"!=",
"fallbackL... | Return the name of the current fallback locale. If it has changed since this was
last accessed, the service cache is cleared. | [
"Return",
"the",
"name",
"of",
"the",
"current",
"fallback",
"locale",
".",
"If",
"it",
"has",
"changed",
"since",
"this",
"was",
"last",
"accessed",
"the",
"service",
"cache",
"is",
"cleared",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICULocaleService.java#L614-L626 |
34,244 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Socks4Message.java | Socks4Message.setIP | public void setIP(byte[] ip) {
buffer[INDEX_IP] = ip[0];
buffer[INDEX_IP + 1] = ip[1];
buffer[INDEX_IP + 2] = ip[2];
buffer[INDEX_IP + 3] = ip[3];
} | java | public void setIP(byte[] ip) {
buffer[INDEX_IP] = ip[0];
buffer[INDEX_IP + 1] = ip[1];
buffer[INDEX_IP + 2] = ip[2];
buffer[INDEX_IP + 3] = ip[3];
} | [
"public",
"void",
"setIP",
"(",
"byte",
"[",
"]",
"ip",
")",
"{",
"buffer",
"[",
"INDEX_IP",
"]",
"=",
"ip",
"[",
"0",
"]",
";",
"buffer",
"[",
"INDEX_IP",
"+",
"1",
"]",
"=",
"ip",
"[",
"1",
"]",
";",
"buffer",
"[",
"INDEX_IP",
"+",
"2",
"]"... | Set the IP address. This expects an array of four bytes in host order. | [
"Set",
"the",
"IP",
"address",
".",
"This",
"expects",
"an",
"array",
"of",
"four",
"bytes",
"in",
"host",
"order",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Socks4Message.java#L100-L105 |
34,245 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Socks4Message.java | Socks4Message.getString | private String getString(int offset, int maxLength) {
int index = offset;
int lastIndex = index + maxLength;
while (index < lastIndex && (buffer[index] != 0)) {
index++;
}
return new String(buffer, offset, index - offset, StandardCharsets.ISO_8859_1);
} | java | private String getString(int offset, int maxLength) {
int index = offset;
int lastIndex = index + maxLength;
while (index < lastIndex && (buffer[index] != 0)) {
index++;
}
return new String(buffer, offset, index - offset, StandardCharsets.ISO_8859_1);
} | [
"private",
"String",
"getString",
"(",
"int",
"offset",
",",
"int",
"maxLength",
")",
"{",
"int",
"index",
"=",
"offset",
";",
"int",
"lastIndex",
"=",
"index",
"+",
"maxLength",
";",
"while",
"(",
"index",
"<",
"lastIndex",
"&&",
"(",
"buffer",
"[",
"... | Get a String from the buffer at the offset given. The method reads until
it encounters a null value or reaches the maxLength given. | [
"Get",
"a",
"String",
"from",
"the",
"buffer",
"at",
"the",
"offset",
"given",
".",
"The",
"method",
"reads",
"until",
"it",
"encounters",
"a",
"null",
"value",
"or",
"reaches",
"the",
"maxLength",
"given",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Socks4Message.java#L185-L192 |
34,246 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Socks4Message.java | Socks4Message.setString | private void setString(int offset, int maxLength, String theString) {
byte[] stringBytes = theString.getBytes(StandardCharsets.ISO_8859_1);
int length = Math.min(stringBytes.length, maxLength);
System.arraycopy(stringBytes, 0, buffer, offset, length);
buffer[offset + length] = 0;
} | java | private void setString(int offset, int maxLength, String theString) {
byte[] stringBytes = theString.getBytes(StandardCharsets.ISO_8859_1);
int length = Math.min(stringBytes.length, maxLength);
System.arraycopy(stringBytes, 0, buffer, offset, length);
buffer[offset + length] = 0;
} | [
"private",
"void",
"setString",
"(",
"int",
"offset",
",",
"int",
"maxLength",
",",
"String",
"theString",
")",
"{",
"byte",
"[",
"]",
"stringBytes",
"=",
"theString",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"ISO_8859_1",
")",
";",
"int",
"length",
... | Put a string into the buffer at the offset given. | [
"Put",
"a",
"string",
"into",
"the",
"buffer",
"at",
"the",
"offset",
"given",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Socks4Message.java#L204-L209 |
34,247 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/CipherOutputStream.java | CipherOutputStream.flush | public void flush() throws IOException {
if (obuffer != null) {
output.write(obuffer);
obuffer = null;
}
output.flush();
} | java | public void flush() throws IOException {
if (obuffer != null) {
output.write(obuffer);
obuffer = null;
}
output.flush();
} | [
"public",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"obuffer",
"!=",
"null",
")",
"{",
"output",
".",
"write",
"(",
"obuffer",
")",
";",
"obuffer",
"=",
"null",
";",
"}",
"output",
".",
"flush",
"(",
")",
";",
"}"
] | Flushes this output stream by forcing any buffered output bytes
that have already been processed by the encapsulated cipher object
to be written out.
<p>Any bytes buffered by the encapsulated cipher
and waiting to be processed by it will not be written out. For example,
if the encapsulated cipher is a block cipher, and the total number of
bytes written using one of the <code>write</code> methods is less than
the cipher's block size, no bytes will be written out.
@exception IOException if an I/O error occurs.
@since JCE1.2 | [
"Flushes",
"this",
"output",
"stream",
"by",
"forcing",
"any",
"buffered",
"output",
"bytes",
"that",
"have",
"already",
"been",
"processed",
"by",
"the",
"encapsulated",
"cipher",
"object",
"to",
"be",
"written",
"out",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/CipherOutputStream.java#L179-L185 |
34,248 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java | AbstractSelectableChannel.configureBlocking | public final SelectableChannel configureBlocking(boolean block)
throws IOException
{
synchronized (regLock) {
if (!isOpen())
throw new ClosedChannelException();
if (blocking == block)
return this;
if (block && haveValidKeys())
throw new IllegalBlockingModeException();
implConfigureBlocking(block);
blocking = block;
}
return this;
} | java | public final SelectableChannel configureBlocking(boolean block)
throws IOException
{
synchronized (regLock) {
if (!isOpen())
throw new ClosedChannelException();
if (blocking == block)
return this;
if (block && haveValidKeys())
throw new IllegalBlockingModeException();
implConfigureBlocking(block);
blocking = block;
}
return this;
} | [
"public",
"final",
"SelectableChannel",
"configureBlocking",
"(",
"boolean",
"block",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"regLock",
")",
"{",
"if",
"(",
"!",
"isOpen",
"(",
")",
")",
"throw",
"new",
"ClosedChannelException",
"(",
")",
";",... | Adjusts this channel's blocking mode.
<p> If the given blocking mode is different from the current blocking
mode then this method invokes the {@link #implConfigureBlocking
implConfigureBlocking} method, while holding the appropriate locks, in
order to change the mode. </p> | [
"Adjusts",
"this",
"channel",
"s",
"blocking",
"mode",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/spi/AbstractSelectableChannel.java#L284-L298 |
34,249 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TextTrieMap.java | TextTrieMap.put | public TextTrieMap<V> put(CharSequence text, V val) {
CharIterator chitr = new CharIterator(text, 0, _ignoreCase);
_root.add(chitr, val);
return this;
} | java | public TextTrieMap<V> put(CharSequence text, V val) {
CharIterator chitr = new CharIterator(text, 0, _ignoreCase);
_root.add(chitr, val);
return this;
} | [
"public",
"TextTrieMap",
"<",
"V",
">",
"put",
"(",
"CharSequence",
"text",
",",
"V",
"val",
")",
"{",
"CharIterator",
"chitr",
"=",
"new",
"CharIterator",
"(",
"text",
",",
"0",
",",
"_ignoreCase",
")",
";",
"_root",
".",
"add",
"(",
"chitr",
",",
"... | Adds the text key and its associated object in this object.
@param text The text.
@param val The value object associated with the text. | [
"Adds",
"the",
"text",
"key",
"and",
"its",
"associated",
"object",
"in",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TextTrieMap.java#L44-L48 |
34,250 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TextTrieMap.java | TextTrieMap.get | public Iterator<V> get(CharSequence text, int start) {
return get(text, start, null);
} | java | public Iterator<V> get(CharSequence text, int start) {
return get(text, start, null);
} | [
"public",
"Iterator",
"<",
"V",
">",
"get",
"(",
"CharSequence",
"text",
",",
"int",
"start",
")",
"{",
"return",
"get",
"(",
"text",
",",
"start",
",",
"null",
")",
";",
"}"
] | Gets an iterator of the objects associated with the
longest prefix matching string key starting at the
specified position.
@param text The text to be matched with prefixes.
@param start The start index of of the text
@return An iterator of the objects associated with the
longest prefix matching matching key, or null if no
matching entry is found. | [
"Gets",
"an",
"iterator",
"of",
"the",
"objects",
"associated",
"with",
"the",
"longest",
"prefix",
"matching",
"string",
"key",
"starting",
"at",
"the",
"specified",
"position",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TextTrieMap.java#L74-L76 |
34,251 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getExemplarSet | public UnicodeSet getExemplarSet(int options, int extype) {
String [] exemplarSetTypes = {
"ExemplarCharacters",
"AuxExemplarCharacters",
"ExemplarCharactersIndex",
"ExemplarCharactersCurrency",
"ExemplarCharactersPunctuation"
};
if (extype == ES_CURRENCY) {
// currency symbol exemplar is no longer available
return noSubstitute ? null : UnicodeSet.EMPTY;
}
try{
final String aKey = exemplarSetTypes[extype]; // will throw an out-of-bounds exception
ICUResourceBundle stringBundle = (ICUResourceBundle) bundle.get(aKey);
if (noSubstitute && !bundle.isRoot() && stringBundle.isRoot()) {
return null;
}
String unicodeSetPattern = stringBundle.getString();
return new UnicodeSet(unicodeSetPattern, UnicodeSet.IGNORE_SPACE | options);
} catch (ArrayIndexOutOfBoundsException aiooe) {
throw new IllegalArgumentException(aiooe);
} catch (Exception ex){
return noSubstitute ? null : UnicodeSet.EMPTY;
}
} | java | public UnicodeSet getExemplarSet(int options, int extype) {
String [] exemplarSetTypes = {
"ExemplarCharacters",
"AuxExemplarCharacters",
"ExemplarCharactersIndex",
"ExemplarCharactersCurrency",
"ExemplarCharactersPunctuation"
};
if (extype == ES_CURRENCY) {
// currency symbol exemplar is no longer available
return noSubstitute ? null : UnicodeSet.EMPTY;
}
try{
final String aKey = exemplarSetTypes[extype]; // will throw an out-of-bounds exception
ICUResourceBundle stringBundle = (ICUResourceBundle) bundle.get(aKey);
if (noSubstitute && !bundle.isRoot() && stringBundle.isRoot()) {
return null;
}
String unicodeSetPattern = stringBundle.getString();
return new UnicodeSet(unicodeSetPattern, UnicodeSet.IGNORE_SPACE | options);
} catch (ArrayIndexOutOfBoundsException aiooe) {
throw new IllegalArgumentException(aiooe);
} catch (Exception ex){
return noSubstitute ? null : UnicodeSet.EMPTY;
}
} | [
"public",
"UnicodeSet",
"getExemplarSet",
"(",
"int",
"options",
",",
"int",
"extype",
")",
"{",
"String",
"[",
"]",
"exemplarSetTypes",
"=",
"{",
"\"ExemplarCharacters\"",
",",
"\"AuxExemplarCharacters\"",
",",
"\"ExemplarCharactersIndex\"",
",",
"\"ExemplarCharactersC... | Returns the set of exemplar characters for a locale.
@param options Bitmask for options to apply to the exemplar pattern.
Specify zero to retrieve the exemplar set as it is
defined in the locale data. Specify
UnicodeSet.CASE to retrieve a case-folded exemplar
set. See {@link UnicodeSet#applyPattern(String,
int)} for a complete list of valid options. The
IGNORE_SPACE bit is always set, regardless of the
value of 'options'.
@param extype The type of exemplar set to be retrieved,
ES_STANDARD, ES_INDEX, ES_AUXILIARY, or ES_PUNCTUATION
@return The set of exemplar characters for the given locale.
If there is nothing available for the locale,
then null is returned if {@link #getNoSubstitute()} is true, otherwise the
root value is returned (which may be UnicodeSet.EMPTY).
@exception RuntimeException if the extype is invalid. | [
"Returns",
"the",
"set",
"of",
"exemplar",
"characters",
"for",
"a",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L178-L206 |
34,252 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getInstance | public static final LocaleData getInstance(ULocale locale) {
LocaleData ld = new LocaleData();
ld.bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
ld.langBundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_LANG_BASE_NAME, locale);
ld.noSubstitute = false;
return ld;
} | java | public static final LocaleData getInstance(ULocale locale) {
LocaleData ld = new LocaleData();
ld.bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
ld.langBundle = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_LANG_BASE_NAME, locale);
ld.noSubstitute = false;
return ld;
} | [
"public",
"static",
"final",
"LocaleData",
"getInstance",
"(",
"ULocale",
"locale",
")",
"{",
"LocaleData",
"ld",
"=",
"new",
"LocaleData",
"(",
")",
";",
"ld",
".",
"bundle",
"=",
"(",
"ICUResourceBundle",
")",
"UResourceBundle",
".",
"getBundleInstance",
"("... | Gets the LocaleData object associated with the ULocale specified in locale
@param locale Locale with thich the locale data object is associated.
@return A locale data object. | [
"Gets",
"the",
"LocaleData",
"object",
"associated",
"with",
"the",
"ULocale",
"specified",
"in",
"locale"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L214-L220 |
34,253 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getDelimiter | public String getDelimiter(int type) {
ICUResourceBundle delimitersBundle = (ICUResourceBundle) bundle.get("delimiters");
// Only some of the quotation marks may be here. So we make sure that we do a multilevel fallback.
ICUResourceBundle stringBundle = delimitersBundle.getWithFallback(DELIMITER_TYPES[type]);
if (noSubstitute && !bundle.isRoot() && stringBundle.isRoot()) {
return null;
}
return stringBundle.getString();
} | java | public String getDelimiter(int type) {
ICUResourceBundle delimitersBundle = (ICUResourceBundle) bundle.get("delimiters");
// Only some of the quotation marks may be here. So we make sure that we do a multilevel fallback.
ICUResourceBundle stringBundle = delimitersBundle.getWithFallback(DELIMITER_TYPES[type]);
if (noSubstitute && !bundle.isRoot() && stringBundle.isRoot()) {
return null;
}
return stringBundle.getString();
} | [
"public",
"String",
"getDelimiter",
"(",
"int",
"type",
")",
"{",
"ICUResourceBundle",
"delimitersBundle",
"=",
"(",
"ICUResourceBundle",
")",
"bundle",
".",
"get",
"(",
"\"delimiters\"",
")",
";",
"// Only some of the quotation marks may be here. So we make sure that we do... | Retrieves a delimiter string from the locale data.
@param type The type of delimiter string desired. Currently,
the valid choices are QUOTATION_START, QUOTATION_END,
ALT_QUOTATION_START, or ALT_QUOTATION_END.
@return The desired delimiter string. | [
"Retrieves",
"a",
"delimiter",
"string",
"from",
"the",
"locale",
"data",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L271-L280 |
34,254 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.measurementTypeBundleForLocale | private static UResourceBundle measurementTypeBundleForLocale(ULocale locale, String measurementType){
// Much of this is taken from getCalendarType in impl/CalendarUtil.java
UResourceBundle measTypeBundle = null;
String region = ULocale.getRegionForSupplementalData(locale, true);
try {
UResourceBundle rb = UResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME,
"supplementalData",
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle measurementData = rb.get("measurementData");
UResourceBundle measDataBundle = null;
try {
measDataBundle = measurementData.get(region);
measTypeBundle = measDataBundle.get(measurementType);
} catch (MissingResourceException mre) {
// use "001" as fallback
measDataBundle = measurementData.get("001");
measTypeBundle = measDataBundle.get(measurementType);
}
} catch (MissingResourceException mre) {
// fall through
}
return measTypeBundle;
} | java | private static UResourceBundle measurementTypeBundleForLocale(ULocale locale, String measurementType){
// Much of this is taken from getCalendarType in impl/CalendarUtil.java
UResourceBundle measTypeBundle = null;
String region = ULocale.getRegionForSupplementalData(locale, true);
try {
UResourceBundle rb = UResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME,
"supplementalData",
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle measurementData = rb.get("measurementData");
UResourceBundle measDataBundle = null;
try {
measDataBundle = measurementData.get(region);
measTypeBundle = measDataBundle.get(measurementType);
} catch (MissingResourceException mre) {
// use "001" as fallback
measDataBundle = measurementData.get("001");
measTypeBundle = measDataBundle.get(measurementType);
}
} catch (MissingResourceException mre) {
// fall through
}
return measTypeBundle;
} | [
"private",
"static",
"UResourceBundle",
"measurementTypeBundleForLocale",
"(",
"ULocale",
"locale",
",",
"String",
"measurementType",
")",
"{",
"// Much of this is taken from getCalendarType in impl/CalendarUtil.java",
"UResourceBundle",
"measTypeBundle",
"=",
"null",
";",
"Strin... | Utility for getMeasurementSystem and getPaperSize | [
"Utility",
"for",
"getMeasurementSystem",
"and",
"getPaperSize"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L285-L308 |
34,255 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getMeasurementSystem | public static final MeasurementSystem getMeasurementSystem(ULocale locale){
UResourceBundle sysBundle = measurementTypeBundleForLocale(locale, MEASUREMENT_SYSTEM);
switch (sysBundle.getInt()) {
case 0: return MeasurementSystem.SI;
case 1: return MeasurementSystem.US;
case 2: return MeasurementSystem.UK;
default:
// return null if the object is null or is not an instance
// of integer indicating an error
return null;
}
} | java | public static final MeasurementSystem getMeasurementSystem(ULocale locale){
UResourceBundle sysBundle = measurementTypeBundleForLocale(locale, MEASUREMENT_SYSTEM);
switch (sysBundle.getInt()) {
case 0: return MeasurementSystem.SI;
case 1: return MeasurementSystem.US;
case 2: return MeasurementSystem.UK;
default:
// return null if the object is null or is not an instance
// of integer indicating an error
return null;
}
} | [
"public",
"static",
"final",
"MeasurementSystem",
"getMeasurementSystem",
"(",
"ULocale",
"locale",
")",
"{",
"UResourceBundle",
"sysBundle",
"=",
"measurementTypeBundleForLocale",
"(",
"locale",
",",
"MEASUREMENT_SYSTEM",
")",
";",
"switch",
"(",
"sysBundle",
".",
"g... | Returns the measurement system used in the locale specified by the locale.
@param locale The locale for which the measurement system to be retrieved.
@return MeasurementSystem the measurement system used in the locale. | [
"Returns",
"the",
"measurement",
"system",
"used",
"in",
"the",
"locale",
"specified",
"by",
"the",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L340-L352 |
34,256 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getLocaleSeparator | public String getLocaleSeparator() {
String sub0 = "{0}";
String sub1 = "{1}";
ICUResourceBundle locDispBundle = (ICUResourceBundle) langBundle.get(LOCALE_DISPLAY_PATTERN);
String localeSeparator = locDispBundle.getStringWithFallback(SEPARATOR);
int index0 = localeSeparator.indexOf(sub0);
int index1 = localeSeparator.indexOf(sub1);
if (index0 >= 0 && index1 >= 0 && index0 <= index1) {
return localeSeparator.substring(index0 + sub0.length(), index1);
}
return localeSeparator;
} | java | public String getLocaleSeparator() {
String sub0 = "{0}";
String sub1 = "{1}";
ICUResourceBundle locDispBundle = (ICUResourceBundle) langBundle.get(LOCALE_DISPLAY_PATTERN);
String localeSeparator = locDispBundle.getStringWithFallback(SEPARATOR);
int index0 = localeSeparator.indexOf(sub0);
int index1 = localeSeparator.indexOf(sub1);
if (index0 >= 0 && index1 >= 0 && index0 <= index1) {
return localeSeparator.substring(index0 + sub0.length(), index1);
}
return localeSeparator;
} | [
"public",
"String",
"getLocaleSeparator",
"(",
")",
"{",
"String",
"sub0",
"=",
"\"{0}\"",
";",
"String",
"sub1",
"=",
"\"{1}\"",
";",
"ICUResourceBundle",
"locDispBundle",
"=",
"(",
"ICUResourceBundle",
")",
"langBundle",
".",
"get",
"(",
"LOCALE_DISPLAY_PATTERN"... | Returns LocaleDisplaySeparator for this locale.
@return locale display separator as a char. | [
"Returns",
"LocaleDisplaySeparator",
"for",
"this",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L408-L419 |
34,257 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java | LocaleData.getCLDRVersion | public static VersionInfo getCLDRVersion() {
// fetching this data should be idempotent.
if(gCLDRVersion == null) {
// from ZoneMeta.java
UResourceBundle supplementalDataBundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "supplementalData", ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle cldrVersionBundle = supplementalDataBundle.get("cldrVersion");
gCLDRVersion = VersionInfo.getInstance(cldrVersionBundle.getString());
}
return gCLDRVersion;
} | java | public static VersionInfo getCLDRVersion() {
// fetching this data should be idempotent.
if(gCLDRVersion == null) {
// from ZoneMeta.java
UResourceBundle supplementalDataBundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "supplementalData", ICUResourceBundle.ICU_DATA_CLASS_LOADER);
UResourceBundle cldrVersionBundle = supplementalDataBundle.get("cldrVersion");
gCLDRVersion = VersionInfo.getInstance(cldrVersionBundle.getString());
}
return gCLDRVersion;
} | [
"public",
"static",
"VersionInfo",
"getCLDRVersion",
"(",
")",
"{",
"// fetching this data should be idempotent.",
"if",
"(",
"gCLDRVersion",
"==",
"null",
")",
"{",
"// from ZoneMeta.java",
"UResourceBundle",
"supplementalDataBundle",
"=",
"UResourceBundle",
".",
"getBundl... | Returns the current CLDR version | [
"Returns",
"the",
"current",
"CLDR",
"version"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleData.java#L426-L435 |
34,258 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FuncId.java | FuncId.getNodesByID | private StringVector getNodesByID(XPathContext xctxt, int docContext,
String refval, StringVector usedrefs,
NodeSetDTM nodeSet, boolean mayBeMore)
{
if (null != refval)
{
String ref = null;
// DOMHelper dh = xctxt.getDOMHelper();
StringTokenizer tokenizer = new StringTokenizer(refval);
boolean hasMore = tokenizer.hasMoreTokens();
DTM dtm = xctxt.getDTM(docContext);
while (hasMore)
{
ref = tokenizer.nextToken();
hasMore = tokenizer.hasMoreTokens();
if ((null != usedrefs) && usedrefs.contains(ref))
{
ref = null;
continue;
}
int node = dtm.getElementById(ref);
if (DTM.NULL != node)
nodeSet.addNodeInDocOrder(node, xctxt);
if ((null != ref) && (hasMore || mayBeMore))
{
if (null == usedrefs)
usedrefs = new StringVector();
usedrefs.addElement(ref);
}
}
}
return usedrefs;
} | java | private StringVector getNodesByID(XPathContext xctxt, int docContext,
String refval, StringVector usedrefs,
NodeSetDTM nodeSet, boolean mayBeMore)
{
if (null != refval)
{
String ref = null;
// DOMHelper dh = xctxt.getDOMHelper();
StringTokenizer tokenizer = new StringTokenizer(refval);
boolean hasMore = tokenizer.hasMoreTokens();
DTM dtm = xctxt.getDTM(docContext);
while (hasMore)
{
ref = tokenizer.nextToken();
hasMore = tokenizer.hasMoreTokens();
if ((null != usedrefs) && usedrefs.contains(ref))
{
ref = null;
continue;
}
int node = dtm.getElementById(ref);
if (DTM.NULL != node)
nodeSet.addNodeInDocOrder(node, xctxt);
if ((null != ref) && (hasMore || mayBeMore))
{
if (null == usedrefs)
usedrefs = new StringVector();
usedrefs.addElement(ref);
}
}
}
return usedrefs;
} | [
"private",
"StringVector",
"getNodesByID",
"(",
"XPathContext",
"xctxt",
",",
"int",
"docContext",
",",
"String",
"refval",
",",
"StringVector",
"usedrefs",
",",
"NodeSetDTM",
"nodeSet",
",",
"boolean",
"mayBeMore",
")",
"{",
"if",
"(",
"null",
"!=",
"refval",
... | Fill in a list with nodes that match a space delimited list if ID
ID references.
@param xctxt The runtime XPath context.
@param docContext The document where the nodes are being looked for.
@param refval A space delimited list of ID references.
@param usedrefs List of references for which nodes were found.
@param nodeSet Node set where the nodes will be added to.
@param mayBeMore true if there is another set of nodes to be looked for.
@return The usedrefs value. | [
"Fill",
"in",
"a",
"list",
"with",
"nodes",
"that",
"match",
"a",
"space",
"delimited",
"list",
"if",
"ID",
"ID",
"references",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FuncId.java#L55-L96 |
34,259 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java | FCDIterCollationIterator.switchToForward | private void switchToForward() {
assert(state == State.ITER_CHECK_BWD ||
(state == State.ITER_IN_FCD_SEGMENT && pos == limit) ||
(state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos == normalized.length()));
if(state == State.ITER_CHECK_BWD) {
// Turn around from backward checking.
start = pos = iter.getIndex();
if(pos == limit) {
state = State.ITER_CHECK_FWD; // Check forward.
} else { // pos < limit
state = State.ITER_IN_FCD_SEGMENT; // Stay in FCD segment.
}
} else {
// Reached the end of the FCD segment.
if(state == State.ITER_IN_FCD_SEGMENT) {
// The input text segment is FCD, extend it forward.
} else {
// The input text segment needed to be normalized.
// Switch to checking forward from it.
if(state == State.IN_NORM_ITER_AT_START) {
iter.moveIndex(limit - start);
}
start = limit;
}
state = State.ITER_CHECK_FWD;
}
} | java | private void switchToForward() {
assert(state == State.ITER_CHECK_BWD ||
(state == State.ITER_IN_FCD_SEGMENT && pos == limit) ||
(state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos == normalized.length()));
if(state == State.ITER_CHECK_BWD) {
// Turn around from backward checking.
start = pos = iter.getIndex();
if(pos == limit) {
state = State.ITER_CHECK_FWD; // Check forward.
} else { // pos < limit
state = State.ITER_IN_FCD_SEGMENT; // Stay in FCD segment.
}
} else {
// Reached the end of the FCD segment.
if(state == State.ITER_IN_FCD_SEGMENT) {
// The input text segment is FCD, extend it forward.
} else {
// The input text segment needed to be normalized.
// Switch to checking forward from it.
if(state == State.IN_NORM_ITER_AT_START) {
iter.moveIndex(limit - start);
}
start = limit;
}
state = State.ITER_CHECK_FWD;
}
} | [
"private",
"void",
"switchToForward",
"(",
")",
"{",
"assert",
"(",
"state",
"==",
"State",
".",
"ITER_CHECK_BWD",
"||",
"(",
"state",
"==",
"State",
".",
"ITER_IN_FCD_SEGMENT",
"&&",
"pos",
"==",
"limit",
")",
"||",
"(",
"state",
".",
"compareTo",
"(",
... | Switches to forward checking if possible. | [
"Switches",
"to",
"forward",
"checking",
"if",
"possible",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java#L226-L252 |
34,260 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java | FCDIterCollationIterator.nextSegment | private boolean nextSegment() {
assert(state == State.ITER_CHECK_FWD);
// The input text [start..(iter index)[ passes the FCD check.
pos = iter.getIndex();
// Collect the characters being checked, in case they need to be normalized.
if(s == null) {
s = new StringBuilder();
} else {
s.setLength(0);
}
int prevCC = 0;
for(;;) {
// Fetch the next character and its fcd16 value.
int c = iter.nextCodePoint();
if(c < 0) { break; }
int fcd16 = nfcImpl.getFCD16(c);
int leadCC = fcd16 >> 8;
if(leadCC == 0 && s.length() != 0) {
// FCD boundary before this character.
iter.previousCodePoint();
break;
}
s.appendCodePoint(c);
if(leadCC != 0 && (prevCC > leadCC || CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the next FCD boundary and normalize.
for(;;) {
c = iter.nextCodePoint();
if(c < 0) { break; }
if(nfcImpl.getFCD16(c) <= 0xff) {
iter.previousCodePoint();
break;
}
s.appendCodePoint(c);
}
normalize(s);
start = pos;
limit = pos + s.length();
state = State.IN_NORM_ITER_AT_LIMIT;
pos = 0;
return true;
}
prevCC = fcd16 & 0xff;
if(prevCC == 0) {
// FCD boundary after the last character.
break;
}
}
limit = pos + s.length();
assert(pos != limit);
iter.moveIndex(-s.length());
state = State.ITER_IN_FCD_SEGMENT;
return true;
} | java | private boolean nextSegment() {
assert(state == State.ITER_CHECK_FWD);
// The input text [start..(iter index)[ passes the FCD check.
pos = iter.getIndex();
// Collect the characters being checked, in case they need to be normalized.
if(s == null) {
s = new StringBuilder();
} else {
s.setLength(0);
}
int prevCC = 0;
for(;;) {
// Fetch the next character and its fcd16 value.
int c = iter.nextCodePoint();
if(c < 0) { break; }
int fcd16 = nfcImpl.getFCD16(c);
int leadCC = fcd16 >> 8;
if(leadCC == 0 && s.length() != 0) {
// FCD boundary before this character.
iter.previousCodePoint();
break;
}
s.appendCodePoint(c);
if(leadCC != 0 && (prevCC > leadCC || CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the next FCD boundary and normalize.
for(;;) {
c = iter.nextCodePoint();
if(c < 0) { break; }
if(nfcImpl.getFCD16(c) <= 0xff) {
iter.previousCodePoint();
break;
}
s.appendCodePoint(c);
}
normalize(s);
start = pos;
limit = pos + s.length();
state = State.IN_NORM_ITER_AT_LIMIT;
pos = 0;
return true;
}
prevCC = fcd16 & 0xff;
if(prevCC == 0) {
// FCD boundary after the last character.
break;
}
}
limit = pos + s.length();
assert(pos != limit);
iter.moveIndex(-s.length());
state = State.ITER_IN_FCD_SEGMENT;
return true;
} | [
"private",
"boolean",
"nextSegment",
"(",
")",
"{",
"assert",
"(",
"state",
"==",
"State",
".",
"ITER_CHECK_FWD",
")",
";",
"// The input text [start..(iter index)[ passes the FCD check.",
"pos",
"=",
"iter",
".",
"getIndex",
"(",
")",
";",
"// Collect the characters ... | Extends the FCD text segment forward or normalizes around pos.
@return true if success | [
"Extends",
"the",
"FCD",
"text",
"segment",
"forward",
"or",
"normalizes",
"around",
"pos",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java#L258-L310 |
34,261 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java | FCDIterCollationIterator.switchToBackward | private void switchToBackward() {
assert(state == State.ITER_CHECK_FWD ||
(state == State.ITER_IN_FCD_SEGMENT && pos == start) ||
(state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos == 0));
if(state == State.ITER_CHECK_FWD) {
// Turn around from forward checking.
limit = pos = iter.getIndex();
if(pos == start) {
state = State.ITER_CHECK_BWD; // Check backward.
} else { // pos > start
state = State.ITER_IN_FCD_SEGMENT; // Stay in FCD segment.
}
} else {
// Reached the start of the FCD segment.
if(state == State.ITER_IN_FCD_SEGMENT) {
// The input text segment is FCD, extend it backward.
} else {
// The input text segment needed to be normalized.
// Switch to checking backward from it.
if(state == State.IN_NORM_ITER_AT_LIMIT) {
iter.moveIndex(start - limit);
}
limit = start;
}
state = State.ITER_CHECK_BWD;
}
} | java | private void switchToBackward() {
assert(state == State.ITER_CHECK_FWD ||
(state == State.ITER_IN_FCD_SEGMENT && pos == start) ||
(state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos == 0));
if(state == State.ITER_CHECK_FWD) {
// Turn around from forward checking.
limit = pos = iter.getIndex();
if(pos == start) {
state = State.ITER_CHECK_BWD; // Check backward.
} else { // pos > start
state = State.ITER_IN_FCD_SEGMENT; // Stay in FCD segment.
}
} else {
// Reached the start of the FCD segment.
if(state == State.ITER_IN_FCD_SEGMENT) {
// The input text segment is FCD, extend it backward.
} else {
// The input text segment needed to be normalized.
// Switch to checking backward from it.
if(state == State.IN_NORM_ITER_AT_LIMIT) {
iter.moveIndex(start - limit);
}
limit = start;
}
state = State.ITER_CHECK_BWD;
}
} | [
"private",
"void",
"switchToBackward",
"(",
")",
"{",
"assert",
"(",
"state",
"==",
"State",
".",
"ITER_CHECK_FWD",
"||",
"(",
"state",
"==",
"State",
".",
"ITER_IN_FCD_SEGMENT",
"&&",
"pos",
"==",
"start",
")",
"||",
"(",
"state",
".",
"compareTo",
"(",
... | Switches to backward checking. | [
"Switches",
"to",
"backward",
"checking",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java#L315-L341 |
34,262 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java | FCDIterCollationIterator.previousSegment | private boolean previousSegment() {
assert(state == State.ITER_CHECK_BWD);
// The input text [(iter index)..limit[ passes the FCD check.
pos = iter.getIndex();
// Collect the characters being checked, in case they need to be normalized.
if(s == null) {
s = new StringBuilder();
} else {
s.setLength(0);
}
int nextCC = 0;
for(;;) {
// Fetch the previous character and its fcd16 value.
int c = iter.previousCodePoint();
if(c < 0) { break; }
int fcd16 = nfcImpl.getFCD16(c);
int trailCC = fcd16 & 0xff;
if(trailCC == 0 && s.length() != 0) {
// FCD boundary after this character.
iter.nextCodePoint();
break;
}
s.appendCodePoint(c);
if(trailCC != 0 && ((nextCC != 0 && trailCC > nextCC) ||
CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the previous FCD boundary and normalize.
while(fcd16 > 0xff) {
c = iter.previousCodePoint();
if(c < 0) { break; }
fcd16 = nfcImpl.getFCD16(c);
if(fcd16 == 0) {
iter.nextCodePoint();
break;
}
s.appendCodePoint(c);
}
s.reverse();
normalize(s);
limit = pos;
start = pos - s.length();
state = State.IN_NORM_ITER_AT_START;
pos = normalized.length();
return true;
}
nextCC = fcd16 >> 8;
if(nextCC == 0) {
// FCD boundary before the following character.
break;
}
}
start = pos - s.length();
assert(pos != start);
iter.moveIndex(s.length());
state = State.ITER_IN_FCD_SEGMENT;
return true;
} | java | private boolean previousSegment() {
assert(state == State.ITER_CHECK_BWD);
// The input text [(iter index)..limit[ passes the FCD check.
pos = iter.getIndex();
// Collect the characters being checked, in case they need to be normalized.
if(s == null) {
s = new StringBuilder();
} else {
s.setLength(0);
}
int nextCC = 0;
for(;;) {
// Fetch the previous character and its fcd16 value.
int c = iter.previousCodePoint();
if(c < 0) { break; }
int fcd16 = nfcImpl.getFCD16(c);
int trailCC = fcd16 & 0xff;
if(trailCC == 0 && s.length() != 0) {
// FCD boundary after this character.
iter.nextCodePoint();
break;
}
s.appendCodePoint(c);
if(trailCC != 0 && ((nextCC != 0 && trailCC > nextCC) ||
CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the previous FCD boundary and normalize.
while(fcd16 > 0xff) {
c = iter.previousCodePoint();
if(c < 0) { break; }
fcd16 = nfcImpl.getFCD16(c);
if(fcd16 == 0) {
iter.nextCodePoint();
break;
}
s.appendCodePoint(c);
}
s.reverse();
normalize(s);
limit = pos;
start = pos - s.length();
state = State.IN_NORM_ITER_AT_START;
pos = normalized.length();
return true;
}
nextCC = fcd16 >> 8;
if(nextCC == 0) {
// FCD boundary before the following character.
break;
}
}
start = pos - s.length();
assert(pos != start);
iter.moveIndex(s.length());
state = State.ITER_IN_FCD_SEGMENT;
return true;
} | [
"private",
"boolean",
"previousSegment",
"(",
")",
"{",
"assert",
"(",
"state",
"==",
"State",
".",
"ITER_CHECK_BWD",
")",
";",
"// The input text [(iter index)..limit[ passes the FCD check.",
"pos",
"=",
"iter",
".",
"getIndex",
"(",
")",
";",
"// Collect the charact... | Extends the FCD text segment backward or normalizes around pos.
@return true if success | [
"Extends",
"the",
"FCD",
"text",
"segment",
"backward",
"or",
"normalizes",
"around",
"pos",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDIterCollationIterator.java#L347-L402 |
34,263 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateIssuerExtension.java | CertificateIssuerExtension.get | public GeneralNames get(String name) throws IOException {
if (name.equalsIgnoreCase(ISSUER)) {
return names;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:CertificateIssuer");
}
} | java | public GeneralNames get(String name) throws IOException {
if (name.equalsIgnoreCase(ISSUER)) {
return names;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:CertificateIssuer");
}
} | [
"public",
"GeneralNames",
"get",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"name",
".",
"equalsIgnoreCase",
"(",
"ISSUER",
")",
")",
"{",
"return",
"names",
";",
"}",
"else",
"{",
"throw",
"new",
"IOException",
"(",
"\"Attribute ... | Gets the attribute value.
@throws IOException on error | [
"Gets",
"the",
"attribute",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateIssuerExtension.java#L144-L151 |
34,264 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateIssuerExtension.java | CertificateIssuerExtension.delete | public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(ISSUER)) {
names = null;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:CertificateIssuer");
}
encodeThis();
} | java | public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(ISSUER)) {
names = null;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet:CertificateIssuer");
}
encodeThis();
} | [
"public",
"void",
"delete",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"name",
".",
"equalsIgnoreCase",
"(",
"ISSUER",
")",
")",
"{",
"names",
"=",
"null",
";",
"}",
"else",
"{",
"throw",
"new",
"IOException",
"(",
"\"Attribute ... | Deletes the attribute value.
@throws IOException on error | [
"Deletes",
"the",
"attribute",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateIssuerExtension.java#L158-L166 |
34,265 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java | DateFormat.format | public final StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition fieldPosition)
{
if (obj instanceof Date)
return format( (Date)obj, toAppendTo, fieldPosition );
else if (obj instanceof Number)
return format( new Date(((Number)obj).longValue()),
toAppendTo, fieldPosition );
else
throw new IllegalArgumentException("Cannot format given Object as a Date");
} | java | public final StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition fieldPosition)
{
if (obj instanceof Date)
return format( (Date)obj, toAppendTo, fieldPosition );
else if (obj instanceof Number)
return format( new Date(((Number)obj).longValue()),
toAppendTo, fieldPosition );
else
throw new IllegalArgumentException("Cannot format given Object as a Date");
} | [
"public",
"final",
"StringBuffer",
"format",
"(",
"Object",
"obj",
",",
"StringBuffer",
"toAppendTo",
",",
"FieldPosition",
"fieldPosition",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Date",
")",
"return",
"format",
"(",
"(",
"Date",
")",
"obj",
",",
"toAppe... | Overrides Format.
Formats a time object into a time string. Examples of time objects
are a time value expressed in milliseconds and a Date object.
@param obj must be a Number or a Date.
@param toAppendTo the string buffer for the returning time string.
@return the string buffer passed in as toAppendTo, with formatted text appended.
@param fieldPosition keeps track of the position of the field
within the returned string.
On input: an alignment field,
if desired. On output: the offsets of the alignment field. For
example, given a time text "1996.07.10 AD at 15:08:56 PDT",
if the given fieldPosition is DateFormat.YEAR_FIELD, the
begin index and end index of fieldPosition will be set to
0 and 4, respectively.
Notice that if the same time field appears
more than once in a pattern, the fieldPosition will be set for the first
occurrence of that time field. For instance, formatting a Date to
the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
"h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
the begin index and end index of fieldPosition will be set to
5 and 8, respectively, for the first occurrence of the timezone
pattern character 'z'.
@see java.text.Format | [
"Overrides",
"Format",
".",
"Formats",
"a",
"time",
"object",
"into",
"a",
"time",
"string",
".",
"Examples",
"of",
"time",
"objects",
"are",
"a",
"time",
"value",
"expressed",
"in",
"milliseconds",
"and",
"a",
"Date",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L294-L304 |
34,266 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java | DateFormat.getTimeInstance | public final static DateFormat getTimeInstance(int style)
{
return get(style, 0, 1, Locale.getDefault(Locale.Category.FORMAT));
} | java | public final static DateFormat getTimeInstance(int style)
{
return get(style, 0, 1, Locale.getDefault(Locale.Category.FORMAT));
} | [
"public",
"final",
"static",
"DateFormat",
"getTimeInstance",
"(",
"int",
"style",
")",
"{",
"return",
"get",
"(",
"style",
",",
"0",
",",
"1",
",",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
".",
"FORMAT",
")",
")",
";",
"}"
] | Gets the time formatter with the given formatting style
for the default locale.
@param style the given formatting style. For example,
SHORT for "h:mm a" in the US locale.
@return a time formatter. | [
"Gets",
"the",
"time",
"formatter",
"with",
"the",
"given",
"formatting",
"style",
"for",
"the",
"default",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L458-L461 |
34,267 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java | DateFormat.getDateInstance | public final static DateFormat getDateInstance(int style)
{
return get(0, style, 2, Locale.getDefault(Locale.Category.FORMAT));
} | java | public final static DateFormat getDateInstance(int style)
{
return get(0, style, 2, Locale.getDefault(Locale.Category.FORMAT));
} | [
"public",
"final",
"static",
"DateFormat",
"getDateInstance",
"(",
"int",
"style",
")",
"{",
"return",
"get",
"(",
"0",
",",
"style",
",",
"2",
",",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
".",
"FORMAT",
")",
")",
";",
"}"
] | Gets the date formatter with the given formatting style
for the default locale.
@param style the given formatting style. For example,
SHORT for "M/d/yy" in the US locale.
@return a date formatter. | [
"Gets",
"the",
"date",
"formatter",
"with",
"the",
"given",
"formatting",
"style",
"for",
"the",
"default",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L494-L497 |
34,268 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.create | protected synchronized void create() throws SocketException {
ResourceManager.beforeUdpCreate();
fd = new FileDescriptor();
try {
datagramSocketCreate();
} catch (SocketException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
if (fd != null && fd.valid()) {
guard.open("close");
}
} | java | protected synchronized void create() throws SocketException {
ResourceManager.beforeUdpCreate();
fd = new FileDescriptor();
try {
datagramSocketCreate();
} catch (SocketException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
if (fd != null && fd.valid()) {
guard.open("close");
}
} | [
"protected",
"synchronized",
"void",
"create",
"(",
")",
"throws",
"SocketException",
"{",
"ResourceManager",
".",
"beforeUdpCreate",
"(",
")",
";",
"fd",
"=",
"new",
"FileDescriptor",
"(",
")",
";",
"try",
"{",
"datagramSocketCreate",
"(",
")",
";",
"}",
"c... | Creates a datagram socket | [
"Creates",
"a",
"datagram",
"socket"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L74-L88 |
34,269 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.connect | protected void connect(InetAddress address, int port) throws SocketException {
BlockGuard.getThreadPolicy().onNetwork();
connect0(address, port);
connectedAddress = address;
connectedPort = port;
connected = true;
} | java | protected void connect(InetAddress address, int port) throws SocketException {
BlockGuard.getThreadPolicy().onNetwork();
connect0(address, port);
connectedAddress = address;
connectedPort = port;
connected = true;
} | [
"protected",
"void",
"connect",
"(",
"InetAddress",
"address",
",",
"int",
"port",
")",
"throws",
"SocketException",
"{",
"BlockGuard",
".",
"getThreadPolicy",
"(",
")",
".",
"onNetwork",
"(",
")",
";",
"connect0",
"(",
"address",
",",
"port",
")",
";",
"c... | Connects a datagram socket to a remote destination. This associates the remote
address with the local socket so that datagrams may only be sent to this destination
and received from this destination.
@param address the remote InetAddress to connect to
@param port the remote port number | [
"Connects",
"a",
"datagram",
"socket",
"to",
"a",
"remote",
"destination",
".",
"This",
"associates",
"the",
"remote",
"address",
"with",
"the",
"local",
"socket",
"so",
"that",
"datagrams",
"may",
"only",
"be",
"sent",
"to",
"this",
"destination",
"and",
"r... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L115-L121 |
34,270 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.disconnect | protected void disconnect() {
disconnect0(connectedAddress.holder().getFamily());
connected = false;
connectedAddress = null;
connectedPort = -1;
} | java | protected void disconnect() {
disconnect0(connectedAddress.holder().getFamily());
connected = false;
connectedAddress = null;
connectedPort = -1;
} | [
"protected",
"void",
"disconnect",
"(",
")",
"{",
"disconnect0",
"(",
"connectedAddress",
".",
"holder",
"(",
")",
".",
"getFamily",
"(",
")",
")",
";",
"connected",
"=",
"false",
";",
"connectedAddress",
"=",
"null",
";",
"connectedPort",
"=",
"-",
"1",
... | Disconnects a previously connected socket. Does nothing if the socket was
not connected already. | [
"Disconnects",
"a",
"previously",
"connected",
"socket",
".",
"Does",
"nothing",
"if",
"the",
"socket",
"was",
"not",
"connected",
"already",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L127-L132 |
34,271 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.joinGroup | protected void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
join(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | java | protected void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
join(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | [
"protected",
"void",
"joinGroup",
"(",
"SocketAddress",
"mcastaddr",
",",
"NetworkInterface",
"netIf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mcastaddr",
"==",
"null",
"||",
"!",
"(",
"mcastaddr",
"instanceof",
"InetSocketAddress",
")",
")",
"throw",
"ne... | Join the multicast group.
@param mcastaddr multicast address to join.
@param netIf specifies the local interface to receive multicast
datagram packets
@throws IllegalArgumentException if mcastaddr is null or is a
SocketAddress subclass not supported by this socket
@since 1.4 | [
"Join",
"the",
"multicast",
"group",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L199-L204 |
34,272 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.leaveGroup | protected void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
leave(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | java | protected void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
leave(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | [
"protected",
"void",
"leaveGroup",
"(",
"SocketAddress",
"mcastaddr",
",",
"NetworkInterface",
"netIf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mcastaddr",
"==",
"null",
"||",
"!",
"(",
"mcastaddr",
"instanceof",
"InetSocketAddress",
")",
")",
"throw",
"n... | Leave the multicast group.
@param mcastaddr multicast address to leave.
@param netIf specified the local interface to leave the group at
@throws IllegalArgumentException if mcastaddr is null or is a
SocketAddress subclass not supported by this socket
@since 1.4 | [
"Leave",
"the",
"multicast",
"group",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L217-L222 |
34,273 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.getNIFirstAddress | static InetAddress getNIFirstAddress(int niIndex) throws SocketException {
if (niIndex > 0) {
NetworkInterface networkInterface = NetworkInterface.getByIndex(niIndex);
Enumeration<InetAddress> addressesEnum = networkInterface.getInetAddresses();
if (addressesEnum.hasMoreElements()) {
return addressesEnum.nextElement();
}
}
return InetAddress.anyLocalAddress();
} | java | static InetAddress getNIFirstAddress(int niIndex) throws SocketException {
if (niIndex > 0) {
NetworkInterface networkInterface = NetworkInterface.getByIndex(niIndex);
Enumeration<InetAddress> addressesEnum = networkInterface.getInetAddresses();
if (addressesEnum.hasMoreElements()) {
return addressesEnum.nextElement();
}
}
return InetAddress.anyLocalAddress();
} | [
"static",
"InetAddress",
"getNIFirstAddress",
"(",
"int",
"niIndex",
")",
"throws",
"SocketException",
"{",
"if",
"(",
"niIndex",
">",
"0",
")",
"{",
"NetworkInterface",
"networkInterface",
"=",
"NetworkInterface",
".",
"getByIndex",
"(",
"niIndex",
")",
";",
"E... | Return the first address bound to NetworkInterface with given ID.
In case of niIndex == 0 or no address return anyLocalAddress | [
"Return",
"the",
"first",
"address",
"bound",
"to",
"NetworkInterface",
"with",
"given",
"ID",
".",
"In",
"case",
"of",
"niIndex",
"==",
"0",
"or",
"no",
"address",
"return",
"anyLocalAddress"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L370-L379 |
34,274 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLSocket.java | SSLSocket.getSSLParameters | public SSLParameters getSSLParameters() {
SSLParameters params = new SSLParameters();
params.setCipherSuites(getEnabledCipherSuites());
params.setProtocols(getEnabledProtocols());
if (getNeedClientAuth()) {
params.setNeedClientAuth(true);
} else if (getWantClientAuth()) {
params.setWantClientAuth(true);
}
return params;
} | java | public SSLParameters getSSLParameters() {
SSLParameters params = new SSLParameters();
params.setCipherSuites(getEnabledCipherSuites());
params.setProtocols(getEnabledProtocols());
if (getNeedClientAuth()) {
params.setNeedClientAuth(true);
} else if (getWantClientAuth()) {
params.setWantClientAuth(true);
}
return params;
} | [
"public",
"SSLParameters",
"getSSLParameters",
"(",
")",
"{",
"SSLParameters",
"params",
"=",
"new",
"SSLParameters",
"(",
")",
";",
"params",
".",
"setCipherSuites",
"(",
"getEnabledCipherSuites",
"(",
")",
")",
";",
"params",
".",
"setProtocols",
"(",
"getEnab... | Returns the SSLParameters in effect for this SSLSocket.
The ciphersuites and protocols of the returned SSLParameters
are always non-null.
@return the SSLParameters in effect for this SSLSocket.
@since 1.6 | [
"Returns",
"the",
"SSLParameters",
"in",
"effect",
"for",
"this",
"SSLSocket",
".",
"The",
"ciphersuites",
"and",
"protocols",
"of",
"the",
"returned",
"SSLParameters",
"are",
"always",
"non",
"-",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLSocket.java#L1342-L1352 |
34,275 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/UncheckedIOException.java | UncheckedIOException.readObject | private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
Throwable cause = super.getCause();
if (!(cause instanceof IOException))
throw new InvalidObjectException("Cause must be an IOException");
} | java | private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
Throwable cause = super.getCause();
if (!(cause instanceof IOException))
throw new InvalidObjectException("Cause must be an IOException");
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"s",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"s",
".",
"defaultReadObject",
"(",
")",
";",
"Throwable",
"cause",
"=",
"super",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"!"... | Called to read the object from a stream.
@throws InvalidObjectException
if the object is invalid or has a cause that is not
an {@code IOException} | [
"Called",
"to",
"read",
"the",
"object",
"from",
"a",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/UncheckedIOException.java#L82-L89 |
34,276 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java | ArrayBlockingQueue.enqueue | private void enqueue(E x) {
// assert lock.getHoldCount() == 1;
// assert items[putIndex] == null;
final Object[] items = this.items;
items[putIndex] = x;
if (++putIndex == items.length) putIndex = 0;
count++;
notEmpty.signal();
} | java | private void enqueue(E x) {
// assert lock.getHoldCount() == 1;
// assert items[putIndex] == null;
final Object[] items = this.items;
items[putIndex] = x;
if (++putIndex == items.length) putIndex = 0;
count++;
notEmpty.signal();
} | [
"private",
"void",
"enqueue",
"(",
"E",
"x",
")",
"{",
"// assert lock.getHoldCount() == 1;",
"// assert items[putIndex] == null;",
"final",
"Object",
"[",
"]",
"items",
"=",
"this",
".",
"items",
";",
"items",
"[",
"putIndex",
"]",
"=",
"x",
";",
"if",
"(",
... | Inserts element at current put position, advances, and signals.
Call only when holding lock. | [
"Inserts",
"element",
"at",
"current",
"put",
"position",
"advances",
"and",
"signals",
".",
"Call",
"only",
"when",
"holding",
"lock",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java#L153-L161 |
34,277 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java | ArrayBlockingQueue.dequeue | private E dequeue() {
// assert lock.getHoldCount() == 1;
// assert items[takeIndex] != null;
final Object[] items = this.items;
@SuppressWarnings("unchecked")
E x = (E) items[takeIndex];
items[takeIndex] = null;
if (++takeIndex == items.length) takeIndex = 0;
count--;
if (itrs != null)
itrs.elementDequeued();
notFull.signal();
return x;
} | java | private E dequeue() {
// assert lock.getHoldCount() == 1;
// assert items[takeIndex] != null;
final Object[] items = this.items;
@SuppressWarnings("unchecked")
E x = (E) items[takeIndex];
items[takeIndex] = null;
if (++takeIndex == items.length) takeIndex = 0;
count--;
if (itrs != null)
itrs.elementDequeued();
notFull.signal();
return x;
} | [
"private",
"E",
"dequeue",
"(",
")",
"{",
"// assert lock.getHoldCount() == 1;",
"// assert items[takeIndex] != null;",
"final",
"Object",
"[",
"]",
"items",
"=",
"this",
".",
"items",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"E",
"x",
"=",
"(",
... | Extracts element at current take position, advances, and signals.
Call only when holding lock. | [
"Extracts",
"element",
"at",
"current",
"take",
"position",
"advances",
"and",
"signals",
".",
"Call",
"only",
"when",
"holding",
"lock",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java#L167-L180 |
34,278 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java | ArrayBlockingQueue.put | public void put(E e) throws InterruptedException {
Objects.requireNonNull(e);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length)
notFull.await();
enqueue(e);
} finally {
lock.unlock();
}
} | java | public void put(E e) throws InterruptedException {
Objects.requireNonNull(e);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length)
notFull.await();
enqueue(e);
} finally {
lock.unlock();
}
} | [
"public",
"void",
"put",
"(",
"E",
"e",
")",
"throws",
"InterruptedException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"e",
")",
";",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lockInterruptibly",
"(",
")",
";",
"t... | Inserts the specified element at the tail of this queue, waiting
for space to become available if the queue is full.
@throws InterruptedException {@inheritDoc}
@throws NullPointerException {@inheritDoc} | [
"Inserts",
"the",
"specified",
"element",
"at",
"the",
"tail",
"of",
"this",
"queue",
"waiting",
"for",
"space",
"to",
"become",
"available",
"if",
"the",
"queue",
"is",
"full",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java#L334-L345 |
34,279 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java | ArrayBlockingQueue.offer | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
Objects.requireNonNull(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(e);
return true;
} finally {
lock.unlock();
}
} | java | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
Objects.requireNonNull(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(e);
return true;
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"offer",
"(",
"E",
"e",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"e",
")",
";",
"long",
"nanos",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
... | Inserts the specified element at the tail of this queue, waiting
up to the specified wait time for space to become available if
the queue is full.
@throws InterruptedException {@inheritDoc}
@throws NullPointerException {@inheritDoc} | [
"Inserts",
"the",
"specified",
"element",
"at",
"the",
"tail",
"of",
"this",
"queue",
"waiting",
"up",
"to",
"the",
"specified",
"wait",
"time",
"for",
"space",
"to",
"become",
"available",
"if",
"the",
"queue",
"is",
"full",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java#L355-L373 |
34,280 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceTableAccess.java | ICUResourceTableAccess.getTableString | public static String getTableString(ICUResourceBundle bundle, String tableName,
String subtableName, String item, String defaultValue) {
String result = null;
try {
for (;;) {
ICUResourceBundle table = bundle.findWithFallback(tableName);
if (table == null) {
return defaultValue;
}
ICUResourceBundle stable = table;
if (subtableName != null) {
stable = table.findWithFallback(subtableName);
}
if (stable != null) {
result = stable.findStringWithFallback(item);
if (result != null) {
break; // possible real exception
}
}
// if we get here, stable was null, or there was no string for the item
if (subtableName == null) {
// may be a deprecated code
String currentName = null;
if (tableName.equals("Countries")) {
currentName = LocaleIDs.getCurrentCountryID(item);
} else if (tableName.equals("Languages")) {
currentName = LocaleIDs.getCurrentLanguageID(item);
}
if (currentName != null) {
result = table.findStringWithFallback(currentName);
if (result != null) {
break; // possible real exception
}
}
}
// still can't figure it out? try the fallback mechanism
String fallbackLocale = table.findStringWithFallback("Fallback"); // again, possible exception
if (fallbackLocale == null) {
return defaultValue;
}
if (fallbackLocale.length() == 0) {
fallbackLocale = "root";
}
if (fallbackLocale.equals(table.getULocale().getName())) {
return defaultValue;
}
bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(
bundle.getBaseName(), fallbackLocale);
}
} catch (Exception e) {
// If something is seriously wrong, we might call getString on a resource that is
// not a string. That will throw an exception, which we catch and ignore here.
}
// If the result is empty return item instead
return ((result != null && result.length() > 0) ? result : defaultValue);
} | java | public static String getTableString(ICUResourceBundle bundle, String tableName,
String subtableName, String item, String defaultValue) {
String result = null;
try {
for (;;) {
ICUResourceBundle table = bundle.findWithFallback(tableName);
if (table == null) {
return defaultValue;
}
ICUResourceBundle stable = table;
if (subtableName != null) {
stable = table.findWithFallback(subtableName);
}
if (stable != null) {
result = stable.findStringWithFallback(item);
if (result != null) {
break; // possible real exception
}
}
// if we get here, stable was null, or there was no string for the item
if (subtableName == null) {
// may be a deprecated code
String currentName = null;
if (tableName.equals("Countries")) {
currentName = LocaleIDs.getCurrentCountryID(item);
} else if (tableName.equals("Languages")) {
currentName = LocaleIDs.getCurrentLanguageID(item);
}
if (currentName != null) {
result = table.findStringWithFallback(currentName);
if (result != null) {
break; // possible real exception
}
}
}
// still can't figure it out? try the fallback mechanism
String fallbackLocale = table.findStringWithFallback("Fallback"); // again, possible exception
if (fallbackLocale == null) {
return defaultValue;
}
if (fallbackLocale.length() == 0) {
fallbackLocale = "root";
}
if (fallbackLocale.equals(table.getULocale().getName())) {
return defaultValue;
}
bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(
bundle.getBaseName(), fallbackLocale);
}
} catch (Exception e) {
// If something is seriously wrong, we might call getString on a resource that is
// not a string. That will throw an exception, which we catch and ignore here.
}
// If the result is empty return item instead
return ((result != null && result.length() > 0) ? result : defaultValue);
} | [
"public",
"static",
"String",
"getTableString",
"(",
"ICUResourceBundle",
"bundle",
",",
"String",
"tableName",
",",
"String",
"subtableName",
",",
"String",
"item",
",",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"null",
";",
"try",
"{",
"fo... | Utility to fetch locale display data from resource bundle tables. Uses fallback
through the "Fallback" resource if available. | [
"Utility",
"to",
"fetch",
"locale",
"display",
"data",
"from",
"resource",
"bundle",
"tables",
".",
"Uses",
"fallback",
"through",
"the",
"Fallback",
"resource",
"if",
"available",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceTableAccess.java#L36-L97 |
34,281 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.charAt | public char charAt(int where) {
int len = length();
if (where < 0) {
throw new IndexOutOfBoundsException("charAt: " + where + " < 0");
} else if (where >= len) {
throw new IndexOutOfBoundsException("charAt: " + where + " >= length " + len);
}
if (where >= mGapStart)
return mText[where + mGapLength];
else
return mText[where];
} | java | public char charAt(int where) {
int len = length();
if (where < 0) {
throw new IndexOutOfBoundsException("charAt: " + where + " < 0");
} else if (where >= len) {
throw new IndexOutOfBoundsException("charAt: " + where + " >= length " + len);
}
if (where >= mGapStart)
return mText[where + mGapLength];
else
return mText[where];
} | [
"public",
"char",
"charAt",
"(",
"int",
"where",
")",
"{",
"int",
"len",
"=",
"length",
"(",
")",
";",
"if",
"(",
"where",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"charAt: \"",
"+",
"where",
"+",
"\" < 0\"",
")",
";",
... | Return the char at the specified offset within the buffer. | [
"Return",
"the",
"char",
"at",
"the",
"specified",
"offset",
"within",
"the",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L107-L119 |
34,282 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.setSpan | public void setSpan(Object what, int start, int end, int flags) {
setSpan(true, what, start, end, flags);
} | java | public void setSpan(Object what, int start, int end, int flags) {
setSpan(true, what, start, end, flags);
} | [
"public",
"void",
"setSpan",
"(",
"Object",
"what",
",",
"int",
"start",
",",
"int",
"end",
",",
"int",
"flags",
")",
"{",
"setSpan",
"(",
"true",
",",
"what",
",",
"start",
",",
"end",
",",
"flags",
")",
";",
"}"
] | Mark the specified range of text with the specified object.
The flags determine how the span will behave when text is
inserted at the start or end of the span's range. | [
"Mark",
"the",
"specified",
"range",
"of",
"text",
"with",
"the",
"specified",
"object",
".",
"The",
"flags",
"determine",
"how",
"the",
"span",
"will",
"behave",
"when",
"text",
"is",
"inserted",
"at",
"the",
"start",
"or",
"end",
"of",
"the",
"span",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L585-L587 |
34,283 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.removeSpan | public void removeSpan(Object what) {
for (int i = mSpanCount - 1; i >= 0; i--) {
if (mSpans[i] == what) {
removeSpan(i);
return;
}
}
} | java | public void removeSpan(Object what) {
for (int i = mSpanCount - 1; i >= 0; i--) {
if (mSpans[i] == what) {
removeSpan(i);
return;
}
}
} | [
"public",
"void",
"removeSpan",
"(",
"Object",
"what",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"mSpanCount",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"mSpans",
"[",
"i",
"]",
"==",
"what",
")",
"{",
"removeSpan",
"(",
... | Remove the specified markup object from the buffer. | [
"Remove",
"the",
"specified",
"markup",
"object",
"from",
"the",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L692-L699 |
34,284 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.getSpanStart | public int getSpanStart(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int where = mSpanStarts[i];
if (where > mGapStart)
where -= mGapLength;
return where;
}
}
return -1;
} | java | public int getSpanStart(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int where = mSpanStarts[i];
if (where > mGapStart)
where -= mGapLength;
return where;
}
}
return -1;
} | [
"public",
"int",
"getSpanStart",
"(",
"Object",
"what",
")",
"{",
"int",
"count",
"=",
"mSpanCount",
";",
"Object",
"[",
"]",
"spans",
"=",
"mSpans",
";",
"for",
"(",
"int",
"i",
"=",
"count",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
... | Return the buffer offset of the beginning of the specified
markup object, or -1 if it is not attached to this buffer. | [
"Return",
"the",
"buffer",
"offset",
"of",
"the",
"beginning",
"of",
"the",
"specified",
"markup",
"object",
"or",
"-",
"1",
"if",
"it",
"is",
"not",
"attached",
"to",
"this",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L705-L721 |
34,285 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.getSpanEnd | public int getSpanEnd(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int where = mSpanEnds[i];
if (where > mGapStart)
where -= mGapLength;
return where;
}
}
return -1;
} | java | public int getSpanEnd(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int where = mSpanEnds[i];
if (where > mGapStart)
where -= mGapLength;
return where;
}
}
return -1;
} | [
"public",
"int",
"getSpanEnd",
"(",
"Object",
"what",
")",
"{",
"int",
"count",
"=",
"mSpanCount",
";",
"Object",
"[",
"]",
"spans",
"=",
"mSpans",
";",
"for",
"(",
"int",
"i",
"=",
"count",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"... | Return the buffer offset of the end of the specified
markup object, or -1 if it is not attached to this buffer. | [
"Return",
"the",
"buffer",
"offset",
"of",
"the",
"end",
"of",
"the",
"specified",
"markup",
"object",
"or",
"-",
"1",
"if",
"it",
"is",
"not",
"attached",
"to",
"this",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L727-L743 |
34,286 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.getSpanFlags | public int getSpanFlags(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
return mSpanFlags[i];
}
}
return 0;
} | java | public int getSpanFlags(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
return mSpanFlags[i];
}
}
return 0;
} | [
"public",
"int",
"getSpanFlags",
"(",
"Object",
"what",
")",
"{",
"int",
"count",
"=",
"mSpanCount",
";",
"Object",
"[",
"]",
"spans",
"=",
"mSpans",
";",
"for",
"(",
"int",
"i",
"=",
"count",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
... | Return the flags of the end of the specified
markup object, or 0 if it is not attached to this buffer. | [
"Return",
"the",
"flags",
"of",
"the",
"end",
"of",
"the",
"specified",
"markup",
"object",
"or",
"0",
"if",
"it",
"is",
"not",
"attached",
"to",
"this",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L749-L760 |
34,287 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.getSpans | @SuppressWarnings("unchecked")
public <T> T[] getSpans(int queryStart, int queryEnd, Class<T> kind) {
if (kind == null) return ArrayUtils.emptyArray(kind);
int spanCount = mSpanCount;
Object[] spans = mSpans;
int[] starts = mSpanStarts;
int[] ends = mSpanEnds;
int[] flags = mSpanFlags;
int gapstart = mGapStart;
int gaplen = mGapLength;
int count = 0;
T[] ret = null;
T ret1 = null;
for (int i = 0; i < spanCount; i++) {
int spanStart = starts[i];
if (spanStart > gapstart) {
spanStart -= gaplen;
}
if (spanStart > queryEnd) {
continue;
}
int spanEnd = ends[i];
if (spanEnd > gapstart) {
spanEnd -= gaplen;
}
if (spanEnd < queryStart) {
continue;
}
if (spanStart != spanEnd && queryStart != queryEnd) {
if (spanStart == queryEnd)
continue;
if (spanEnd == queryStart)
continue;
}
// Expensive test, should be performed after the previous tests
if (!kind.isInstance(spans[i])) continue;
if (count == 0) {
// Safe conversion thanks to the isInstance test above
ret1 = (T) spans[i];
count++;
} else {
if (count == 1) {
// Safe conversion, but requires a suppressWarning
ret = (T[]) Array.newInstance(kind, spanCount - i + 1);
ret[0] = ret1;
}
int prio = flags[i] & SPAN_PRIORITY;
if (prio != 0) {
int j;
for (j = 0; j < count; j++) {
int p = getSpanFlags(ret[j]) & SPAN_PRIORITY;
if (prio > p) {
break;
}
}
System.arraycopy(ret, j, ret, j + 1, count - j);
// Safe conversion thanks to the isInstance test above
ret[j] = (T) spans[i];
count++;
} else {
// Safe conversion thanks to the isInstance test above
ret[count++] = (T) spans[i];
}
}
}
if (count == 0) {
return ArrayUtils.emptyArray(kind);
}
if (count == 1) {
// Safe conversion, but requires a suppressWarning
ret = (T[]) Array.newInstance(kind, 1);
ret[0] = ret1;
return ret;
}
if (count == ret.length) {
return ret;
}
// Safe conversion, but requires a suppressWarning
T[] nret = (T[]) Array.newInstance(kind, count);
System.arraycopy(ret, 0, nret, 0, count);
return nret;
} | java | @SuppressWarnings("unchecked")
public <T> T[] getSpans(int queryStart, int queryEnd, Class<T> kind) {
if (kind == null) return ArrayUtils.emptyArray(kind);
int spanCount = mSpanCount;
Object[] spans = mSpans;
int[] starts = mSpanStarts;
int[] ends = mSpanEnds;
int[] flags = mSpanFlags;
int gapstart = mGapStart;
int gaplen = mGapLength;
int count = 0;
T[] ret = null;
T ret1 = null;
for (int i = 0; i < spanCount; i++) {
int spanStart = starts[i];
if (spanStart > gapstart) {
spanStart -= gaplen;
}
if (spanStart > queryEnd) {
continue;
}
int spanEnd = ends[i];
if (spanEnd > gapstart) {
spanEnd -= gaplen;
}
if (spanEnd < queryStart) {
continue;
}
if (spanStart != spanEnd && queryStart != queryEnd) {
if (spanStart == queryEnd)
continue;
if (spanEnd == queryStart)
continue;
}
// Expensive test, should be performed after the previous tests
if (!kind.isInstance(spans[i])) continue;
if (count == 0) {
// Safe conversion thanks to the isInstance test above
ret1 = (T) spans[i];
count++;
} else {
if (count == 1) {
// Safe conversion, but requires a suppressWarning
ret = (T[]) Array.newInstance(kind, spanCount - i + 1);
ret[0] = ret1;
}
int prio = flags[i] & SPAN_PRIORITY;
if (prio != 0) {
int j;
for (j = 0; j < count; j++) {
int p = getSpanFlags(ret[j]) & SPAN_PRIORITY;
if (prio > p) {
break;
}
}
System.arraycopy(ret, j, ret, j + 1, count - j);
// Safe conversion thanks to the isInstance test above
ret[j] = (T) spans[i];
count++;
} else {
// Safe conversion thanks to the isInstance test above
ret[count++] = (T) spans[i];
}
}
}
if (count == 0) {
return ArrayUtils.emptyArray(kind);
}
if (count == 1) {
// Safe conversion, but requires a suppressWarning
ret = (T[]) Array.newInstance(kind, 1);
ret[0] = ret1;
return ret;
}
if (count == ret.length) {
return ret;
}
// Safe conversion, but requires a suppressWarning
T[] nret = (T[]) Array.newInstance(kind, count);
System.arraycopy(ret, 0, nret, 0, count);
return nret;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"[",
"]",
"getSpans",
"(",
"int",
"queryStart",
",",
"int",
"queryEnd",
",",
"Class",
"<",
"T",
">",
"kind",
")",
"{",
"if",
"(",
"kind",
"==",
"null",
")",
"return",
... | Return an array of the spans of the specified type that overlap
the specified range of the buffer. The kind may be Object.class to get
a list of all the spans regardless of type. | [
"Return",
"an",
"array",
"of",
"the",
"spans",
"of",
"the",
"specified",
"type",
"that",
"overlap",
"the",
"specified",
"range",
"of",
"the",
"buffer",
".",
"The",
"kind",
"may",
"be",
"Object",
".",
"class",
"to",
"get",
"a",
"list",
"of",
"all",
"the... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L767-L861 |
34,288 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.getChars | public void getChars(int start, int end, char[] dest, int destoff) {
checkRange("getChars", start, end);
if (end <= mGapStart) {
System.arraycopy(mText, start, dest, destoff, end - start);
} else if (start >= mGapStart) {
System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
} else {
System.arraycopy(mText, start, dest, destoff, mGapStart - start);
System.arraycopy(mText, mGapStart + mGapLength,
dest, destoff + (mGapStart - start),
end - mGapStart);
}
} | java | public void getChars(int start, int end, char[] dest, int destoff) {
checkRange("getChars", start, end);
if (end <= mGapStart) {
System.arraycopy(mText, start, dest, destoff, end - start);
} else if (start >= mGapStart) {
System.arraycopy(mText, start + mGapLength, dest, destoff, end - start);
} else {
System.arraycopy(mText, start, dest, destoff, mGapStart - start);
System.arraycopy(mText, mGapStart + mGapLength,
dest, destoff + (mGapStart - start),
end - mGapStart);
}
} | [
"public",
"void",
"getChars",
"(",
"int",
"start",
",",
"int",
"end",
",",
"char",
"[",
"]",
"dest",
",",
"int",
"destoff",
")",
"{",
"checkRange",
"(",
"\"getChars\"",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"end",
"<=",
"mGapStart",
")",
"... | Copy the specified range of chars from this buffer into the
specified array, beginning at the specified offset. | [
"Copy",
"the",
"specified",
"range",
"of",
"chars",
"from",
"this",
"buffer",
"into",
"the",
"specified",
"array",
"beginning",
"at",
"the",
"specified",
"offset",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L910-L923 |
34,289 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java | SpannableStringBuilder.substring | public String substring(int start, int end) {
char[] buf = new char[end - start];
getChars(start, end, buf, 0);
return new String(buf);
} | java | public String substring(int start, int end) {
char[] buf = new char[end - start];
getChars(start, end, buf, 0);
return new String(buf);
} | [
"public",
"String",
"substring",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"char",
"[",
"]",
"buf",
"=",
"new",
"char",
"[",
"end",
"-",
"start",
"]",
";",
"getChars",
"(",
"start",
",",
"end",
",",
"buf",
",",
"0",
")",
";",
"return",
... | Return a String containing a copy of the chars in this buffer, limited to the
[start, end[ range.
@hide | [
"Return",
"a",
"String",
"containing",
"a",
"copy",
"of",
"the",
"chars",
"in",
"this",
"buffer",
"limited",
"to",
"the",
"[",
"start",
"end",
"[",
"range",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpannableStringBuilder.java#L942-L946 |
34,290 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamEncoder.java | StreamEncoder.forOutputStreamWriter | public static StreamEncoder forOutputStreamWriter(OutputStream out,
Object lock,
String charsetName)
throws UnsupportedEncodingException
{
String csn = charsetName;
if (csn == null)
csn = Charset.defaultCharset().name();
try {
if (Charset.isSupported(csn))
return new StreamEncoder(out, lock, Charset.forName(csn));
} catch (IllegalCharsetNameException x) { }
throw new UnsupportedEncodingException (csn);
} | java | public static StreamEncoder forOutputStreamWriter(OutputStream out,
Object lock,
String charsetName)
throws UnsupportedEncodingException
{
String csn = charsetName;
if (csn == null)
csn = Charset.defaultCharset().name();
try {
if (Charset.isSupported(csn))
return new StreamEncoder(out, lock, Charset.forName(csn));
} catch (IllegalCharsetNameException x) { }
throw new UnsupportedEncodingException (csn);
} | [
"public",
"static",
"StreamEncoder",
"forOutputStreamWriter",
"(",
"OutputStream",
"out",
",",
"Object",
"lock",
",",
"String",
"charsetName",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"csn",
"=",
"charsetName",
";",
"if",
"(",
"csn",
"==",
"nu... | Factories for java.io.OutputStreamWriter | [
"Factories",
"for",
"java",
".",
"io",
".",
"OutputStreamWriter"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamEncoder.java#L49-L62 |
34,291 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamEncoder.java | StreamEncoder.forEncoder | public static StreamEncoder forEncoder(WritableByteChannel ch,
CharsetEncoder enc,
int minBufferCap)
{
return new StreamEncoder(ch, enc, minBufferCap);
} | java | public static StreamEncoder forEncoder(WritableByteChannel ch,
CharsetEncoder enc,
int minBufferCap)
{
return new StreamEncoder(ch, enc, minBufferCap);
} | [
"public",
"static",
"StreamEncoder",
"forEncoder",
"(",
"WritableByteChannel",
"ch",
",",
"CharsetEncoder",
"enc",
",",
"int",
"minBufferCap",
")",
"{",
"return",
"new",
"StreamEncoder",
"(",
"ch",
",",
"enc",
",",
"minBufferCap",
")",
";",
"}"
] | Factory for java.nio.channels.Channels.newWriter | [
"Factory",
"for",
"java",
".",
"nio",
".",
"channels",
".",
"Channels",
".",
"newWriter"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamEncoder.java#L81-L86 |
34,292 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/SocketChannel.java | SocketChannel.open | public static SocketChannel open(SocketAddress remote)
throws IOException
{
SocketChannel sc = open();
try {
sc.connect(remote);
} catch (Throwable x) {
try {
sc.close();
} catch (Throwable suppressed) {
x.addSuppressed(suppressed);
}
throw x;
}
assert sc.isConnected();
return sc;
} | java | public static SocketChannel open(SocketAddress remote)
throws IOException
{
SocketChannel sc = open();
try {
sc.connect(remote);
} catch (Throwable x) {
try {
sc.close();
} catch (Throwable suppressed) {
x.addSuppressed(suppressed);
}
throw x;
}
assert sc.isConnected();
return sc;
} | [
"public",
"static",
"SocketChannel",
"open",
"(",
"SocketAddress",
"remote",
")",
"throws",
"IOException",
"{",
"SocketChannel",
"sc",
"=",
"open",
"(",
")",
";",
"try",
"{",
"sc",
".",
"connect",
"(",
"remote",
")",
";",
"}",
"catch",
"(",
"Throwable",
... | Opens a socket channel and connects it to a remote address.
<p> This convenience method works as if by invoking the {@link #open()}
method, invoking the {@link #connect(SocketAddress) connect} method upon
the resulting socket channel, passing it <tt>remote</tt>, and then
returning that channel. </p>
@param remote
The remote address to which the new channel is to be connected
@return A new, and connected, socket channel
@throws AsynchronousCloseException
If another thread closes this channel
while the connect operation is in progress
@throws ClosedByInterruptException
If another thread interrupts the current thread
while the connect operation is in progress, thereby
closing the channel and setting the current thread's
interrupt status
@throws UnresolvedAddressException
If the given remote address is not fully resolved
@throws UnsupportedAddressTypeException
If the type of the given remote address is not supported
@throws SecurityException
If a security manager has been installed
and it does not permit access to the given remote endpoint
@throws IOException
If some other I/O error occurs | [
"Opens",
"a",
"socket",
"channel",
"and",
"connects",
"it",
"to",
"a",
"remote",
"address",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/SocketChannel.java#L184-L200 |
34,293 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java | ObjectOutputStream.removeUnsharedReference | private void removeUnsharedReference(Object obj, int previousHandle) {
if (previousHandle != -1) {
objectsWritten.put(obj, previousHandle);
} else {
objectsWritten.remove(obj);
}
} | java | private void removeUnsharedReference(Object obj, int previousHandle) {
if (previousHandle != -1) {
objectsWritten.put(obj, previousHandle);
} else {
objectsWritten.remove(obj);
}
} | [
"private",
"void",
"removeUnsharedReference",
"(",
"Object",
"obj",
",",
"int",
"previousHandle",
")",
"{",
"if",
"(",
"previousHandle",
"!=",
"-",
"1",
")",
"{",
"objectsWritten",
".",
"put",
"(",
"obj",
",",
"previousHandle",
")",
";",
"}",
"else",
"{",
... | Remove the unshared object from the table, and restore any previous
handle.
@param obj
Non-null object being dumped.
@param previousHandle
The handle of the previous identical object dumped | [
"Remove",
"the",
"unshared",
"object",
"from",
"the",
"table",
"and",
"restore",
"any",
"previous",
"handle",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L506-L512 |
34,294 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java | ObjectOutputStream.useProtocolVersion | public void useProtocolVersion(int version) throws IOException {
if (!objectsWritten.isEmpty()) {
throw new IllegalStateException("Cannot set protocol version when stream in use");
}
if (version != ObjectStreamConstants.PROTOCOL_VERSION_1
&& version != ObjectStreamConstants.PROTOCOL_VERSION_2) {
throw new IllegalArgumentException("Unknown protocol: " + version);
}
protocolVersion = version;
} | java | public void useProtocolVersion(int version) throws IOException {
if (!objectsWritten.isEmpty()) {
throw new IllegalStateException("Cannot set protocol version when stream in use");
}
if (version != ObjectStreamConstants.PROTOCOL_VERSION_1
&& version != ObjectStreamConstants.PROTOCOL_VERSION_2) {
throw new IllegalArgumentException("Unknown protocol: " + version);
}
protocolVersion = version;
} | [
"public",
"void",
"useProtocolVersion",
"(",
"int",
"version",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"objectsWritten",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot set protocol version when stream in use\"",
... | Sets the specified protocol version to be used by this stream.
@param version
the protocol version to be used. Use a {@code
PROTOCOL_VERSION_x} constant from {@code
java.io.ObjectStreamConstants}.
@throws IllegalArgumentException
if an invalid {@code version} is specified.
@throws IOException
if an I/O error occurs.
@see ObjectStreamConstants#PROTOCOL_VERSION_1
@see ObjectStreamConstants#PROTOCOL_VERSION_2 | [
"Sets",
"the",
"specified",
"protocol",
"version",
"to",
"be",
"used",
"by",
"this",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L594-L603 |
34,295 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java | ObjectOutputStream.writeEnumDesc | private ObjectStreamClass writeEnumDesc(ObjectStreamClass classDesc, boolean unshared)
throws IOException {
// write classDesc, classDesc for enum is different
// set flag for enum, the flag is (SC_SERIALIZABLE | SC_ENUM)
classDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
int previousHandle = -1;
if (unshared) {
previousHandle = objectsWritten.get(classDesc);
}
int handle = -1;
if (!unshared) {
handle = dumpCycle(classDesc);
}
if (handle == -1) {
Class<?> classToWrite = classDesc.forClass();
// If we got here, it is a new (non-null) classDesc that will have
// to be registered as well
registerObjectWritten(classDesc);
output.writeByte(TC_CLASSDESC);
if (protocolVersion == PROTOCOL_VERSION_1) {
writeNewClassDesc(classDesc);
} else {
// So write...() methods can be used by
// subclasses during writeClassDescriptor()
primitiveTypes = output;
writeClassDescriptor(classDesc);
primitiveTypes = null;
}
// Extra class info (optional)
annotateClass(classToWrite);
drain(); // flush primitive types in the annotation
output.writeByte(TC_ENDBLOCKDATA);
// write super class
ObjectStreamClass superClassDesc = classDesc.getSuperclass();
if (superClassDesc != null) {
// super class is also enum
superClassDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
writeEnumDesc(superClassDesc, unshared);
} else {
output.writeByte(TC_NULL);
}
if (unshared) {
// remove reference to unshared object
removeUnsharedReference(classDesc, previousHandle);
}
}
return classDesc;
} | java | private ObjectStreamClass writeEnumDesc(ObjectStreamClass classDesc, boolean unshared)
throws IOException {
// write classDesc, classDesc for enum is different
// set flag for enum, the flag is (SC_SERIALIZABLE | SC_ENUM)
classDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
int previousHandle = -1;
if (unshared) {
previousHandle = objectsWritten.get(classDesc);
}
int handle = -1;
if (!unshared) {
handle = dumpCycle(classDesc);
}
if (handle == -1) {
Class<?> classToWrite = classDesc.forClass();
// If we got here, it is a new (non-null) classDesc that will have
// to be registered as well
registerObjectWritten(classDesc);
output.writeByte(TC_CLASSDESC);
if (protocolVersion == PROTOCOL_VERSION_1) {
writeNewClassDesc(classDesc);
} else {
// So write...() methods can be used by
// subclasses during writeClassDescriptor()
primitiveTypes = output;
writeClassDescriptor(classDesc);
primitiveTypes = null;
}
// Extra class info (optional)
annotateClass(classToWrite);
drain(); // flush primitive types in the annotation
output.writeByte(TC_ENDBLOCKDATA);
// write super class
ObjectStreamClass superClassDesc = classDesc.getSuperclass();
if (superClassDesc != null) {
// super class is also enum
superClassDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
writeEnumDesc(superClassDesc, unshared);
} else {
output.writeByte(TC_NULL);
}
if (unshared) {
// remove reference to unshared object
removeUnsharedReference(classDesc, previousHandle);
}
}
return classDesc;
} | [
"private",
"ObjectStreamClass",
"writeEnumDesc",
"(",
"ObjectStreamClass",
"classDesc",
",",
"boolean",
"unshared",
")",
"throws",
"IOException",
"{",
"// write classDesc, classDesc for enum is different",
"// set flag for enum, the flag is (SC_SERIALIZABLE | SC_ENUM)",
"classDesc",
... | write for Enum Class Desc only, which is different from other classes | [
"write",
"for",
"Enum",
"Class",
"Desc",
"only",
"which",
"is",
"different",
"from",
"other",
"classes"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L1656-L1705 |
34,296 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacterNameIterator.java | UCharacterNameIterator.iterateExtended | private boolean iterateExtended(ValueIterator.Element result,
int limit)
{
while (m_current_ < limit) {
String name = m_name_.getExtendedOr10Name(m_current_);
if (name != null && name.length() > 0) {
result.integer = m_current_;
result.value = name;
return false;
}
++ m_current_;
}
return true;
} | java | private boolean iterateExtended(ValueIterator.Element result,
int limit)
{
while (m_current_ < limit) {
String name = m_name_.getExtendedOr10Name(m_current_);
if (name != null && name.length() > 0) {
result.integer = m_current_;
result.value = name;
return false;
}
++ m_current_;
}
return true;
} | [
"private",
"boolean",
"iterateExtended",
"(",
"ValueIterator",
".",
"Element",
"result",
",",
"int",
"limit",
")",
"{",
"while",
"(",
"m_current_",
"<",
"limit",
")",
"{",
"String",
"name",
"=",
"m_name_",
".",
"getExtendedOr10Name",
"(",
"m_current_",
")",
... | Iterate extended names.
@param result stores the result codepoint and name
@param limit last codepoint + 1 in range to search
@return false if a codepoint with a name is found and we can
bail from further iteration, true to continue on with the
iteration (this will always be false for valid codepoints) | [
"Iterate",
"extended",
"names",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacterNameIterator.java#L327-L340 |
34,297 | google/j2objc | jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/Introspector.java | Introspector.getBeanInfoSearchPath | public static String[] getBeanInfoSearchPath() {
String[] path = new String[searchPath.length];
System.arraycopy(searchPath, 0, path, 0, searchPath.length);
return path;
} | java | public static String[] getBeanInfoSearchPath() {
String[] path = new String[searchPath.length];
System.arraycopy(searchPath, 0, path, 0, searchPath.length);
return path;
} | [
"public",
"static",
"String",
"[",
"]",
"getBeanInfoSearchPath",
"(",
")",
"{",
"String",
"[",
"]",
"path",
"=",
"new",
"String",
"[",
"searchPath",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"searchPath",
",",
"0",
",",
"path",
",",
"0"... | Gets an array of search packages.
@return an array of search packages. | [
"Gets",
"an",
"array",
"of",
"search",
"packages",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/Introspector.java#L238-L242 |
34,298 | google/j2objc | jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/Introspector.java | Introspector.setBeanInfoSearchPath | public static void setBeanInfoSearchPath(String[] path) {
if (System.getSecurityManager() != null) {
System.getSecurityManager().checkPropertiesAccess();
}
searchPath = path;
} | java | public static void setBeanInfoSearchPath(String[] path) {
if (System.getSecurityManager() != null) {
System.getSecurityManager().checkPropertiesAccess();
}
searchPath = path;
} | [
"public",
"static",
"void",
"setBeanInfoSearchPath",
"(",
"String",
"[",
"]",
"path",
")",
"{",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"!=",
"null",
")",
"{",
"System",
".",
"getSecurityManager",
"(",
")",
".",
"checkPropertiesAccess",
"("... | Sets the search packages.
@param path the new search packages to be set. | [
"Sets",
"the",
"search",
"packages",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/Introspector.java#L249-L254 |
34,299 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicLongFieldUpdater.java | AtomicLongFieldUpdater.getAndSet | public long getAndSet(T obj, long newValue) {
long prev;
do {
prev = get(obj);
} while (!compareAndSet(obj, prev, newValue));
return prev;
} | java | public long getAndSet(T obj, long newValue) {
long prev;
do {
prev = get(obj);
} while (!compareAndSet(obj, prev, newValue));
return prev;
} | [
"public",
"long",
"getAndSet",
"(",
"T",
"obj",
",",
"long",
"newValue",
")",
"{",
"long",
"prev",
";",
"do",
"{",
"prev",
"=",
"get",
"(",
"obj",
")",
";",
"}",
"while",
"(",
"!",
"compareAndSet",
"(",
"obj",
",",
"prev",
",",
"newValue",
")",
"... | Atomically sets the field of the given object managed by this updater
to the given value and returns the old value.
@param obj An object whose field to get and set
@param newValue the new value
@return the previous value | [
"Atomically",
"sets",
"the",
"field",
"of",
"the",
"given",
"object",
"managed",
"by",
"this",
"updater",
"to",
"the",
"given",
"value",
"and",
"returns",
"the",
"old",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicLongFieldUpdater.java#L168-L174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.