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,500 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java | TimeZone.getDefaultRef | static synchronized TimeZone getDefaultRef() {
if (defaultTimeZone == null) {
defaultTimeZone = NativeTimeZone.getDefaultNativeTimeZone();
}
if (defaultTimeZone == null) {
defaultTimeZone = GMTHolder.INSTANCE;
}
return defaultTimeZone;
} | java | static synchronized TimeZone getDefaultRef() {
if (defaultTimeZone == null) {
defaultTimeZone = NativeTimeZone.getDefaultNativeTimeZone();
}
if (defaultTimeZone == null) {
defaultTimeZone = GMTHolder.INSTANCE;
}
return defaultTimeZone;
} | [
"static",
"synchronized",
"TimeZone",
"getDefaultRef",
"(",
")",
"{",
"if",
"(",
"defaultTimeZone",
"==",
"null",
")",
"{",
"defaultTimeZone",
"=",
"NativeTimeZone",
".",
"getDefaultNativeTimeZone",
"(",
")",
";",
"}",
"if",
"(",
"defaultTimeZone",
"==",
"null",... | Returns the reference to the default TimeZone object. This
method doesn't create a clone. | [
"Returns",
"the",
"reference",
"to",
"the",
"default",
"TimeZone",
"object",
".",
"This",
"method",
"doesn",
"t",
"create",
"a",
"clone",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java#L686-L696 |
34,501 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemIf.java | ElemIf.execute | public void execute(TransformerImpl transformer) throws TransformerException
{
XPathContext xctxt = transformer.getXPathContext();
int sourceNode = xctxt.getCurrentNode();
if (m_test.bool(xctxt, sourceNode, this)) {
transformer.executeChildTemplates(this, true);
}
} | java | public void execute(TransformerImpl transformer) throws TransformerException
{
XPathContext xctxt = transformer.getXPathContext();
int sourceNode = xctxt.getCurrentNode();
if (m_test.bool(xctxt, sourceNode, this)) {
transformer.executeChildTemplates(this, true);
}
} | [
"public",
"void",
"execute",
"(",
"TransformerImpl",
"transformer",
")",
"throws",
"TransformerException",
"{",
"XPathContext",
"xctxt",
"=",
"transformer",
".",
"getXPathContext",
"(",
")",
";",
"int",
"sourceNode",
"=",
"xctxt",
".",
"getCurrentNode",
"(",
")",
... | Conditionally execute a sub-template.
The expression is evaluated and the resulting object is converted
to a boolean as if by a call to the boolean function. If the result
is true, then the content template is instantiated; otherwise, nothing
is created.
@param transformer non-null reference to the the current transform-time state.
@throws TransformerException | [
"Conditionally",
"execute",
"a",
"sub",
"-",
"template",
".",
"The",
"expression",
"is",
"evaluated",
"and",
"the",
"resulting",
"object",
"is",
"converted",
"to",
"a",
"boolean",
"as",
"if",
"by",
"a",
"call",
"to",
"the",
"boolean",
"function",
".",
"If"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemIf.java#L127-L137 |
34,502 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java | CollationBuilder.findOrInsertNodeForCEs | private int findOrInsertNodeForCEs(int strength) {
assert(Collator.PRIMARY <= strength && strength <= Collator.QUATERNARY);
// Find the last CE that is at least as "strong" as the requested difference.
// Note: Stronger is smaller (Collator.PRIMARY=0).
long ce;
for(;; --cesLength) {
if(cesLength == 0) {
ce = ces[0] = 0;
cesLength = 1;
break;
} else {
ce = ces[cesLength - 1];
}
if(ceStrength(ce) <= strength) { break; }
}
if(isTempCE(ce)) {
// No need to findCommonNode() here for lower levels
// because insertTailoredNodeAfter() will do that anyway.
return indexFromTempCE(ce);
}
// root CE
if((int)(ce >>> 56) == Collation.UNASSIGNED_IMPLICIT_BYTE) {
throw new UnsupportedOperationException(
"tailoring relative to an unassigned code point not supported");
}
return findOrInsertNodeForRootCE(ce, strength);
} | java | private int findOrInsertNodeForCEs(int strength) {
assert(Collator.PRIMARY <= strength && strength <= Collator.QUATERNARY);
// Find the last CE that is at least as "strong" as the requested difference.
// Note: Stronger is smaller (Collator.PRIMARY=0).
long ce;
for(;; --cesLength) {
if(cesLength == 0) {
ce = ces[0] = 0;
cesLength = 1;
break;
} else {
ce = ces[cesLength - 1];
}
if(ceStrength(ce) <= strength) { break; }
}
if(isTempCE(ce)) {
// No need to findCommonNode() here for lower levels
// because insertTailoredNodeAfter() will do that anyway.
return indexFromTempCE(ce);
}
// root CE
if((int)(ce >>> 56) == Collation.UNASSIGNED_IMPLICIT_BYTE) {
throw new UnsupportedOperationException(
"tailoring relative to an unassigned code point not supported");
}
return findOrInsertNodeForRootCE(ce, strength);
} | [
"private",
"int",
"findOrInsertNodeForCEs",
"(",
"int",
"strength",
")",
"{",
"assert",
"(",
"Collator",
".",
"PRIMARY",
"<=",
"strength",
"&&",
"strength",
"<=",
"Collator",
".",
"QUATERNARY",
")",
";",
"// Find the last CE that is at least as \"strong\" as the request... | Picks one of the current CEs and finds or inserts a node in the graph
for the CE + strength. | [
"Picks",
"one",
"of",
"the",
"current",
"CEs",
"and",
"finds",
"or",
"inserts",
"a",
"node",
"in",
"the",
"graph",
"for",
"the",
"CE",
"+",
"strength",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L532-L561 |
34,503 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java | CollationBuilder.findOrInsertNodeForPrimary | private int findOrInsertNodeForPrimary(long p) {
int rootIndex = binarySearchForRootPrimaryNode(
rootPrimaryIndexes.getBuffer(), rootPrimaryIndexes.size(), nodes.getBuffer(), p);
if(rootIndex >= 0) {
return rootPrimaryIndexes.elementAti(rootIndex);
} else {
// Start a new list of nodes with this primary.
int index = nodes.size();
nodes.addElement(nodeFromWeight32(p));
rootPrimaryIndexes.insertElementAt(index, ~rootIndex);
return index;
}
} | java | private int findOrInsertNodeForPrimary(long p) {
int rootIndex = binarySearchForRootPrimaryNode(
rootPrimaryIndexes.getBuffer(), rootPrimaryIndexes.size(), nodes.getBuffer(), p);
if(rootIndex >= 0) {
return rootPrimaryIndexes.elementAti(rootIndex);
} else {
// Start a new list of nodes with this primary.
int index = nodes.size();
nodes.addElement(nodeFromWeight32(p));
rootPrimaryIndexes.insertElementAt(index, ~rootIndex);
return index;
}
} | [
"private",
"int",
"findOrInsertNodeForPrimary",
"(",
"long",
"p",
")",
"{",
"int",
"rootIndex",
"=",
"binarySearchForRootPrimaryNode",
"(",
"rootPrimaryIndexes",
".",
"getBuffer",
"(",
")",
",",
"rootPrimaryIndexes",
".",
"size",
"(",
")",
",",
"nodes",
".",
"ge... | Finds or inserts the node for a root CE's primary weight. | [
"Finds",
"or",
"inserts",
"the",
"node",
"for",
"a",
"root",
"CE",
"s",
"primary",
"weight",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L615-L627 |
34,504 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java | CollationBuilder.findOrInsertWeakNode | private int findOrInsertWeakNode(int index, int weight16, int level) {
assert(0 <= index && index < nodes.size());
assert(Collator.SECONDARY <= level && level <= Collator.TERTIARY);
if(weight16 == Collation.COMMON_WEIGHT16) {
return findCommonNode(index, level);
}
// If this will be the first below-common weight for the parent node,
// then we will also need to insert a common weight after it.
long node = nodes.elementAti(index);
assert(strengthFromNode(node) < level); // parent node is stronger
if(weight16 != 0 && weight16 < Collation.COMMON_WEIGHT16) {
int hasThisLevelBefore = level == Collator.SECONDARY ? HAS_BEFORE2 : HAS_BEFORE3;
if((node & hasThisLevelBefore) == 0) {
// The parent node has an implied level-common weight.
long commonNode =
nodeFromWeight16(Collation.COMMON_WEIGHT16) | nodeFromStrength(level);
if(level == Collator.SECONDARY) {
// Move the HAS_BEFORE3 flag from the parent node
// to the new secondary common node.
commonNode |= node & HAS_BEFORE3;
node &= ~(long)HAS_BEFORE3;
}
nodes.setElementAt(node | hasThisLevelBefore, index);
// Insert below-common-weight node.
int nextIndex = nextIndexFromNode(node);
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
index = insertNodeBetween(index, nextIndex, node);
// Insert common-weight node.
insertNodeBetween(index, nextIndex, commonNode);
// Return index of below-common-weight node.
return index;
}
}
// Find the root CE's weight for this level.
// Postpone insertion if not found:
// Insert the new root node before the next stronger node,
// or before the next root node with the same strength and a larger weight.
int nextIndex;
while((nextIndex = nextIndexFromNode(node)) != 0) {
node = nodes.elementAti(nextIndex);
int nextStrength = strengthFromNode(node);
if(nextStrength <= level) {
// Insert before a stronger node.
if(nextStrength < level) { break; }
// nextStrength == level
if(!isTailoredNode(node)) {
int nextWeight16 = weight16FromNode(node);
if(nextWeight16 == weight16) {
// Found the node for the root CE up to this level.
return nextIndex;
}
// Insert before a node with a larger same-strength weight.
if(nextWeight16 > weight16) { break; }
}
}
// Skip the next node.
index = nextIndex;
}
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
return insertNodeBetween(index, nextIndex, node);
} | java | private int findOrInsertWeakNode(int index, int weight16, int level) {
assert(0 <= index && index < nodes.size());
assert(Collator.SECONDARY <= level && level <= Collator.TERTIARY);
if(weight16 == Collation.COMMON_WEIGHT16) {
return findCommonNode(index, level);
}
// If this will be the first below-common weight for the parent node,
// then we will also need to insert a common weight after it.
long node = nodes.elementAti(index);
assert(strengthFromNode(node) < level); // parent node is stronger
if(weight16 != 0 && weight16 < Collation.COMMON_WEIGHT16) {
int hasThisLevelBefore = level == Collator.SECONDARY ? HAS_BEFORE2 : HAS_BEFORE3;
if((node & hasThisLevelBefore) == 0) {
// The parent node has an implied level-common weight.
long commonNode =
nodeFromWeight16(Collation.COMMON_WEIGHT16) | nodeFromStrength(level);
if(level == Collator.SECONDARY) {
// Move the HAS_BEFORE3 flag from the parent node
// to the new secondary common node.
commonNode |= node & HAS_BEFORE3;
node &= ~(long)HAS_BEFORE3;
}
nodes.setElementAt(node | hasThisLevelBefore, index);
// Insert below-common-weight node.
int nextIndex = nextIndexFromNode(node);
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
index = insertNodeBetween(index, nextIndex, node);
// Insert common-weight node.
insertNodeBetween(index, nextIndex, commonNode);
// Return index of below-common-weight node.
return index;
}
}
// Find the root CE's weight for this level.
// Postpone insertion if not found:
// Insert the new root node before the next stronger node,
// or before the next root node with the same strength and a larger weight.
int nextIndex;
while((nextIndex = nextIndexFromNode(node)) != 0) {
node = nodes.elementAti(nextIndex);
int nextStrength = strengthFromNode(node);
if(nextStrength <= level) {
// Insert before a stronger node.
if(nextStrength < level) { break; }
// nextStrength == level
if(!isTailoredNode(node)) {
int nextWeight16 = weight16FromNode(node);
if(nextWeight16 == weight16) {
// Found the node for the root CE up to this level.
return nextIndex;
}
// Insert before a node with a larger same-strength weight.
if(nextWeight16 > weight16) { break; }
}
}
// Skip the next node.
index = nextIndex;
}
node = nodeFromWeight16(weight16) | nodeFromStrength(level);
return insertNodeBetween(index, nextIndex, node);
} | [
"private",
"int",
"findOrInsertWeakNode",
"(",
"int",
"index",
",",
"int",
"weight16",
",",
"int",
"level",
")",
"{",
"assert",
"(",
"0",
"<=",
"index",
"&&",
"index",
"<",
"nodes",
".",
"size",
"(",
")",
")",
";",
"assert",
"(",
"Collator",
".",
"SE... | Finds or inserts the node for a secondary or tertiary weight. | [
"Finds",
"or",
"inserts",
"the",
"node",
"for",
"a",
"secondary",
"or",
"tertiary",
"weight",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L630-L693 |
34,505 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java | CollationBuilder.insertNodeBetween | private int insertNodeBetween(int index, int nextIndex, long node) {
assert(previousIndexFromNode(node) == 0);
assert(nextIndexFromNode(node) == 0);
assert(nextIndexFromNode(nodes.elementAti(index)) == nextIndex);
// Append the new node and link it to the existing nodes.
int newIndex = nodes.size();
node |= nodeFromPreviousIndex(index) | nodeFromNextIndex(nextIndex);
nodes.addElement(node);
// nodes[index].nextIndex = newIndex
node = nodes.elementAti(index);
nodes.setElementAt(changeNodeNextIndex(node, newIndex), index);
// nodes[nextIndex].previousIndex = newIndex
if(nextIndex != 0) {
node = nodes.elementAti(nextIndex);
nodes.setElementAt(changeNodePreviousIndex(node, newIndex), nextIndex);
}
return newIndex;
} | java | private int insertNodeBetween(int index, int nextIndex, long node) {
assert(previousIndexFromNode(node) == 0);
assert(nextIndexFromNode(node) == 0);
assert(nextIndexFromNode(nodes.elementAti(index)) == nextIndex);
// Append the new node and link it to the existing nodes.
int newIndex = nodes.size();
node |= nodeFromPreviousIndex(index) | nodeFromNextIndex(nextIndex);
nodes.addElement(node);
// nodes[index].nextIndex = newIndex
node = nodes.elementAti(index);
nodes.setElementAt(changeNodeNextIndex(node, newIndex), index);
// nodes[nextIndex].previousIndex = newIndex
if(nextIndex != 0) {
node = nodes.elementAti(nextIndex);
nodes.setElementAt(changeNodePreviousIndex(node, newIndex), nextIndex);
}
return newIndex;
} | [
"private",
"int",
"insertNodeBetween",
"(",
"int",
"index",
",",
"int",
"nextIndex",
",",
"long",
"node",
")",
"{",
"assert",
"(",
"previousIndexFromNode",
"(",
"node",
")",
"==",
"0",
")",
";",
"assert",
"(",
"nextIndexFromNode",
"(",
"node",
")",
"==",
... | Inserts a new node into the list, between list-adjacent items.
The node's previous and next indexes must not be set yet.
@return the new node's index | [
"Inserts",
"a",
"new",
"node",
"into",
"the",
"list",
"between",
"list",
"-",
"adjacent",
"items",
".",
"The",
"node",
"s",
"previous",
"and",
"next",
"indexes",
"must",
"not",
"be",
"set",
"yet",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L728-L745 |
34,506 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java | CollationBuilder.countTailoredNodes | private static int countTailoredNodes(long[] nodesArray, int i, int strength) {
int count = 0;
for(;;) {
if(i == 0) { break; }
long node = nodesArray[i];
if(strengthFromNode(node) < strength) { break; }
if(strengthFromNode(node) == strength) {
if(isTailoredNode(node)) {
++count;
} else {
break;
}
}
i = nextIndexFromNode(node);
}
return count;
} | java | private static int countTailoredNodes(long[] nodesArray, int i, int strength) {
int count = 0;
for(;;) {
if(i == 0) { break; }
long node = nodesArray[i];
if(strengthFromNode(node) < strength) { break; }
if(strengthFromNode(node) == strength) {
if(isTailoredNode(node)) {
++count;
} else {
break;
}
}
i = nextIndexFromNode(node);
}
return count;
} | [
"private",
"static",
"int",
"countTailoredNodes",
"(",
"long",
"[",
"]",
"nodesArray",
",",
"int",
"i",
",",
"int",
"strength",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"break",... | Counts the tailored nodes of the given strength up to the next node
which is either stronger or has an explicit weight of this strength. | [
"Counts",
"the",
"tailored",
"nodes",
"of",
"the",
"given",
"strength",
"up",
"to",
"the",
"next",
"node",
"which",
"is",
"either",
"stronger",
"or",
"has",
"an",
"explicit",
"weight",
"of",
"this",
"strength",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L1308-L1324 |
34,507 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java | CollationBuilder.finalizeCEs | private void finalizeCEs() {
CollationDataBuilder newBuilder = new CollationDataBuilder();
newBuilder.initForTailoring(baseData);
CEFinalizer finalizer = new CEFinalizer(nodes.getBuffer());
newBuilder.copyFrom(dataBuilder, finalizer);
dataBuilder = newBuilder;
} | java | private void finalizeCEs() {
CollationDataBuilder newBuilder = new CollationDataBuilder();
newBuilder.initForTailoring(baseData);
CEFinalizer finalizer = new CEFinalizer(nodes.getBuffer());
newBuilder.copyFrom(dataBuilder, finalizer);
dataBuilder = newBuilder;
} | [
"private",
"void",
"finalizeCEs",
"(",
")",
"{",
"CollationDataBuilder",
"newBuilder",
"=",
"new",
"CollationDataBuilder",
"(",
")",
";",
"newBuilder",
".",
"initForTailoring",
"(",
"baseData",
")",
";",
"CEFinalizer",
"finalizer",
"=",
"new",
"CEFinalizer",
"(",
... | Replaces temporary CEs with the final CEs they point to. | [
"Replaces",
"temporary",
"CEs",
"with",
"the",
"final",
"CEs",
"they",
"point",
"to",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L1354-L1360 |
34,508 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java | Deflater.setStrategy | public void setStrategy(int strategy) {
switch (strategy) {
case DEFAULT_STRATEGY:
case FILTERED:
case HUFFMAN_ONLY:
break;
default:
throw new IllegalArgumentException();
}
synchronized (zsRef) {
if (this.strategy != strategy) {
this.strategy = strategy;
setParams = true;
}
}
} | java | public void setStrategy(int strategy) {
switch (strategy) {
case DEFAULT_STRATEGY:
case FILTERED:
case HUFFMAN_ONLY:
break;
default:
throw new IllegalArgumentException();
}
synchronized (zsRef) {
if (this.strategy != strategy) {
this.strategy = strategy;
setParams = true;
}
}
} | [
"public",
"void",
"setStrategy",
"(",
"int",
"strategy",
")",
"{",
"switch",
"(",
"strategy",
")",
"{",
"case",
"DEFAULT_STRATEGY",
":",
"case",
"FILTERED",
":",
"case",
"HUFFMAN_ONLY",
":",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentExcepti... | Sets the compression strategy to the specified value.
<p> If the compression strategy is changed, the next invocation
of {@code deflate} will compress the input available so far with
the old strategy (and may be flushed); the new strategy will take
effect only after that invocation.
@param strategy the new compression strategy
@exception IllegalArgumentException if the compression strategy is
invalid | [
"Sets",
"the",
"compression",
"strategy",
"to",
"the",
"specified",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L276-L291 |
34,509 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java | Deflater.setLevel | public void setLevel(int level) {
if ((level < 0 || level > 9) && level != DEFAULT_COMPRESSION) {
throw new IllegalArgumentException("invalid compression level");
}
synchronized (zsRef) {
if (this.level != level) {
this.level = level;
setParams = true;
}
}
} | java | public void setLevel(int level) {
if ((level < 0 || level > 9) && level != DEFAULT_COMPRESSION) {
throw new IllegalArgumentException("invalid compression level");
}
synchronized (zsRef) {
if (this.level != level) {
this.level = level;
setParams = true;
}
}
} | [
"public",
"void",
"setLevel",
"(",
"int",
"level",
")",
"{",
"if",
"(",
"(",
"level",
"<",
"0",
"||",
"level",
">",
"9",
")",
"&&",
"level",
"!=",
"DEFAULT_COMPRESSION",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid compression level\... | Sets the compression level to the specified value.
<p> If the compression level is changed, the next invocation
of {@code deflate} will compress the input available so far
with the old level (and may be flushed); the new level will
take effect only after that invocation.
@param level the new compression level (0-9)
@exception IllegalArgumentException if the compression level is invalid | [
"Sets",
"the",
"compression",
"level",
"to",
"the",
"specified",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L304-L314 |
34,510 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java | Deflater.deflate | public int deflate(byte[] b, int off, int len, int flush) {
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
}
synchronized (zsRef) {
ensureOpen();
if (flush == NO_FLUSH || flush == SYNC_FLUSH ||
flush == FULL_FLUSH) {
int thisLen = this.len;
int n = deflateBytes(zsRef.address(), b, off, len, flush);
bytesWritten += n;
bytesRead += (thisLen - this.len);
return n;
}
throw new IllegalArgumentException();
}
} | java | public int deflate(byte[] b, int off, int len, int flush) {
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
}
synchronized (zsRef) {
ensureOpen();
if (flush == NO_FLUSH || flush == SYNC_FLUSH ||
flush == FULL_FLUSH) {
int thisLen = this.len;
int n = deflateBytes(zsRef.address(), b, off, len, flush);
bytesWritten += n;
bytesRead += (thisLen - this.len);
return n;
}
throw new IllegalArgumentException();
}
} | [
"public",
"int",
"deflate",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
",",
"int",
"flush",
")",
"{",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"off",
"... | Compresses the input data and fills the specified buffer with compressed
data. Returns actual number of bytes of data compressed.
<p>Compression flush mode is one of the following three modes:
<ul>
<li>{@link #NO_FLUSH}: allows the deflater to decide how much data
to accumulate, before producing output, in order to achieve the best
compression (should be used in normal use scenario). A return value
of 0 in this flush mode indicates that {@link #needsInput()} should
be called in order to determine if more input data is required.
<li>{@link #SYNC_FLUSH}: all pending output in the deflater is flushed,
to the specified output buffer, so that an inflater that works on
compressed data can get all input data available so far (In particular
the {@link #needsInput()} returns {@code true} after this invocation
if enough output space is provided). Flushing with {@link #SYNC_FLUSH}
may degrade compression for some compression algorithms and so it
should be used only when necessary.
<li>{@link #FULL_FLUSH}: all pending output is flushed out as with
{@link #SYNC_FLUSH}. The compression state is reset so that the inflater
that works on the compressed output data can restart from this point
if previous compressed data has been damaged or if random access is
desired. Using {@link #FULL_FLUSH} too often can seriously degrade
compression.
</ul>
<p>In the case of {@link #FULL_FLUSH} or {@link #SYNC_FLUSH}, if
the return value is {@code len}, the space available in output
buffer {@code b}, this method should be invoked again with the same
{@code flush} parameter and more output space.
@param b the buffer for the compressed data
@param off the start offset of the data
@param len the maximum number of bytes of compressed data
@param flush the compression flush mode
@return the actual number of bytes of compressed data written to
the output buffer
@throws IllegalArgumentException if the flush mode is invalid
@since 1.7 | [
"Compresses",
"the",
"input",
"data",
"and",
"fills",
"the",
"specified",
"buffer",
"with",
"compressed",
"data",
".",
"Returns",
"actual",
"number",
"of",
"bytes",
"of",
"data",
"compressed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L434-L453 |
34,511 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java | Deflater.reset | public void reset() {
synchronized (zsRef) {
ensureOpen();
reset(zsRef.address());
finish = false;
finished = false;
off = len = 0;
bytesRead = bytesWritten = 0;
}
} | java | public void reset() {
synchronized (zsRef) {
ensureOpen();
reset(zsRef.address());
finish = false;
finished = false;
off = len = 0;
bytesRead = bytesWritten = 0;
}
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"synchronized",
"(",
"zsRef",
")",
"{",
"ensureOpen",
"(",
")",
";",
"reset",
"(",
"zsRef",
".",
"address",
"(",
")",
")",
";",
"finish",
"=",
"false",
";",
"finished",
"=",
"false",
";",
"off",
"=",
"len",... | Resets deflater so that a new set of input data can be processed.
Keeps current compression level and strategy settings. | [
"Resets",
"deflater",
"so",
"that",
"a",
"new",
"set",
"of",
"input",
"data",
"can",
"be",
"processed",
".",
"Keeps",
"current",
"compression",
"level",
"and",
"strategy",
"settings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Deflater.java#L522-L531 |
34,512 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/GeneralSubtree.java | GeneralSubtree.encode | public void encode(DerOutputStream out) throws IOException {
DerOutputStream seq = new DerOutputStream();
name.encode(seq);
if (minimum != MIN_DEFAULT) {
DerOutputStream tmp = new DerOutputStream();
tmp.putInteger(minimum);
seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_MIN), tmp);
}
if (maximum != -1) {
DerOutputStream tmp = new DerOutputStream();
tmp.putInteger(maximum);
seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_MAX), tmp);
}
out.write(DerValue.tag_Sequence, seq);
} | java | public void encode(DerOutputStream out) throws IOException {
DerOutputStream seq = new DerOutputStream();
name.encode(seq);
if (minimum != MIN_DEFAULT) {
DerOutputStream tmp = new DerOutputStream();
tmp.putInteger(minimum);
seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_MIN), tmp);
}
if (maximum != -1) {
DerOutputStream tmp = new DerOutputStream();
tmp.putInteger(maximum);
seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_MAX), tmp);
}
out.write(DerValue.tag_Sequence, seq);
} | [
"public",
"void",
"encode",
"(",
"DerOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DerOutputStream",
"seq",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"name",
".",
"encode",
"(",
"seq",
")",
";",
"if",
"(",
"minimum",
"!=",
"MIN_DEFAULT",
")... | Encode the GeneralSubtree.
@params out the DerOutputStream to encode this object to. | [
"Encode",
"the",
"GeneralSubtree",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/GeneralSubtree.java#L192-L210 |
34,513 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getBoolean | public boolean getBoolean() throws IOException {
if (tag != tag_Boolean) {
throw new IOException("DerValue.getBoolean, not a BOOLEAN " + tag);
}
if (length != 1) {
throw new IOException("DerValue.getBoolean, invalid length "
+ length);
}
if (buffer.read() != 0) {
return true;
}
return false;
} | java | public boolean getBoolean() throws IOException {
if (tag != tag_Boolean) {
throw new IOException("DerValue.getBoolean, not a BOOLEAN " + tag);
}
if (length != 1) {
throw new IOException("DerValue.getBoolean, invalid length "
+ length);
}
if (buffer.read() != 0) {
return true;
}
return false;
} | [
"public",
"boolean",
"getBoolean",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_Boolean",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getBoolean, not a BOOLEAN \"",
"+",
"tag",
")",
";",
"}",
"if",
"(",
"length",
"!=",
"... | Returns an ASN.1 BOOLEAN
@return the boolean held in this DER value | [
"Returns",
"an",
"ASN",
".",
"1",
"BOOLEAN"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L439-L451 |
34,514 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getOctetString | public byte[] getOctetString() throws IOException {
byte[] bytes;
if (tag != tag_OctetString && !isConstructed(tag_OctetString)) {
throw new IOException(
"DerValue.getOctetString, not an Octet String: " + tag);
}
bytes = new byte[length];
// Note: do not tempt to call buffer.read(bytes) at all. There's a
// known bug that it returns -1 instead of 0.
if (length == 0) {
return bytes;
}
if (buffer.read(bytes) != length)
throw new IOException("short read on DerValue buffer");
if (isConstructed()) {
DerInputStream in = new DerInputStream(bytes);
bytes = null;
while (in.available() != 0) {
bytes = append(bytes, in.getOctetString());
}
}
return bytes;
} | java | public byte[] getOctetString() throws IOException {
byte[] bytes;
if (tag != tag_OctetString && !isConstructed(tag_OctetString)) {
throw new IOException(
"DerValue.getOctetString, not an Octet String: " + tag);
}
bytes = new byte[length];
// Note: do not tempt to call buffer.read(bytes) at all. There's a
// known bug that it returns -1 instead of 0.
if (length == 0) {
return bytes;
}
if (buffer.read(bytes) != length)
throw new IOException("short read on DerValue buffer");
if (isConstructed()) {
DerInputStream in = new DerInputStream(bytes);
bytes = null;
while (in.available() != 0) {
bytes = append(bytes, in.getOctetString());
}
}
return bytes;
} | [
"public",
"byte",
"[",
"]",
"getOctetString",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
";",
"if",
"(",
"tag",
"!=",
"tag_OctetString",
"&&",
"!",
"isConstructed",
"(",
"tag_OctetString",
")",
")",
"{",
"throw",
"new",
"IOException... | Returns an ASN.1 OCTET STRING
@return the octet string held in this DER value | [
"Returns",
"an",
"ASN",
".",
"1",
"OCTET",
"STRING"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L480-L503 |
34,515 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getInteger | public int getInteger() throws IOException {
if (tag != tag_Integer) {
throw new IOException("DerValue.getInteger, not an int " + tag);
}
return buffer.getInteger(data.available());
} | java | public int getInteger() throws IOException {
if (tag != tag_Integer) {
throw new IOException("DerValue.getInteger, not an int " + tag);
}
return buffer.getInteger(data.available());
} | [
"public",
"int",
"getInteger",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_Integer",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getInteger, not an int \"",
"+",
"tag",
")",
";",
"}",
"return",
"buffer",
".",
"getInteger"... | Returns an ASN.1 INTEGER value as an integer.
@return the integer held in this DER value. | [
"Returns",
"an",
"ASN",
".",
"1",
"INTEGER",
"value",
"as",
"an",
"integer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L510-L515 |
34,516 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getBigInteger | public BigInteger getBigInteger() throws IOException {
if (tag != tag_Integer)
throw new IOException("DerValue.getBigInteger, not an int " + tag);
return buffer.getBigInteger(data.available(), false);
} | java | public BigInteger getBigInteger() throws IOException {
if (tag != tag_Integer)
throw new IOException("DerValue.getBigInteger, not an int " + tag);
return buffer.getBigInteger(data.available(), false);
} | [
"public",
"BigInteger",
"getBigInteger",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_Integer",
")",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getBigInteger, not an int \"",
"+",
"tag",
")",
";",
"return",
"buffer",
".",
"getBigIntege... | Returns an ASN.1 INTEGER value as a BigInteger.
@return the integer held in this DER value as a BigInteger. | [
"Returns",
"an",
"ASN",
".",
"1",
"INTEGER",
"value",
"as",
"a",
"BigInteger",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L522-L526 |
34,517 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getEnumerated | public int getEnumerated() throws IOException {
if (tag != tag_Enumerated) {
throw new IOException("DerValue.getEnumerated, incorrect tag: "
+ tag);
}
return buffer.getInteger(data.available());
} | java | public int getEnumerated() throws IOException {
if (tag != tag_Enumerated) {
throw new IOException("DerValue.getEnumerated, incorrect tag: "
+ tag);
}
return buffer.getInteger(data.available());
} | [
"public",
"int",
"getEnumerated",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_Enumerated",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getEnumerated, incorrect tag: \"",
"+",
"tag",
")",
";",
"}",
"return",
"buffer",
".",
... | Returns an ASN.1 ENUMERATED value.
@return the integer held in this DER value. | [
"Returns",
"an",
"ASN",
".",
"1",
"ENUMERATED",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L546-L552 |
34,518 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getBitString | public byte[] getBitString(boolean tagImplicit) throws IOException {
if (!tagImplicit) {
if (tag != tag_BitString)
throw new IOException("DerValue.getBitString, not a bit string "
+ tag);
}
return buffer.getBitString();
} | java | public byte[] getBitString(boolean tagImplicit) throws IOException {
if (!tagImplicit) {
if (tag != tag_BitString)
throw new IOException("DerValue.getBitString, not a bit string "
+ tag);
}
return buffer.getBitString();
} | [
"public",
"byte",
"[",
"]",
"getBitString",
"(",
"boolean",
"tagImplicit",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"tagImplicit",
")",
"{",
"if",
"(",
"tag",
"!=",
"tag_BitString",
")",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getBitString, n... | Returns an ASN.1 BIT STRING value, with the tag assumed implicit
based on the parameter. The bit string must be byte-aligned.
@params tagImplicit if true, the tag is assumed implicit.
@return the bit string held in this value | [
"Returns",
"an",
"ASN",
".",
"1",
"BIT",
"STRING",
"value",
"with",
"the",
"tag",
"assumed",
"implicit",
"based",
"on",
"the",
"parameter",
".",
"The",
"bit",
"string",
"must",
"be",
"byte",
"-",
"aligned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L613-L620 |
34,519 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getUnalignedBitString | public BitArray getUnalignedBitString(boolean tagImplicit)
throws IOException {
if (!tagImplicit) {
if (tag != tag_BitString)
throw new IOException("DerValue.getBitString, not a bit string "
+ tag);
}
return buffer.getUnalignedBitString();
} | java | public BitArray getUnalignedBitString(boolean tagImplicit)
throws IOException {
if (!tagImplicit) {
if (tag != tag_BitString)
throw new IOException("DerValue.getBitString, not a bit string "
+ tag);
}
return buffer.getUnalignedBitString();
} | [
"public",
"BitArray",
"getUnalignedBitString",
"(",
"boolean",
"tagImplicit",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"tagImplicit",
")",
"{",
"if",
"(",
"tag",
"!=",
"tag_BitString",
")",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getBitString, no... | Returns an ASN.1 BIT STRING value, with the tag assumed implicit
based on the parameter. The bit string need not be byte-aligned.
@params tagImplicit if true, the tag is assumed implicit.
@return the bit string held in this value | [
"Returns",
"an",
"ASN",
".",
"1",
"BIT",
"STRING",
"value",
"with",
"the",
"tag",
"assumed",
"implicit",
"based",
"on",
"the",
"parameter",
".",
"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/DerValue.java#L629-L637 |
34,520 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getDataBytes | public byte[] getDataBytes() throws IOException {
byte[] retVal = new byte[length];
synchronized (data) {
data.reset();
data.getBytes(retVal);
}
return retVal;
} | java | public byte[] getDataBytes() throws IOException {
byte[] retVal = new byte[length];
synchronized (data) {
data.reset();
data.getBytes(retVal);
}
return retVal;
} | [
"public",
"byte",
"[",
"]",
"getDataBytes",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"retVal",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"synchronized",
"(",
"data",
")",
"{",
"data",
".",
"reset",
"(",
")",
";",
"data",
".",
"g... | Helper routine to return all the bytes contained in the
DerInputStream associated with this object. | [
"Helper",
"routine",
"to",
"return",
"all",
"the",
"bytes",
"contained",
"in",
"the",
"DerInputStream",
"associated",
"with",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L643-L650 |
34,521 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getUTCTime | public Date getUTCTime() throws IOException {
if (tag != tag_UtcTime) {
throw new IOException("DerValue.getUTCTime, not a UtcTime: " + tag);
}
return buffer.getUTCTime(data.available());
} | java | public Date getUTCTime() throws IOException {
if (tag != tag_UtcTime) {
throw new IOException("DerValue.getUTCTime, not a UtcTime: " + tag);
}
return buffer.getUTCTime(data.available());
} | [
"public",
"Date",
"getUTCTime",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_UtcTime",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getUTCTime, not a UtcTime: \"",
"+",
"tag",
")",
";",
"}",
"return",
"buffer",
".",
"getUTC... | Returns a Date if the DerValue is UtcTime.
@return the Date held in this DER value | [
"Returns",
"a",
"Date",
"if",
"the",
"DerValue",
"is",
"UtcTime",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L741-L746 |
34,522 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.getGeneralizedTime | public Date getGeneralizedTime() throws IOException {
if (tag != tag_GeneralizedTime) {
throw new IOException(
"DerValue.getGeneralizedTime, not a GeneralizedTime: " + tag);
}
return buffer.getGeneralizedTime(data.available());
} | java | public Date getGeneralizedTime() throws IOException {
if (tag != tag_GeneralizedTime) {
throw new IOException(
"DerValue.getGeneralizedTime, not a GeneralizedTime: " + tag);
}
return buffer.getGeneralizedTime(data.available());
} | [
"public",
"Date",
"getGeneralizedTime",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"!=",
"tag_GeneralizedTime",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DerValue.getGeneralizedTime, not a GeneralizedTime: \"",
"+",
"tag",
")",
";",
"}",
"retur... | Returns a Date if the DerValue is GeneralizedTime.
@return the Date held in this DER value | [
"Returns",
"a",
"Date",
"if",
"the",
"DerValue",
"is",
"GeneralizedTime",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L753-L759 |
34,523 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.toByteArray | public byte[] toByteArray() throws IOException {
DerOutputStream out = new DerOutputStream();
encode(out);
data.reset();
return out.toByteArray();
} | java | public byte[] toByteArray() throws IOException {
DerOutputStream out = new DerOutputStream();
encode(out);
data.reset();
return out.toByteArray();
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"throws",
"IOException",
"{",
"DerOutputStream",
"out",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"encode",
"(",
"out",
")",
";",
"data",
".",
"reset",
"(",
")",
";",
"return",
"out",
".",
"toByt... | Returns a DER-encoded value, such that if it's passed to the
DerValue constructor, a value equivalent to "this" is returned.
@return DER-encoded value, including tag and length. | [
"Returns",
"a",
"DER",
"-",
"encoded",
"value",
"such",
"that",
"if",
"it",
"s",
"passed",
"to",
"the",
"DerValue",
"constructor",
"a",
"value",
"equivalent",
"to",
"this",
"is",
"returned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L852-L858 |
34,524 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.toDerInputStream | public DerInputStream toDerInputStream() throws IOException {
if (tag == tag_Sequence || tag == tag_Set)
return new DerInputStream(buffer);
throw new IOException("toDerInputStream rejects tag type " + tag);
} | java | public DerInputStream toDerInputStream() throws IOException {
if (tag == tag_Sequence || tag == tag_Set)
return new DerInputStream(buffer);
throw new IOException("toDerInputStream rejects tag type " + tag);
} | [
"public",
"DerInputStream",
"toDerInputStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tag",
"==",
"tag_Sequence",
"||",
"tag",
"==",
"tag_Set",
")",
"return",
"new",
"DerInputStream",
"(",
"buffer",
")",
";",
"throw",
"new",
"IOException",
"(",
... | For "set" and "sequence" types, this function may be used
to return a DER stream of the members of the set or sequence.
This operation is not supported for primitive types such as
integers or bit strings. | [
"For",
"set",
"and",
"sequence",
"types",
"this",
"function",
"may",
"be",
"used",
"to",
"return",
"a",
"DER",
"stream",
"of",
"the",
"members",
"of",
"the",
"set",
"or",
"sequence",
".",
"This",
"operation",
"is",
"not",
"supported",
"for",
"primitive",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L866-L870 |
34,525 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java | DerValue.createTag | public static byte createTag(byte tagClass, boolean form, byte val) {
byte tag = (byte)(tagClass | val);
if (form) {
tag |= (byte)0x20;
}
return (tag);
} | java | public static byte createTag(byte tagClass, boolean form, byte val) {
byte tag = (byte)(tagClass | val);
if (form) {
tag |= (byte)0x20;
}
return (tag);
} | [
"public",
"static",
"byte",
"createTag",
"(",
"byte",
"tagClass",
",",
"boolean",
"form",
",",
"byte",
"val",
")",
"{",
"byte",
"tag",
"=",
"(",
"byte",
")",
"(",
"tagClass",
"|",
"val",
")",
";",
"if",
"(",
"form",
")",
"{",
"tag",
"|=",
"(",
"b... | Create the tag of the attribute.
@params class the tag class type, one of UNIVERSAL, CONTEXT,
APPLICATION or PRIVATE
@params form if true, the value is constructed, otherwise it
is primitive.
@params val the tag value | [
"Create",
"the",
"tag",
"of",
"the",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerValue.java#L930-L936 |
34,526 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java | IslamicCalendar.setCivil | public void setCivil(boolean beCivil)
{
civil = beCivil;
if (beCivil && cType != CalculationType.ISLAMIC_CIVIL) {
// The fields of the calendar will become invalid, because the calendar
// rules are different
long m = getTimeInMillis();
cType = CalculationType.ISLAMIC_CIVIL;
clear();
setTimeInMillis(m);
} else if(!beCivil && cType != CalculationType.ISLAMIC) {
// The fields of the calendar will become invalid, because the calendar
// rules are different
long m = getTimeInMillis();
cType = CalculationType.ISLAMIC;
clear();
setTimeInMillis(m);
}
} | java | public void setCivil(boolean beCivil)
{
civil = beCivil;
if (beCivil && cType != CalculationType.ISLAMIC_CIVIL) {
// The fields of the calendar will become invalid, because the calendar
// rules are different
long m = getTimeInMillis();
cType = CalculationType.ISLAMIC_CIVIL;
clear();
setTimeInMillis(m);
} else if(!beCivil && cType != CalculationType.ISLAMIC) {
// The fields of the calendar will become invalid, because the calendar
// rules are different
long m = getTimeInMillis();
cType = CalculationType.ISLAMIC;
clear();
setTimeInMillis(m);
}
} | [
"public",
"void",
"setCivil",
"(",
"boolean",
"beCivil",
")",
"{",
"civil",
"=",
"beCivil",
";",
"if",
"(",
"beCivil",
"&&",
"cType",
"!=",
"CalculationType",
".",
"ISLAMIC_CIVIL",
")",
"{",
"// The fields of the calendar will become invalid, because the calendar",
"/... | Determines whether this object uses the fixed-cycle Islamic civil calendar
or an approximation of the religious, astronomical calendar.
@param beCivil <code>true</code> to use the civil calendar,
<code>false</code> to use the astronomical calendar.
@apiNote <strong>Discouraged:</strong> ICU 57 use setCalculationType(CalculationType) instead
@hide unsupported on Android | [
"Determines",
"whether",
"this",
"object",
"uses",
"the",
"fixed",
"-",
"cycle",
"Islamic",
"civil",
"calendar",
"or",
"an",
"approximation",
"of",
"the",
"religious",
"astronomical",
"calendar",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java#L305-L324 |
34,527 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java | IslamicCalendar.handleGetYearLength | @Override
protected int handleGetYearLength(int extendedYear) {
int length =0;
if (cType == CalculationType.ISLAMIC_CIVIL
|| cType == CalculationType.ISLAMIC_TBLA
|| (cType == CalculationType.ISLAMIC_UMALQURA && (extendedYear < UMALQURA_YEAR_START || extendedYear > UMALQURA_YEAR_END) )) {
length = 354 + (civilLeapYear(extendedYear) ? 1 : 0);
} else if (cType == CalculationType.ISLAMIC) {
int month = 12*(extendedYear-1);
length = (int)(trueMonthStart(month + 12) - trueMonthStart(month));
} else if (cType == CalculationType.ISLAMIC_UMALQURA) {
for(int i=0; i<12; i++)
length += handleGetMonthLength(extendedYear, i);
}
return length;
} | java | @Override
protected int handleGetYearLength(int extendedYear) {
int length =0;
if (cType == CalculationType.ISLAMIC_CIVIL
|| cType == CalculationType.ISLAMIC_TBLA
|| (cType == CalculationType.ISLAMIC_UMALQURA && (extendedYear < UMALQURA_YEAR_START || extendedYear > UMALQURA_YEAR_END) )) {
length = 354 + (civilLeapYear(extendedYear) ? 1 : 0);
} else if (cType == CalculationType.ISLAMIC) {
int month = 12*(extendedYear-1);
length = (int)(trueMonthStart(month + 12) - trueMonthStart(month));
} else if (cType == CalculationType.ISLAMIC_UMALQURA) {
for(int i=0; i<12; i++)
length += handleGetMonthLength(extendedYear, i);
}
return length;
} | [
"@",
"Override",
"protected",
"int",
"handleGetYearLength",
"(",
"int",
"extendedYear",
")",
"{",
"int",
"length",
"=",
"0",
";",
"if",
"(",
"cType",
"==",
"CalculationType",
".",
"ISLAMIC_CIVIL",
"||",
"cType",
"==",
"CalculationType",
".",
"ISLAMIC_TBLA",
"|... | Return the number of days in the given Islamic year | [
"Return",
"the",
"number",
"of",
"days",
"in",
"the",
"given",
"Islamic",
"year"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java#L744-L760 |
34,528 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java | IslamicCalendar.setCalculationType | public void setCalculationType(CalculationType type) {
cType = type;
// ensure civil property is up-to-date
if(cType == CalculationType.ISLAMIC_CIVIL)
civil = true;
else
civil = false;
} | java | public void setCalculationType(CalculationType type) {
cType = type;
// ensure civil property is up-to-date
if(cType == CalculationType.ISLAMIC_CIVIL)
civil = true;
else
civil = false;
} | [
"public",
"void",
"setCalculationType",
"(",
"CalculationType",
"type",
")",
"{",
"cType",
"=",
"type",
";",
"// ensure civil property is up-to-date",
"if",
"(",
"cType",
"==",
"CalculationType",
".",
"ISLAMIC_CIVIL",
")",
"civil",
"=",
"true",
";",
"else",
"civil... | sets the calculation type for this calendar. | [
"sets",
"the",
"calculation",
"type",
"for",
"this",
"calendar",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java#L928-L936 |
34,529 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/XMLFormatter.java | XMLFormatter.a2 | private void a2(StringBuilder sb, int x) {
if (x < 10) {
sb.append('0');
}
sb.append(x);
} | java | private void a2(StringBuilder sb, int x) {
if (x < 10) {
sb.append('0');
}
sb.append(x);
} | [
"private",
"void",
"a2",
"(",
"StringBuilder",
"sb",
",",
"int",
"x",
")",
"{",
"if",
"(",
"x",
"<",
"10",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"x",
")",
";",
"}"
] | Append a two digit number. | [
"Append",
"a",
"two",
"digit",
"number",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/XMLFormatter.java#L50-L55 |
34,530 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/XMLFormatter.java | XMLFormatter.appendISO8601 | private void appendISO8601(StringBuilder sb, long millis) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(millis);
sb.append(cal.get(Calendar.YEAR));
sb.append('-');
a2(sb, cal.get(Calendar.MONTH) + 1);
sb.append('-');
a2(sb, cal.get(Calendar.DAY_OF_MONTH));
sb.append('T');
a2(sb, cal.get(Calendar.HOUR_OF_DAY));
sb.append(':');
a2(sb, cal.get(Calendar.MINUTE));
sb.append(':');
a2(sb, cal.get(Calendar.SECOND));
} | java | private void appendISO8601(StringBuilder sb, long millis) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(millis);
sb.append(cal.get(Calendar.YEAR));
sb.append('-');
a2(sb, cal.get(Calendar.MONTH) + 1);
sb.append('-');
a2(sb, cal.get(Calendar.DAY_OF_MONTH));
sb.append('T');
a2(sb, cal.get(Calendar.HOUR_OF_DAY));
sb.append(':');
a2(sb, cal.get(Calendar.MINUTE));
sb.append(':');
a2(sb, cal.get(Calendar.SECOND));
} | [
"private",
"void",
"appendISO8601",
"(",
"StringBuilder",
"sb",
",",
"long",
"millis",
")",
"{",
"GregorianCalendar",
"cal",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"cal",
".",
"setTimeInMillis",
"(",
"millis",
")",
";",
"sb",
".",
"append",
"(",
"... | Append the time and date in ISO 8601 format | [
"Append",
"the",
"time",
"and",
"date",
"in",
"ISO",
"8601",
"format"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/XMLFormatter.java#L58-L72 |
34,531 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/XMLFormatter.java | XMLFormatter.getHead | public String getHead(Handler h) {
StringBuilder sb = new StringBuilder();
String encoding;
sb.append("<?xml version=\"1.0\"");
if (h != null) {
encoding = h.getEncoding();
} else {
encoding = null;
}
if (encoding == null) {
// Figure out the default encoding.
encoding = java.nio.charset.Charset.defaultCharset().name();
}
// Try to map the encoding name to a canonical name.
try {
Charset cs = Charset.forName(encoding);
encoding = cs.name();
} catch (Exception ex) {
// We hit problems finding a canonical name.
// Just use the raw encoding name.
}
sb.append(" encoding=\"");
sb.append(encoding);
sb.append("\"");
sb.append(" standalone=\"no\"?>\n");
sb.append("<!DOCTYPE log SYSTEM \"logger.dtd\">\n");
sb.append("<log>\n");
return sb.toString();
} | java | public String getHead(Handler h) {
StringBuilder sb = new StringBuilder();
String encoding;
sb.append("<?xml version=\"1.0\"");
if (h != null) {
encoding = h.getEncoding();
} else {
encoding = null;
}
if (encoding == null) {
// Figure out the default encoding.
encoding = java.nio.charset.Charset.defaultCharset().name();
}
// Try to map the encoding name to a canonical name.
try {
Charset cs = Charset.forName(encoding);
encoding = cs.name();
} catch (Exception ex) {
// We hit problems finding a canonical name.
// Just use the raw encoding name.
}
sb.append(" encoding=\"");
sb.append(encoding);
sb.append("\"");
sb.append(" standalone=\"no\"?>\n");
sb.append("<!DOCTYPE log SYSTEM \"logger.dtd\">\n");
sb.append("<log>\n");
return sb.toString();
} | [
"public",
"String",
"getHead",
"(",
"Handler",
"h",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"encoding",
";",
"sb",
".",
"append",
"(",
"\"<?xml version=\\\"1.0\\\"\"",
")",
";",
"if",
"(",
"h",
"!=",
"null",
... | Return the header string for a set of XML formatted records.
@param h The target handler (can be null)
@return a valid XML string | [
"Return",
"the",
"header",
"string",
"for",
"a",
"set",
"of",
"XML",
"formatted",
"records",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/XMLFormatter.java#L230-L261 |
34,532 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUNotifier.java | ICUNotifier.addListener | public void addListener(EventListener l) {
if (l == null) {
throw new NullPointerException();
}
if (acceptsListener(l)) {
synchronized (notifyLock) {
if (listeners == null) {
listeners = new ArrayList<EventListener>();
} else {
// identity equality check
for (EventListener ll : listeners) {
if (ll == l) {
return;
}
}
}
listeners.add(l);
}
} else {
throw new IllegalStateException("Listener invalid for this notifier.");
}
} | java | public void addListener(EventListener l) {
if (l == null) {
throw new NullPointerException();
}
if (acceptsListener(l)) {
synchronized (notifyLock) {
if (listeners == null) {
listeners = new ArrayList<EventListener>();
} else {
// identity equality check
for (EventListener ll : listeners) {
if (ll == l) {
return;
}
}
}
listeners.add(l);
}
} else {
throw new IllegalStateException("Listener invalid for this notifier.");
}
} | [
"public",
"void",
"addListener",
"(",
"EventListener",
"l",
")",
"{",
"if",
"(",
"l",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"acceptsListener",
"(",
"l",
")",
")",
"{",
"synchronized",
"(",
"notif... | Add a listener to be notified when notifyChanged is called.
The listener must not be null. AcceptsListener must return
true for the listener. Attempts to concurrently
register the identical listener more than once will be
silently ignored. | [
"Add",
"a",
"listener",
"to",
"be",
"notified",
"when",
"notifyChanged",
"is",
"called",
".",
"The",
"listener",
"must",
"not",
"be",
"null",
".",
"AcceptsListener",
"must",
"return",
"true",
"for",
"the",
"listener",
".",
"Attempts",
"to",
"concurrently",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUNotifier.java#L47-L70 |
34,533 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUNotifier.java | ICUNotifier.removeListener | public void removeListener(EventListener l) {
if (l == null) {
throw new NullPointerException();
}
synchronized (notifyLock) {
if (listeners != null) {
// identity equality check
Iterator<EventListener> iter = listeners.iterator();
while (iter.hasNext()) {
if (iter.next() == l) {
iter.remove();
if (listeners.size() == 0) {
listeners = null;
}
return;
}
}
}
}
} | java | public void removeListener(EventListener l) {
if (l == null) {
throw new NullPointerException();
}
synchronized (notifyLock) {
if (listeners != null) {
// identity equality check
Iterator<EventListener> iter = listeners.iterator();
while (iter.hasNext()) {
if (iter.next() == l) {
iter.remove();
if (listeners.size() == 0) {
listeners = null;
}
return;
}
}
}
}
} | [
"public",
"void",
"removeListener",
"(",
"EventListener",
"l",
")",
"{",
"if",
"(",
"l",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"synchronized",
"(",
"notifyLock",
")",
"{",
"if",
"(",
"listeners",
"!=",
"null"... | Stop notifying this listener. The listener must
not be null. Attemps to remove a listener that is
not registered will be silently ignored. | [
"Stop",
"notifying",
"this",
"listener",
".",
"The",
"listener",
"must",
"not",
"be",
"null",
".",
"Attemps",
"to",
"remove",
"a",
"listener",
"that",
"is",
"not",
"registered",
"will",
"be",
"silently",
"ignored",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUNotifier.java#L77-L96 |
34,534 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUNotifier.java | ICUNotifier.notifyChanged | public void notifyChanged() {
if (listeners != null) {
synchronized (notifyLock) {
if (listeners != null) {
if (notifyThread == null) {
notifyThread = new NotifyThread(this);
notifyThread.setDaemon(true);
notifyThread.start();
}
notifyThread.queue(listeners.toArray(new EventListener[listeners.size()]));
}
}
}
} | java | public void notifyChanged() {
if (listeners != null) {
synchronized (notifyLock) {
if (listeners != null) {
if (notifyThread == null) {
notifyThread = new NotifyThread(this);
notifyThread.setDaemon(true);
notifyThread.start();
}
notifyThread.queue(listeners.toArray(new EventListener[listeners.size()]));
}
}
}
} | [
"public",
"void",
"notifyChanged",
"(",
")",
"{",
"if",
"(",
"listeners",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"notifyLock",
")",
"{",
"if",
"(",
"listeners",
"!=",
"null",
")",
"{",
"if",
"(",
"notifyThread",
"==",
"null",
")",
"{",
"notifyThr... | Queue a notification on the notification thread for the current
listeners. When the thread unqueues the notification, notifyListener
is called on each listener from the notification thread. | [
"Queue",
"a",
"notification",
"on",
"the",
"notification",
"thread",
"for",
"the",
"current",
"listeners",
".",
"When",
"the",
"thread",
"unqueues",
"the",
"notification",
"notifyListener",
"is",
"called",
"on",
"each",
"listener",
"from",
"the",
"notification",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUNotifier.java#L103-L116 |
34,535 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.writeObject | private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException {
// we just write the textual description to the stream, so we
// have an implementation-independent streaming format
out.writeUTF(this.toString());
out.writeObject(this.locale);
out.writeInt(this.roundingMode);
} | java | private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException {
// we just write the textual description to the stream, so we
// have an implementation-independent streaming format
out.writeUTF(this.toString());
out.writeObject(this.locale);
out.writeInt(this.roundingMode);
} | [
"private",
"void",
"writeObject",
"(",
"java",
".",
"io",
".",
"ObjectOutputStream",
"out",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"// we just write the textual description to the stream, so we",
"// have an implementation-independent streaming format",
"o... | Writes this object to a stream.
@param out The stream to write to. | [
"Writes",
"this",
"object",
"to",
"a",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L965-L972 |
34,536 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.readObject | private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException {
// read the description in from the stream
String description = in.readUTF();
ULocale loc;
try {
loc = (ULocale) in.readObject();
} catch (Exception e) {
loc = ULocale.getDefault(Category.FORMAT);
}
try {
roundingMode = in.readInt();
} catch (Exception ignored) {
}
// build a brand-new RuleBasedNumberFormat from the description,
// then steal its substructure. This object's substructure and
// the temporary RuleBasedNumberFormat drop on the floor and
// get swept up by the garbage collector
RuleBasedNumberFormat temp = new RuleBasedNumberFormat(description, loc);
ruleSets = temp.ruleSets;
ruleSetsMap = temp.ruleSetsMap;
defaultRuleSet = temp.defaultRuleSet;
publicRuleSetNames = temp.publicRuleSetNames;
decimalFormatSymbols = temp.decimalFormatSymbols;
decimalFormat = temp.decimalFormat;
locale = temp.locale;
defaultInfinityRule = temp.defaultInfinityRule;
defaultNaNRule = temp.defaultNaNRule;
} | java | private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException {
// read the description in from the stream
String description = in.readUTF();
ULocale loc;
try {
loc = (ULocale) in.readObject();
} catch (Exception e) {
loc = ULocale.getDefault(Category.FORMAT);
}
try {
roundingMode = in.readInt();
} catch (Exception ignored) {
}
// build a brand-new RuleBasedNumberFormat from the description,
// then steal its substructure. This object's substructure and
// the temporary RuleBasedNumberFormat drop on the floor and
// get swept up by the garbage collector
RuleBasedNumberFormat temp = new RuleBasedNumberFormat(description, loc);
ruleSets = temp.ruleSets;
ruleSetsMap = temp.ruleSetsMap;
defaultRuleSet = temp.defaultRuleSet;
publicRuleSetNames = temp.publicRuleSetNames;
decimalFormatSymbols = temp.decimalFormatSymbols;
decimalFormat = temp.decimalFormat;
locale = temp.locale;
defaultInfinityRule = temp.defaultInfinityRule;
defaultNaNRule = temp.defaultNaNRule;
} | [
"private",
"void",
"readObject",
"(",
"java",
".",
"io",
".",
"ObjectInputStream",
"in",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"// read the description in from the stream",
"String",
"description",
"=",
"in",
".",
"readUTF",
"(",
")",
";",
... | Reads this object in from a stream.
@param in The stream to read from. | [
"Reads",
"this",
"object",
"in",
"from",
"a",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L978-L1009 |
34,537 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.getRuleSetDisplayNameLocales | public ULocale[] getRuleSetDisplayNameLocales() {
if (ruleSetDisplayNames != null) {
Set<String> s = ruleSetDisplayNames.keySet();
String[] locales = s.toArray(new String[s.size()]);
Arrays.sort(locales, String.CASE_INSENSITIVE_ORDER);
ULocale[] result = new ULocale[locales.length];
for (int i = 0; i < locales.length; ++i) {
result[i] = new ULocale(locales[i]);
}
return result;
}
return null;
} | java | public ULocale[] getRuleSetDisplayNameLocales() {
if (ruleSetDisplayNames != null) {
Set<String> s = ruleSetDisplayNames.keySet();
String[] locales = s.toArray(new String[s.size()]);
Arrays.sort(locales, String.CASE_INSENSITIVE_ORDER);
ULocale[] result = new ULocale[locales.length];
for (int i = 0; i < locales.length; ++i) {
result[i] = new ULocale(locales[i]);
}
return result;
}
return null;
} | [
"public",
"ULocale",
"[",
"]",
"getRuleSetDisplayNameLocales",
"(",
")",
"{",
"if",
"(",
"ruleSetDisplayNames",
"!=",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"s",
"=",
"ruleSetDisplayNames",
".",
"keySet",
"(",
")",
";",
"String",
"[",
"]",
"locales",... | Return a list of locales for which there are locale-specific display names
for the rule sets in this formatter. If there are no localized display names, return null.
@return an array of the ULocales for which there is rule set display name information | [
"Return",
"a",
"list",
"of",
"locales",
"for",
"which",
"there",
"are",
"locale",
"-",
"specific",
"display",
"names",
"for",
"the",
"rule",
"sets",
"in",
"this",
"formatter",
".",
"If",
"there",
"are",
"no",
"localized",
"display",
"names",
"return",
"nul... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1029-L1041 |
34,538 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.getRuleSetDisplayName | public String getRuleSetDisplayName(String ruleSetName, ULocale loc) {
String[] rsnames = publicRuleSetNames;
for (int ix = 0; ix < rsnames.length; ++ix) {
if (rsnames[ix].equals(ruleSetName)) {
String[] names = getNameListForLocale(loc);
if (names != null) {
return names[ix];
}
return rsnames[ix].substring(1);
}
}
throw new IllegalArgumentException("unrecognized rule set name: " + ruleSetName);
} | java | public String getRuleSetDisplayName(String ruleSetName, ULocale loc) {
String[] rsnames = publicRuleSetNames;
for (int ix = 0; ix < rsnames.length; ++ix) {
if (rsnames[ix].equals(ruleSetName)) {
String[] names = getNameListForLocale(loc);
if (names != null) {
return names[ix];
}
return rsnames[ix].substring(1);
}
}
throw new IllegalArgumentException("unrecognized rule set name: " + ruleSetName);
} | [
"public",
"String",
"getRuleSetDisplayName",
"(",
"String",
"ruleSetName",
",",
"ULocale",
"loc",
")",
"{",
"String",
"[",
"]",
"rsnames",
"=",
"publicRuleSetNames",
";",
"for",
"(",
"int",
"ix",
"=",
"0",
";",
"ix",
"<",
"rsnames",
".",
"length",
";",
"... | Return the rule set display name for the provided rule set and locale.
The locale is matched against the locales for which there is display name data, using
normal fallback rules. If no locale matches, the default display name is returned.
@return the display name for the rule set
@see #getRuleSetDisplayNames
@throws IllegalArgumentException if ruleSetName is not a valid rule set name for this format | [
"Return",
"the",
"rule",
"set",
"display",
"name",
"for",
"the",
"provided",
"rule",
"set",
"and",
"locale",
".",
"The",
"locale",
"is",
"matched",
"against",
"the",
"locales",
"for",
"which",
"there",
"is",
"display",
"name",
"data",
"using",
"normal",
"f... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1098-L1110 |
34,539 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.parse | @Override
public Number parse(String text, ParsePosition parsePosition) {
// parsePosition tells us where to start parsing. We copy the
// text in the string from here to the end inro a new string,
// and create a new ParsePosition and result variable to use
// for the duration of the parse operation
String workingText = text.substring(parsePosition.getIndex());
ParsePosition workingPos = new ParsePosition(0);
Number tempResult = null;
// keep track of the largest number of characters consumed in
// the various trials, and the result that corresponds to it
Number result = NFRule.ZERO;
ParsePosition highWaterMark = new ParsePosition(workingPos.getIndex());
// iterate over the public rule sets (beginning with the default one)
// and try parsing the text with each of them. Keep track of which
// one consumes the most characters: that's the one that determines
// the result we return
for (int i = ruleSets.length - 1; i >= 0; i--) {
// skip private or unparseable rule sets
if (!ruleSets[i].isPublic() || !ruleSets[i].isParseable()) {
continue;
}
// try parsing the string with the rule set. If it gets past the
// high-water mark, update the high-water mark and the result
tempResult = ruleSets[i].parse(workingText, workingPos, Double.MAX_VALUE);
if (workingPos.getIndex() > highWaterMark.getIndex()) {
result = tempResult;
highWaterMark.setIndex(workingPos.getIndex());
}
// commented out because this API on ParsePosition doesn't exist in 1.1.x
// if (workingPos.getErrorIndex() > highWaterMark.getErrorIndex()) {
// highWaterMark.setErrorIndex(workingPos.getErrorIndex());
// }
// if we manage to use up all the characters in the string,
// we don't have to try any more rule sets
if (highWaterMark.getIndex() == workingText.length()) {
break;
}
// otherwise, reset our internal parse position to the
// beginning and try again with the next rule set
workingPos.setIndex(0);
}
// add the high water mark to our original parse position and
// return the result
parsePosition.setIndex(parsePosition.getIndex() + highWaterMark.getIndex());
// commented out because this API on ParsePosition doesn't exist in 1.1.x
// if (highWaterMark.getIndex() == 0) {
// parsePosition.setErrorIndex(parsePosition.getIndex() + highWaterMark.getErrorIndex());
// }
return result;
} | java | @Override
public Number parse(String text, ParsePosition parsePosition) {
// parsePosition tells us where to start parsing. We copy the
// text in the string from here to the end inro a new string,
// and create a new ParsePosition and result variable to use
// for the duration of the parse operation
String workingText = text.substring(parsePosition.getIndex());
ParsePosition workingPos = new ParsePosition(0);
Number tempResult = null;
// keep track of the largest number of characters consumed in
// the various trials, and the result that corresponds to it
Number result = NFRule.ZERO;
ParsePosition highWaterMark = new ParsePosition(workingPos.getIndex());
// iterate over the public rule sets (beginning with the default one)
// and try parsing the text with each of them. Keep track of which
// one consumes the most characters: that's the one that determines
// the result we return
for (int i = ruleSets.length - 1; i >= 0; i--) {
// skip private or unparseable rule sets
if (!ruleSets[i].isPublic() || !ruleSets[i].isParseable()) {
continue;
}
// try parsing the string with the rule set. If it gets past the
// high-water mark, update the high-water mark and the result
tempResult = ruleSets[i].parse(workingText, workingPos, Double.MAX_VALUE);
if (workingPos.getIndex() > highWaterMark.getIndex()) {
result = tempResult;
highWaterMark.setIndex(workingPos.getIndex());
}
// commented out because this API on ParsePosition doesn't exist in 1.1.x
// if (workingPos.getErrorIndex() > highWaterMark.getErrorIndex()) {
// highWaterMark.setErrorIndex(workingPos.getErrorIndex());
// }
// if we manage to use up all the characters in the string,
// we don't have to try any more rule sets
if (highWaterMark.getIndex() == workingText.length()) {
break;
}
// otherwise, reset our internal parse position to the
// beginning and try again with the next rule set
workingPos.setIndex(0);
}
// add the high water mark to our original parse position and
// return the result
parsePosition.setIndex(parsePosition.getIndex() + highWaterMark.getIndex());
// commented out because this API on ParsePosition doesn't exist in 1.1.x
// if (highWaterMark.getIndex() == 0) {
// parsePosition.setErrorIndex(parsePosition.getIndex() + highWaterMark.getErrorIndex());
// }
return result;
} | [
"@",
"Override",
"public",
"Number",
"parse",
"(",
"String",
"text",
",",
"ParsePosition",
"parsePosition",
")",
"{",
"// parsePosition tells us where to start parsing. We copy the",
"// text in the string from here to the end inro a new string,",
"// and create a new ParsePosition an... | Parses the specified string, beginning at the specified position, according
to this formatter's rules. This will match the string against all of the
formatter's public rule sets and return the value corresponding to the longest
parseable substring. This function's behavior is affected by the lenient
parse mode.
@param text The string to parse
@param parsePosition On entry, contains the position of the first character
in "text" to examine. On exit, has been updated to contain the position
of the first character in "text" that wasn't consumed by the parse.
@return The number that corresponds to the parsed text. This will be an
instance of either Long or Double, depending on whether the result has a
fractional part.
@see #setLenientParseMode | [
"Parses",
"the",
"specified",
"string",
"beginning",
"at",
"the",
"specified",
"position",
"according",
"to",
"this",
"formatter",
"s",
"rules",
".",
"This",
"will",
"match",
"the",
"string",
"against",
"all",
"of",
"the",
"formatter",
"s",
"public",
"rule",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1269-L1326 |
34,540 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.getLenientScannerProvider | public RbnfLenientScannerProvider getLenientScannerProvider() {
// there's a potential race condition if two threads try to set/get the scanner at
// the same time, but you get what you get, and you shouldn't be using this from
// multiple threads anyway.
if (scannerProvider == null && lenientParse && !lookedForScanner) {
try {
lookedForScanner = true;
Class<?> cls = Class.forName("android.icu.impl.text.RbnfScannerProviderImpl");
RbnfLenientScannerProvider provider = (RbnfLenientScannerProvider)cls.newInstance();
setLenientScannerProvider(provider);
}
catch (Exception e) {
// any failure, we just ignore and return null
}
}
return scannerProvider;
} | java | public RbnfLenientScannerProvider getLenientScannerProvider() {
// there's a potential race condition if two threads try to set/get the scanner at
// the same time, but you get what you get, and you shouldn't be using this from
// multiple threads anyway.
if (scannerProvider == null && lenientParse && !lookedForScanner) {
try {
lookedForScanner = true;
Class<?> cls = Class.forName("android.icu.impl.text.RbnfScannerProviderImpl");
RbnfLenientScannerProvider provider = (RbnfLenientScannerProvider)cls.newInstance();
setLenientScannerProvider(provider);
}
catch (Exception e) {
// any failure, we just ignore and return null
}
}
return scannerProvider;
} | [
"public",
"RbnfLenientScannerProvider",
"getLenientScannerProvider",
"(",
")",
"{",
"// there's a potential race condition if two threads try to set/get the scanner at",
"// the same time, but you get what you get, and you shouldn't be using this from",
"// multiple threads anyway.",
"if",
"(",
... | Returns the lenient scanner provider. If none was set, and lenient parse is
enabled, this will attempt to instantiate a default scanner, setting it if
it was successful. Otherwise this returns false.
@see #setLenientScannerProvider | [
"Returns",
"the",
"lenient",
"scanner",
"provider",
".",
"If",
"none",
"was",
"set",
"and",
"lenient",
"parse",
"is",
"enabled",
"this",
"will",
"attempt",
"to",
"instantiate",
"a",
"default",
"scanner",
"setting",
"it",
"if",
"it",
"was",
"successful",
".",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1374-L1391 |
34,541 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.setDefaultRuleSet | public void setDefaultRuleSet(String ruleSetName) {
if (ruleSetName == null) {
if (publicRuleSetNames.length > 0) {
defaultRuleSet = findRuleSet(publicRuleSetNames[0]);
} else {
defaultRuleSet = null;
int n = ruleSets.length;
while (--n >= 0) {
String currentName = ruleSets[n].getName();
if (currentName.equals("%spellout-numbering") ||
currentName.equals("%digits-ordinal") ||
currentName.equals("%duration")) {
defaultRuleSet = ruleSets[n];
return;
}
}
n = ruleSets.length;
while (--n >= 0) {
if (ruleSets[n].isPublic()) {
defaultRuleSet = ruleSets[n];
break;
}
}
}
} else if (ruleSetName.startsWith("%%")) {
throw new IllegalArgumentException("cannot use private rule set: " + ruleSetName);
} else {
defaultRuleSet = findRuleSet(ruleSetName);
}
} | java | public void setDefaultRuleSet(String ruleSetName) {
if (ruleSetName == null) {
if (publicRuleSetNames.length > 0) {
defaultRuleSet = findRuleSet(publicRuleSetNames[0]);
} else {
defaultRuleSet = null;
int n = ruleSets.length;
while (--n >= 0) {
String currentName = ruleSets[n].getName();
if (currentName.equals("%spellout-numbering") ||
currentName.equals("%digits-ordinal") ||
currentName.equals("%duration")) {
defaultRuleSet = ruleSets[n];
return;
}
}
n = ruleSets.length;
while (--n >= 0) {
if (ruleSets[n].isPublic()) {
defaultRuleSet = ruleSets[n];
break;
}
}
}
} else if (ruleSetName.startsWith("%%")) {
throw new IllegalArgumentException("cannot use private rule set: " + ruleSetName);
} else {
defaultRuleSet = findRuleSet(ruleSetName);
}
} | [
"public",
"void",
"setDefaultRuleSet",
"(",
"String",
"ruleSetName",
")",
"{",
"if",
"(",
"ruleSetName",
"==",
"null",
")",
"{",
"if",
"(",
"publicRuleSetNames",
".",
"length",
">",
"0",
")",
"{",
"defaultRuleSet",
"=",
"findRuleSet",
"(",
"publicRuleSetNames"... | Override the default rule set to use. If ruleSetName is null, reset
to the initial default rule set.
@param ruleSetName the name of the rule set, or null to reset the initial default.
@throws IllegalArgumentException if ruleSetName is not the name of a public ruleset. | [
"Override",
"the",
"default",
"rule",
"set",
"to",
"use",
".",
"If",
"ruleSetName",
"is",
"null",
"reset",
"to",
"the",
"initial",
"default",
"rule",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1399-L1430 |
34,542 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.setDecimalFormatSymbols | public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
if (newSymbols != null) {
decimalFormatSymbols = (DecimalFormatSymbols) newSymbols.clone();
if (decimalFormat != null) {
decimalFormat.setDecimalFormatSymbols(decimalFormatSymbols);
}
if (defaultInfinityRule != null) {
defaultInfinityRule = null;
getDefaultInfinityRule(); // Reset with the new DecimalFormatSymbols
}
if (defaultNaNRule != null) {
defaultNaNRule = null;
getDefaultNaNRule(); // Reset with the new DecimalFormatSymbols
}
// Apply the new decimalFormatSymbols by reparsing the rulesets
for (NFRuleSet ruleSet : ruleSets) {
ruleSet.setDecimalFormatSymbols(decimalFormatSymbols);
}
}
} | java | public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
if (newSymbols != null) {
decimalFormatSymbols = (DecimalFormatSymbols) newSymbols.clone();
if (decimalFormat != null) {
decimalFormat.setDecimalFormatSymbols(decimalFormatSymbols);
}
if (defaultInfinityRule != null) {
defaultInfinityRule = null;
getDefaultInfinityRule(); // Reset with the new DecimalFormatSymbols
}
if (defaultNaNRule != null) {
defaultNaNRule = null;
getDefaultNaNRule(); // Reset with the new DecimalFormatSymbols
}
// Apply the new decimalFormatSymbols by reparsing the rulesets
for (NFRuleSet ruleSet : ruleSets) {
ruleSet.setDecimalFormatSymbols(decimalFormatSymbols);
}
}
} | [
"public",
"void",
"setDecimalFormatSymbols",
"(",
"DecimalFormatSymbols",
"newSymbols",
")",
"{",
"if",
"(",
"newSymbols",
"!=",
"null",
")",
"{",
"decimalFormatSymbols",
"=",
"(",
"DecimalFormatSymbols",
")",
"newSymbols",
".",
"clone",
"(",
")",
";",
"if",
"("... | Sets the decimal format symbols used by this formatter. The formatter uses a copy of the
provided symbols.
@param newSymbols desired DecimalFormatSymbols
@see DecimalFormatSymbols | [
"Sets",
"the",
"decimal",
"format",
"symbols",
"used",
"by",
"this",
"formatter",
".",
"The",
"formatter",
"uses",
"a",
"copy",
"of",
"the",
"provided",
"symbols",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1450-L1470 |
34,543 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.setContext | @Override
public void setContext(DisplayContext context) {
super.setContext(context);
if (!capitalizationInfoIsSet &&
(context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU || context==DisplayContext.CAPITALIZATION_FOR_STANDALONE)) {
initCapitalizationContextInfo(locale);
capitalizationInfoIsSet = true;
}
if (capitalizationBrkIter == null && (context==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
(context==DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) )) {
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
}
} | java | @Override
public void setContext(DisplayContext context) {
super.setContext(context);
if (!capitalizationInfoIsSet &&
(context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU || context==DisplayContext.CAPITALIZATION_FOR_STANDALONE)) {
initCapitalizationContextInfo(locale);
capitalizationInfoIsSet = true;
}
if (capitalizationBrkIter == null && (context==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
(context==DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) )) {
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
}
} | [
"@",
"Override",
"public",
"void",
"setContext",
"(",
"DisplayContext",
"context",
")",
"{",
"super",
".",
"setContext",
"(",
"context",
")",
";",
"if",
"(",
"!",
"capitalizationInfoIsSet",
"&&",
"(",
"context",
"==",
"DisplayContext",
".",
"CAPITALIZATION_FOR_U... | lazily initialize relevant items | [
"lazily",
"initialize",
"relevant",
"items"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1481-L1494 |
34,544 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.getLenientScanner | RbnfLenientScanner getLenientScanner() {
if (lenientParse) {
RbnfLenientScannerProvider provider = getLenientScannerProvider();
if (provider != null) {
return provider.get(locale, lenientParseRules);
}
}
return null;
} | java | RbnfLenientScanner getLenientScanner() {
if (lenientParse) {
RbnfLenientScannerProvider provider = getLenientScannerProvider();
if (provider != null) {
return provider.get(locale, lenientParseRules);
}
}
return null;
} | [
"RbnfLenientScanner",
"getLenientScanner",
"(",
")",
"{",
"if",
"(",
"lenientParse",
")",
"{",
"RbnfLenientScannerProvider",
"provider",
"=",
"getLenientScannerProvider",
"(",
")",
";",
"if",
"(",
"provider",
"!=",
"null",
")",
"{",
"return",
"provider",
".",
"g... | Returns the scanner to use for lenient parsing. The scanner is
provided by the provider.
@return The collator to use for lenient parsing, or null if lenient parsing
is turned off. | [
"Returns",
"the",
"scanner",
"to",
"use",
"for",
"lenient",
"parsing",
".",
"The",
"scanner",
"is",
"provided",
"by",
"the",
"provider",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1549-L1557 |
34,545 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.initLocalizations | private void initLocalizations(String[][] localizations) {
if (localizations != null) {
publicRuleSetNames = localizations[0].clone();
Map<String, String[]> m = new HashMap<String, String[]>();
for (int i = 1; i < localizations.length; ++i) {
String[] data = localizations[i];
String loc = data[0];
String[] names = new String[data.length-1];
if (names.length != publicRuleSetNames.length) {
throw new IllegalArgumentException("public name length: " + publicRuleSetNames.length +
" != localized names[" + i + "] length: " + names.length);
}
System.arraycopy(data, 1, names, 0, names.length);
m.put(loc, names);
}
if (!m.isEmpty()) {
ruleSetDisplayNames = m;
}
}
} | java | private void initLocalizations(String[][] localizations) {
if (localizations != null) {
publicRuleSetNames = localizations[0].clone();
Map<String, String[]> m = new HashMap<String, String[]>();
for (int i = 1; i < localizations.length; ++i) {
String[] data = localizations[i];
String loc = data[0];
String[] names = new String[data.length-1];
if (names.length != publicRuleSetNames.length) {
throw new IllegalArgumentException("public name length: " + publicRuleSetNames.length +
" != localized names[" + i + "] length: " + names.length);
}
System.arraycopy(data, 1, names, 0, names.length);
m.put(loc, names);
}
if (!m.isEmpty()) {
ruleSetDisplayNames = m;
}
}
} | [
"private",
"void",
"initLocalizations",
"(",
"String",
"[",
"]",
"[",
"]",
"localizations",
")",
"{",
"if",
"(",
"localizations",
"!=",
"null",
")",
"{",
"publicRuleSetNames",
"=",
"localizations",
"[",
"0",
"]",
".",
"clone",
"(",
")",
";",
"Map",
"<",
... | Take the localizations array and create a Map from the locale strings to
the localization arrays. | [
"Take",
"the",
"localizations",
"array",
"and",
"create",
"a",
"Map",
"from",
"the",
"locale",
"strings",
"to",
"the",
"localization",
"arrays",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1805-L1826 |
34,546 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.initCapitalizationContextInfo | private void initCapitalizationContextInfo(ULocale theLocale) {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, theLocale);
try {
ICUResourceBundle rdb = rb.getWithFallback("contextTransforms/number-spellout");
int[] intVector = rdb.getIntVector();
if (intVector.length >= 2) {
capitalizationForListOrMenu = (intVector[0] != 0);
capitalizationForStandAlone = (intVector[1] != 0);
}
} catch (MissingResourceException e) {
// use default
}
} | java | private void initCapitalizationContextInfo(ULocale theLocale) {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, theLocale);
try {
ICUResourceBundle rdb = rb.getWithFallback("contextTransforms/number-spellout");
int[] intVector = rdb.getIntVector();
if (intVector.length >= 2) {
capitalizationForListOrMenu = (intVector[0] != 0);
capitalizationForStandAlone = (intVector[1] != 0);
}
} catch (MissingResourceException e) {
// use default
}
} | [
"private",
"void",
"initCapitalizationContextInfo",
"(",
"ULocale",
"theLocale",
")",
"{",
"ICUResourceBundle",
"rb",
"=",
"(",
"ICUResourceBundle",
")",
"UResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_BASE_NAME",
",",
"theLocale",
")",
";",
"... | Set capitalizationForListOrMenu, capitalizationForStandAlone | [
"Set",
"capitalizationForListOrMenu",
"capitalizationForStandAlone"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1831-L1843 |
34,547 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.postProcess | private void postProcess(StringBuilder result, NFRuleSet ruleSet) {
if (postProcessRules != null) {
if (postProcessor == null) {
int ix = postProcessRules.indexOf(";");
if (ix == -1) {
ix = postProcessRules.length();
}
String ppClassName = postProcessRules.substring(0, ix).trim();
try {
Class<?> cls = Class.forName(ppClassName);
postProcessor = (RBNFPostProcessor)cls.newInstance();
postProcessor.init(this, postProcessRules);
}
catch (Exception e) {
// if debug, print it out
if (DEBUG) System.out.println("could not locate " + ppClassName + ", error " +
e.getClass().getName() + ", " + e.getMessage());
postProcessor = null;
postProcessRules = null; // don't try again
return;
}
}
postProcessor.process(result, ruleSet);
}
} | java | private void postProcess(StringBuilder result, NFRuleSet ruleSet) {
if (postProcessRules != null) {
if (postProcessor == null) {
int ix = postProcessRules.indexOf(";");
if (ix == -1) {
ix = postProcessRules.length();
}
String ppClassName = postProcessRules.substring(0, ix).trim();
try {
Class<?> cls = Class.forName(ppClassName);
postProcessor = (RBNFPostProcessor)cls.newInstance();
postProcessor.init(this, postProcessRules);
}
catch (Exception e) {
// if debug, print it out
if (DEBUG) System.out.println("could not locate " + ppClassName + ", error " +
e.getClass().getName() + ", " + e.getMessage());
postProcessor = null;
postProcessRules = null; // don't try again
return;
}
}
postProcessor.process(result, ruleSet);
}
} | [
"private",
"void",
"postProcess",
"(",
"StringBuilder",
"result",
",",
"NFRuleSet",
"ruleSet",
")",
"{",
"if",
"(",
"postProcessRules",
"!=",
"null",
")",
"{",
"if",
"(",
"postProcessor",
"==",
"null",
")",
"{",
"int",
"ix",
"=",
"postProcessRules",
".",
"... | Post-process the rules if we have a post-processor. | [
"Post",
"-",
"process",
"the",
"rules",
"if",
"we",
"have",
"a",
"post",
"-",
"processor",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1960-L1985 |
34,548 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.adjustForContext | private String adjustForContext(String result) {
if (result != null && result.length() > 0 && UCharacter.isLowerCase(result.codePointAt(0))) {
DisplayContext capitalization = getContext(DisplayContext.Type.CAPITALIZATION);
if ( capitalization==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) ) {
if (capitalizationBrkIter == null) {
// should only happen when deserializing, etc.
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
}
return UCharacter.toTitleCase(locale, result, capitalizationBrkIter,
UCharacter.TITLECASE_NO_LOWERCASE | UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT);
}
}
return result;
} | java | private String adjustForContext(String result) {
if (result != null && result.length() > 0 && UCharacter.isLowerCase(result.codePointAt(0))) {
DisplayContext capitalization = getContext(DisplayContext.Type.CAPITALIZATION);
if ( capitalization==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) ) {
if (capitalizationBrkIter == null) {
// should only happen when deserializing, etc.
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
}
return UCharacter.toTitleCase(locale, result, capitalizationBrkIter,
UCharacter.TITLECASE_NO_LOWERCASE | UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT);
}
}
return result;
} | [
"private",
"String",
"adjustForContext",
"(",
"String",
"result",
")",
"{",
"if",
"(",
"result",
"!=",
"null",
"&&",
"result",
".",
"length",
"(",
")",
">",
"0",
"&&",
"UCharacter",
".",
"isLowerCase",
"(",
"result",
".",
"codePointAt",
"(",
"0",
")",
... | Adjust capitalization of formatted result for display context | [
"Adjust",
"capitalization",
"of",
"formatted",
"result",
"for",
"display",
"context"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1990-L2005 |
34,549 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java | RuleBasedNumberFormat.findRuleSet | NFRuleSet findRuleSet(String name) throws IllegalArgumentException {
NFRuleSet result = ruleSetsMap.get(name);
if (result == null) {
throw new IllegalArgumentException("No rule set named " + name);
}
return result;
} | java | NFRuleSet findRuleSet(String name) throws IllegalArgumentException {
NFRuleSet result = ruleSetsMap.get(name);
if (result == null) {
throw new IllegalArgumentException("No rule set named " + name);
}
return result;
} | [
"NFRuleSet",
"findRuleSet",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"NFRuleSet",
"result",
"=",
"ruleSetsMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExcept... | Returns the named rule set. Throws an IllegalArgumentException
if this formatter doesn't have a rule set with that name.
@param name The name of the desired rule set
@return The rule set with that name | [
"Returns",
"the",
"named",
"rule",
"set",
".",
"Throws",
"an",
"IllegalArgumentException",
"if",
"this",
"formatter",
"doesn",
"t",
"have",
"a",
"rule",
"set",
"with",
"that",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L2013-L2019 |
34,550 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java | LinkedBlockingQueue.dequeue | private E dequeue() {
// assert takeLock.isHeldByCurrentThread();
// assert head.item == null;
Node<E> h = head;
Node<E> first = h.next;
h.next = sentinel(); // help GC
head = first;
E x = first.item;
first.item = null;
return x;
} | java | private E dequeue() {
// assert takeLock.isHeldByCurrentThread();
// assert head.item == null;
Node<E> h = head;
Node<E> first = h.next;
h.next = sentinel(); // help GC
head = first;
E x = first.item;
first.item = null;
return x;
} | [
"private",
"E",
"dequeue",
"(",
")",
"{",
"// assert takeLock.isHeldByCurrentThread();",
"// assert head.item == null;",
"Node",
"<",
"E",
">",
"h",
"=",
"head",
";",
"Node",
"<",
"E",
">",
"first",
"=",
"h",
".",
"next",
";",
"h",
".",
"next",
"=",
"senti... | Removes a node from head of queue.
@return the node | [
"Removes",
"a",
"node",
"from",
"head",
"of",
"queue",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java#L215-L225 |
34,551 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java | LinkedBlockingQueue.put | public void put(E e) throws InterruptedException {
if (e == null) throw new NullPointerException();
// Note: convention in all put/take/etc is to preset local var
// holding count negative to indicate failure unless set.
int c = -1;
Node<E> node = new Node<E>(e);
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
/*
* Note that count is used in wait guard even though it is
* not protected by lock. This works because count can
* only decrease at this point (all other puts are shut
* out by lock), and we (or some other waiting put) are
* signalled if it ever changes from capacity. Similarly
* for all other uses of count in other wait guards.
*/
while (count.get() == capacity) {
notFull.await();
}
enqueue(node);
c = count.getAndIncrement();
if (c + 1 < capacity)
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
} | java | public void put(E e) throws InterruptedException {
if (e == null) throw new NullPointerException();
// Note: convention in all put/take/etc is to preset local var
// holding count negative to indicate failure unless set.
int c = -1;
Node<E> node = new Node<E>(e);
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
/*
* Note that count is used in wait guard even though it is
* not protected by lock. This works because count can
* only decrease at this point (all other puts are shut
* out by lock), and we (or some other waiting put) are
* signalled if it ever changes from capacity. Similarly
* for all other uses of count in other wait guards.
*/
while (count.get() == capacity) {
notFull.await();
}
enqueue(node);
c = count.getAndIncrement();
if (c + 1 < capacity)
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
} | [
"public",
"void",
"put",
"(",
"E",
"e",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"// Note: convention in all put/take/etc is to preset local var",
"// holding count negative to ... | Inserts the specified element at the tail of this queue, waiting if
necessary for space to become available.
@throws InterruptedException {@inheritDoc}
@throws NullPointerException {@inheritDoc} | [
"Inserts",
"the",
"specified",
"element",
"at",
"the",
"tail",
"of",
"this",
"queue",
"waiting",
"if",
"necessary",
"for",
"space",
"to",
"become",
"available",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java#L337-L367 |
34,552 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java | LinkedBlockingQueue.offer | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
if (e == null) throw new NullPointerException();
long nanos = unit.toNanos(timeout);
int c = -1;
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
while (count.get() == capacity) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(new Node<E>(e));
c = count.getAndIncrement();
if (c + 1 < capacity)
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
return true;
} | java | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
if (e == null) throw new NullPointerException();
long nanos = unit.toNanos(timeout);
int c = -1;
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
while (count.get() == capacity) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(new Node<E>(e));
c = count.getAndIncrement();
if (c + 1 < capacity)
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
return true;
} | [
"public",
"boolean",
"offer",
"(",
"E",
"e",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"long",
"nanos",
"=",
"uni... | Inserts the specified element at the tail of this queue, waiting if
necessary up to the specified wait time for space to become available.
@return {@code true} if successful, or {@code false} if
the specified waiting time elapses before space is available
@throws InterruptedException {@inheritDoc}
@throws NullPointerException {@inheritDoc} | [
"Inserts",
"the",
"specified",
"element",
"at",
"the",
"tail",
"of",
"this",
"queue",
"waiting",
"if",
"necessary",
"up",
"to",
"the",
"specified",
"wait",
"time",
"for",
"space",
"to",
"become",
"available",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java#L378-L403 |
34,553 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java | LinkedBlockingQueue.unlink | void unlink(Node<E> p, Node<E> trail) {
// assert isFullyLocked();
// p.next is not changed, to allow iterators that are
// traversing p to maintain their weak-consistency guarantee.
p.item = null;
trail.next = p.next;
if (last == p)
last = trail;
if (count.getAndDecrement() == capacity)
notFull.signal();
} | java | void unlink(Node<E> p, Node<E> trail) {
// assert isFullyLocked();
// p.next is not changed, to allow iterators that are
// traversing p to maintain their weak-consistency guarantee.
p.item = null;
trail.next = p.next;
if (last == p)
last = trail;
if (count.getAndDecrement() == capacity)
notFull.signal();
} | [
"void",
"unlink",
"(",
"Node",
"<",
"E",
">",
"p",
",",
"Node",
"<",
"E",
">",
"trail",
")",
"{",
"// assert isFullyLocked();",
"// p.next is not changed, to allow iterators that are",
"// traversing p to maintain their weak-consistency guarantee.",
"p",
".",
"item",
"=",... | Unlinks interior Node p with predecessor trail. | [
"Unlinks",
"interior",
"Node",
"p",
"with",
"predecessor",
"trail",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java#L525-L535 |
34,554 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/Console.java | Console.format | public Console format(String format, Object... args) {
try (Formatter f = new Formatter(writer)) {
f.format(format, args);
f.flush();
return this;
}
} | java | public Console format(String format, Object... args) {
try (Formatter f = new Formatter(writer)) {
f.format(format, args);
f.flush();
return this;
}
} | [
"public",
"Console",
"format",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"(",
"Formatter",
"f",
"=",
"new",
"Formatter",
"(",
"writer",
")",
")",
"{",
"f",
".",
"format",
"(",
"format",
",",
"args",
")",
";",
"f",
".",... | Writes a formatted string to the console using
the specified format string and arguments.
@param format the format string (see {@link java.util.Formatter#format})
@param args
the list of arguments passed to the formatter. If there are
more arguments than required by {@code format},
additional arguments are ignored.
@return the console instance. | [
"Writes",
"a",
"formatted",
"string",
"to",
"the",
"console",
"using",
"the",
"specified",
"format",
"string",
"and",
"arguments",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/Console.java#L74-L80 |
34,555 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Mac.java | Mac.update | public final void update(byte input) throws IllegalStateException {
chooseFirstProvider();
if (initialized == false) {
throw new IllegalStateException("MAC not initialized");
}
spi.engineUpdate(input);
} | java | public final void update(byte input) throws IllegalStateException {
chooseFirstProvider();
if (initialized == false) {
throw new IllegalStateException("MAC not initialized");
}
spi.engineUpdate(input);
} | [
"public",
"final",
"void",
"update",
"(",
"byte",
"input",
")",
"throws",
"IllegalStateException",
"{",
"chooseFirstProvider",
"(",
")",
";",
"if",
"(",
"initialized",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"MAC not initialized\""... | Processes the given byte.
@param input the input byte to be processed.
@exception IllegalStateException if this <code>Mac</code> has not been
initialized. | [
"Processes",
"the",
"given",
"byte",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Mac.java#L520-L526 |
34,556 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Mac.java | Mac.doFinal | public final byte[] doFinal(byte[] input) throws IllegalStateException
{
chooseFirstProvider();
if (initialized == false) {
throw new IllegalStateException("MAC not initialized");
}
update(input);
return doFinal();
} | java | public final byte[] doFinal(byte[] input) throws IllegalStateException
{
chooseFirstProvider();
if (initialized == false) {
throw new IllegalStateException("MAC not initialized");
}
update(input);
return doFinal();
} | [
"public",
"final",
"byte",
"[",
"]",
"doFinal",
"(",
"byte",
"[",
"]",
"input",
")",
"throws",
"IllegalStateException",
"{",
"chooseFirstProvider",
"(",
")",
";",
"if",
"(",
"initialized",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalStateException",
"("... | Processes the given array of bytes and finishes the MAC operation.
<p>A call to this method resets this <code>Mac</code> object to the
state it was in when previously initialized via a call to
<code>init(Key)</code> or
<code>init(Key, AlgorithmParameterSpec)</code>.
That is, the object is reset and available to generate another MAC from
the same key, if desired, via new calls to <code>update</code> and
<code>doFinal</code>.
(In order to reuse this <code>Mac</code> object with a different key,
it must be reinitialized via a call to <code>init(Key)</code> or
<code>init(Key, AlgorithmParameterSpec)</code>.
@param input data in bytes
@return the MAC result.
@exception IllegalStateException if this <code>Mac</code> has not been
initialized. | [
"Processes",
"the",
"given",
"array",
"of",
"bytes",
"and",
"finishes",
"the",
"MAC",
"operation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Mac.java#L686-L694 |
34,557 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SealedObject.java | SealedObject.readObject | private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException
{
s.defaultReadObject();
if (encryptedContent != null)
encryptedContent = encryptedContent.clone();
if (encodedParams != null)
encodedParams = encodedParams.clone();
} | java | private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException
{
s.defaultReadObject();
if (encryptedContent != null)
encryptedContent = encryptedContent.clone();
if (encodedParams != null)
encodedParams = encodedParams.clone();
} | [
"private",
"void",
"readObject",
"(",
"java",
".",
"io",
".",
"ObjectInputStream",
"s",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
",",
"ClassNotFoundException",
"{",
"s",
".",
"defaultReadObject",
"(",
")",
";",
"if",
"(",
"encryptedContent",
"!=... | Restores the state of the SealedObject from a stream.
@param s the object input stream.
@exception NullPointerException if s is null. | [
"Restores",
"the",
"state",
"of",
"the",
"SealedObject",
"from",
"a",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SealedObject.java#L444-L452 |
34,558 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLServerSocketFactory.java | SSLServerSocketFactory.getDefault | public static synchronized ServerSocketFactory getDefault() {
// Android-changed: Use security version instead of propertyChecked.
//
// We use the same lookup logic in SSLSocketFactory.getDefault(). Any changes
// made here must be mirrored in that class.
if (defaultServerSocketFactory != null && lastVersion == Security.getVersion()) {
return defaultServerSocketFactory;
}
lastVersion = Security.getVersion();
SSLServerSocketFactory previousDefaultServerSocketFactory = defaultServerSocketFactory;
defaultServerSocketFactory = null;
String clsName = SSLSocketFactory.getSecurityProperty
("ssl.ServerSocketFactory.provider");
if (clsName != null) {
// The instance for the default socket factory is checked for updates quite
// often (for instance, every time a security provider is added). Which leads
// to unnecessary overload and excessive error messages in case of class-loading
// errors. Avoid creating a new object if the class name is the same as before.
if (previousDefaultServerSocketFactory != null
&& clsName.equals(previousDefaultServerSocketFactory.getClass().getName())) {
defaultServerSocketFactory = previousDefaultServerSocketFactory;
return defaultServerSocketFactory;
}
Class cls = null;
log("setting up default SSLServerSocketFactory");
try {
log("setting up default SSLServerSocketFactory");
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
// Android-changed; Try the contextClassLoader first.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
if (cl != null) {
cls = Class.forName(clsName, true, cl);
}
}
log("class " + clsName + " is loaded");
SSLServerSocketFactory fac = (SSLServerSocketFactory) cls.newInstance();
log("instantiated an instance of class " + clsName);
defaultServerSocketFactory = fac;
if (defaultServerSocketFactory != null) {
return defaultServerSocketFactory;
}
} catch (Exception e) {
log("SSLServerSocketFactory instantiation failed: " + e);
// Android-changed: Fallback to the default SSLContext if an exception
// is thrown during the initialization of ssl.ServerSocketFactory.provider.
}
}
try {
SSLContext context = SSLContext.getDefault();
if (context != null) {
defaultServerSocketFactory = context.getServerSocketFactory();
}
} catch (NoSuchAlgorithmException e) {
}
if (defaultServerSocketFactory == null) {
defaultServerSocketFactory = new DefaultSSLServerSocketFactory(
new IllegalStateException("No ServerSocketFactory implementation found"));
}
return defaultServerSocketFactory;
} | java | public static synchronized ServerSocketFactory getDefault() {
// Android-changed: Use security version instead of propertyChecked.
//
// We use the same lookup logic in SSLSocketFactory.getDefault(). Any changes
// made here must be mirrored in that class.
if (defaultServerSocketFactory != null && lastVersion == Security.getVersion()) {
return defaultServerSocketFactory;
}
lastVersion = Security.getVersion();
SSLServerSocketFactory previousDefaultServerSocketFactory = defaultServerSocketFactory;
defaultServerSocketFactory = null;
String clsName = SSLSocketFactory.getSecurityProperty
("ssl.ServerSocketFactory.provider");
if (clsName != null) {
// The instance for the default socket factory is checked for updates quite
// often (for instance, every time a security provider is added). Which leads
// to unnecessary overload and excessive error messages in case of class-loading
// errors. Avoid creating a new object if the class name is the same as before.
if (previousDefaultServerSocketFactory != null
&& clsName.equals(previousDefaultServerSocketFactory.getClass().getName())) {
defaultServerSocketFactory = previousDefaultServerSocketFactory;
return defaultServerSocketFactory;
}
Class cls = null;
log("setting up default SSLServerSocketFactory");
try {
log("setting up default SSLServerSocketFactory");
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
// Android-changed; Try the contextClassLoader first.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
if (cl != null) {
cls = Class.forName(clsName, true, cl);
}
}
log("class " + clsName + " is loaded");
SSLServerSocketFactory fac = (SSLServerSocketFactory) cls.newInstance();
log("instantiated an instance of class " + clsName);
defaultServerSocketFactory = fac;
if (defaultServerSocketFactory != null) {
return defaultServerSocketFactory;
}
} catch (Exception e) {
log("SSLServerSocketFactory instantiation failed: " + e);
// Android-changed: Fallback to the default SSLContext if an exception
// is thrown during the initialization of ssl.ServerSocketFactory.provider.
}
}
try {
SSLContext context = SSLContext.getDefault();
if (context != null) {
defaultServerSocketFactory = context.getServerSocketFactory();
}
} catch (NoSuchAlgorithmException e) {
}
if (defaultServerSocketFactory == null) {
defaultServerSocketFactory = new DefaultSSLServerSocketFactory(
new IllegalStateException("No ServerSocketFactory implementation found"));
}
return defaultServerSocketFactory;
} | [
"public",
"static",
"synchronized",
"ServerSocketFactory",
"getDefault",
"(",
")",
"{",
"// Android-changed: Use security version instead of propertyChecked.",
"//",
"// We use the same lookup logic in SSLSocketFactory.getDefault(). Any changes",
"// made here must be mirrored in that class.",... | Returns the default SSL server socket factory.
<p>The first time this method is called, the security property
"ssl.ServerSocketFactory.provider" is examined. If it is non-null, a
class by that name is loaded and instantiated. If that is successful and
the object is an instance of SSLServerSocketFactory, it is made the
default SSL server socket factory.
<p>Otherwise, this method returns
<code>SSLContext.getDefault().getServerSocketFactory()</code>. If that
call fails, an inoperative factory is returned.
@return the default <code>ServerSocketFactory</code>
@see SSLContext#getDefault | [
"Returns",
"the",
"default",
"SSL",
"server",
"socket",
"factory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLServerSocketFactory.java#L79-L149 |
34,559 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java | AttList.getURI | public String getURI(int index)
{
String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index)));
if(null == ns)
ns = "";
return ns;
} | java | public String getURI(int index)
{
String ns = m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index)));
if(null == ns)
ns = "";
return ns;
} | [
"public",
"String",
"getURI",
"(",
"int",
"index",
")",
"{",
"String",
"ns",
"=",
"m_dh",
".",
"getNamespaceOfNode",
"(",
"(",
"(",
"Attr",
")",
"m_attrs",
".",
"item",
"(",
"index",
")",
")",
")",
";",
"if",
"(",
"null",
"==",
"ns",
")",
"ns",
"... | Look up an attribute's Namespace URI by index.
@param index The attribute index (zero-based).
@return The Namespace URI, or the empty string if none
is available, or null if the index is out of
range. | [
"Look",
"up",
"an",
"attribute",
"s",
"Namespace",
"URI",
"by",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L105-L111 |
34,560 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java | AttList.getValue | public String getValue(String name)
{
Attr attr = ((Attr) m_attrs.getNamedItem(name));
return (null != attr)
? attr.getValue() : null;
} | java | public String getValue(String name)
{
Attr attr = ((Attr) m_attrs.getNamedItem(name));
return (null != attr)
? attr.getValue() : null;
} | [
"public",
"String",
"getValue",
"(",
"String",
"name",
")",
"{",
"Attr",
"attr",
"=",
"(",
"(",
"Attr",
")",
"m_attrs",
".",
"getNamedItem",
"(",
"name",
")",
")",
";",
"return",
"(",
"null",
"!=",
"attr",
")",
"?",
"attr",
".",
"getValue",
"(",
")... | Look up an attribute's value by name.
@param name The attribute node's name
@return The attribute node's value | [
"Look",
"up",
"an",
"attribute",
"s",
"value",
"by",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L201-L206 |
34,561 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java | AttList.getValue | public String getValue(String uri, String localName)
{
Node a=m_attrs.getNamedItemNS(uri,localName);
return (a==null) ? null : a.getNodeValue();
} | java | public String getValue(String uri, String localName)
{
Node a=m_attrs.getNamedItemNS(uri,localName);
return (a==null) ? null : a.getNodeValue();
} | [
"public",
"String",
"getValue",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"Node",
"a",
"=",
"m_attrs",
".",
"getNamedItemNS",
"(",
"uri",
",",
"localName",
")",
";",
"return",
"(",
"a",
"==",
"null",
")",
"?",
"null",
":",
"a",
".",... | Look up an attribute's value by Namespace name.
@param uri The Namespace URI, or the empty String if the
name has no Namespace URI.
@param localName The local name of the attribute.
@return The attribute value as a string, or null if the
attribute is not in the list. | [
"Look",
"up",
"an",
"attribute",
"s",
"value",
"by",
"Namespace",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L217-L221 |
34,562 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java | AttList.getIndex | public int getIndex(String uri, String localPart)
{
for(int i=m_attrs.getLength()-1;i>=0;--i)
{
Node a=m_attrs.item(i);
String u=a.getNamespaceURI();
if( (u==null ? uri==null : u.equals(uri))
&&
a.getLocalName().equals(localPart) )
return i;
}
return -1;
} | java | public int getIndex(String uri, String localPart)
{
for(int i=m_attrs.getLength()-1;i>=0;--i)
{
Node a=m_attrs.item(i);
String u=a.getNamespaceURI();
if( (u==null ? uri==null : u.equals(uri))
&&
a.getLocalName().equals(localPart) )
return i;
}
return -1;
} | [
"public",
"int",
"getIndex",
"(",
"String",
"uri",
",",
"String",
"localPart",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"m_attrs",
".",
"getLength",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"Node",
"a",
"=",
"m_attrs",
"... | Look up the index of an attribute by Namespace name.
@param uri The Namespace URI, or the empty string if
the name has no Namespace URI.
@param localPart The attribute's local name.
@return The index of the attribute, or -1 if it does not
appear in the list. | [
"Look",
"up",
"the",
"index",
"of",
"an",
"attribute",
"by",
"Namespace",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L232-L244 |
34,563 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java | AttList.getIndex | public int getIndex(String qName)
{
for(int i=m_attrs.getLength()-1;i>=0;--i)
{
Node a=m_attrs.item(i);
if(a.getNodeName().equals(qName) )
return i;
}
return -1;
} | java | public int getIndex(String qName)
{
for(int i=m_attrs.getLength()-1;i>=0;--i)
{
Node a=m_attrs.item(i);
if(a.getNodeName().equals(qName) )
return i;
}
return -1;
} | [
"public",
"int",
"getIndex",
"(",
"String",
"qName",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"m_attrs",
".",
"getLength",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"Node",
"a",
"=",
"m_attrs",
".",
"item",
"(",
"i",
")... | Look up the index of an attribute by raw XML 1.0 name.
@param qName The qualified (prefixed) name.
@return The index of the attribute, or -1 if it does not
appear in the list. | [
"Look",
"up",
"the",
"index",
"of",
"an",
"attribute",
"by",
"raw",
"XML",
"1",
".",
"0",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/AttList.java#L253-L262 |
34,564 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java | AbstractPlainSocketImpl.connect | protected void connect(String host, int port)
throws UnknownHostException, IOException
{
boolean connected = false;
try {
InetAddress address = InetAddress.getByName(host);
this.port = port;
this.address = address;
connectToAddress(address, port, timeout);
connected = true;
} finally {
if (!connected) {
try {
close();
} catch (IOException ioe) {
/* Do nothing. If connect threw an exception then
it will be passed up the call stack */
}
}
}
} | java | protected void connect(String host, int port)
throws UnknownHostException, IOException
{
boolean connected = false;
try {
InetAddress address = InetAddress.getByName(host);
this.port = port;
this.address = address;
connectToAddress(address, port, timeout);
connected = true;
} finally {
if (!connected) {
try {
close();
} catch (IOException ioe) {
/* Do nothing. If connect threw an exception then
it will be passed up the call stack */
}
}
}
} | [
"protected",
"void",
"connect",
"(",
"String",
"host",
",",
"int",
"port",
")",
"throws",
"UnknownHostException",
",",
"IOException",
"{",
"boolean",
"connected",
"=",
"false",
";",
"try",
"{",
"InetAddress",
"address",
"=",
"InetAddress",
".",
"getByName",
"(... | Creates a socket and connects it to the specified port on
the specified host.
@param host the specified host
@param port the specified port | [
"Creates",
"a",
"socket",
"and",
"connects",
"it",
"to",
"the",
"specified",
"port",
"on",
"the",
"specified",
"host",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java#L116-L137 |
34,565 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java | AbstractPlainSocketImpl.bind | protected synchronized void bind(InetAddress address, int lport)
throws IOException
{
synchronized (fdLock) {
if (!closePending && (socket == null || !socket.isBound())) {
NetHooks.beforeTcpBind(fd, address, lport);
}
}
socketBind(address, lport);
if (socket != null)
socket.setBound();
if (serverSocket != null)
serverSocket.setBound();
} | java | protected synchronized void bind(InetAddress address, int lport)
throws IOException
{
synchronized (fdLock) {
if (!closePending && (socket == null || !socket.isBound())) {
NetHooks.beforeTcpBind(fd, address, lport);
}
}
socketBind(address, lport);
if (socket != null)
socket.setBound();
if (serverSocket != null)
serverSocket.setBound();
} | [
"protected",
"synchronized",
"void",
"bind",
"(",
"InetAddress",
"address",
",",
"int",
"lport",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"fdLock",
")",
"{",
"if",
"(",
"!",
"closePending",
"&&",
"(",
"socket",
"==",
"null",
"||",
"!",
"sock... | Binds the socket to the specified address of the specified local port.
@param address the address
@param lport the port | [
"Binds",
"the",
"socket",
"to",
"the",
"specified",
"address",
"of",
"the",
"specified",
"local",
"port",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java#L363-L376 |
34,566 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java | AbstractPlainSocketImpl.getInputStream | protected synchronized InputStream getInputStream() throws IOException {
if (isClosedOrPending()) {
throw new IOException("Socket Closed");
}
if (shut_rd) {
throw new IOException("Socket input is shutdown");
}
if (socketInputStream == null) {
socketInputStream = new SocketInputStream(this);
}
return socketInputStream;
} | java | protected synchronized InputStream getInputStream() throws IOException {
if (isClosedOrPending()) {
throw new IOException("Socket Closed");
}
if (shut_rd) {
throw new IOException("Socket input is shutdown");
}
if (socketInputStream == null) {
socketInputStream = new SocketInputStream(this);
}
return socketInputStream;
} | [
"protected",
"synchronized",
"InputStream",
"getInputStream",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isClosedOrPending",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Socket Closed\"",
")",
";",
"}",
"if",
"(",
"shut_rd",
")",
"{",
... | Gets an InputStream for this socket. | [
"Gets",
"an",
"InputStream",
"for",
"this",
"socket",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java#L398-L409 |
34,567 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java | AbstractPlainSocketImpl.shutdownInput | protected void shutdownInput() throws IOException {
if (fd != null && fd.valid()) {
socketShutdown(SHUT_RD);
if (socketInputStream != null) {
socketInputStream.setEOF(true);
}
shut_rd = true;
}
} | java | protected void shutdownInput() throws IOException {
if (fd != null && fd.valid()) {
socketShutdown(SHUT_RD);
if (socketInputStream != null) {
socketInputStream.setEOF(true);
}
shut_rd = true;
}
} | [
"protected",
"void",
"shutdownInput",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fd",
"!=",
"null",
"&&",
"fd",
".",
"valid",
"(",
")",
")",
"{",
"socketShutdown",
"(",
"SHUT_RD",
")",
";",
"if",
"(",
"socketInputStream",
"!=",
"null",
")",
"{... | Shutdown read-half of the socket connection; | [
"Shutdown",
"read",
"-",
"half",
"of",
"the",
"socket",
"connection",
";"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java#L516-L524 |
34,568 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java | AbstractPlainSocketImpl.shutdownOutput | protected void shutdownOutput() throws IOException {
if (fd != null && fd.valid()) {
socketShutdown(SHUT_WR);
shut_wr = true;
}
} | java | protected void shutdownOutput() throws IOException {
if (fd != null && fd.valid()) {
socketShutdown(SHUT_WR);
shut_wr = true;
}
} | [
"protected",
"void",
"shutdownOutput",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fd",
"!=",
"null",
"&&",
"fd",
".",
"valid",
"(",
")",
")",
"{",
"socketShutdown",
"(",
"SHUT_WR",
")",
";",
"shut_wr",
"=",
"true",
";",
"}",
"}"
] | Shutdown write-half of the socket connection; | [
"Shutdown",
"write",
"-",
"half",
"of",
"the",
"socket",
"connection",
";"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java#L529-L534 |
34,569 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Properties.java | Properties.propertyNames | public Enumeration<?> propertyNames() {
Hashtable<String,Object> h = new Hashtable<>();
enumerate(h);
return h.keys();
} | java | public Enumeration<?> propertyNames() {
Hashtable<String,Object> h = new Hashtable<>();
enumerate(h);
return h.keys();
} | [
"public",
"Enumeration",
"<",
"?",
">",
"propertyNames",
"(",
")",
"{",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"h",
"=",
"new",
"Hashtable",
"<>",
"(",
")",
";",
"enumerate",
"(",
"h",
")",
";",
"return",
"h",
".",
"keys",
"(",
")",
";",
... | Returns an enumeration of all the keys in this property list,
including distinct keys in the default property list if a key
of the same name has not already been found from the main
properties list.
@return an enumeration of all the keys in this property list, including
the keys in the default property list.
@throws ClassCastException if any key in this property list
is not a string.
@see java.util.Enumeration
@see java.util.Properties#defaults
@see #stringPropertyNames | [
"Returns",
"an",
"enumeration",
"of",
"all",
"the",
"keys",
"in",
"this",
"property",
"list",
"including",
"distinct",
"keys",
"in",
"the",
"default",
"property",
"list",
"if",
"a",
"key",
"of",
"the",
"same",
"name",
"has",
"not",
"already",
"been",
"foun... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Properties.java#L1119-L1123 |
34,570 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java | ElemDesc.setAttr | void setAttr(String name, int flags)
{
if (null == m_attrs)
m_attrs = new StringToIntTable();
m_attrs.put(name, flags);
} | java | void setAttr(String name, int flags)
{
if (null == m_attrs)
m_attrs = new StringToIntTable();
m_attrs.put(name, flags);
} | [
"void",
"setAttr",
"(",
"String",
"name",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"null",
"==",
"m_attrs",
")",
"m_attrs",
"=",
"new",
"StringToIntTable",
"(",
")",
";",
"m_attrs",
".",
"put",
"(",
"name",
",",
"flags",
")",
";",
"}"
] | Set an attribute name and it's bit properties.
@param name non-null name of attribute, in upper case.
@param flags flag bits. | [
"Set",
"an",
"attribute",
"name",
"and",
"it",
"s",
"bit",
"properties",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java#L156-L163 |
34,571 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java | ElemDesc.isAttrFlagSet | public boolean isAttrFlagSet(String name, int flags)
{
return (null != m_attrs)
? ((m_attrs.getIgnoreCase(name) & flags) != 0)
: false;
} | java | public boolean isAttrFlagSet(String name, int flags)
{
return (null != m_attrs)
? ((m_attrs.getIgnoreCase(name) & flags) != 0)
: false;
} | [
"public",
"boolean",
"isAttrFlagSet",
"(",
"String",
"name",
",",
"int",
"flags",
")",
"{",
"return",
"(",
"null",
"!=",
"m_attrs",
")",
"?",
"(",
"(",
"m_attrs",
".",
"getIgnoreCase",
"(",
"name",
")",
"&",
"flags",
")",
"!=",
"0",
")",
":",
"false"... | Tell if any of the bits of interest are set for a named attribute type.
@param name non-null reference to attribute name, in any case.
@param flags flag mask.
@return true if any of the flags are set for the named attribute. | [
"Tell",
"if",
"any",
"of",
"the",
"bits",
"of",
"interest",
"are",
"set",
"for",
"a",
"named",
"attribute",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemDesc.java#L173-L178 |
34,572 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/ast/ChildList.java | ChildList.modifiableDelegate | private ArrayListImpl<ChildLink<T>> modifiableDelegate() {
if (delegate.getCount() != 0) {
delegate = new ArrayListImpl<>(delegate);
}
return delegate;
} | java | private ArrayListImpl<ChildLink<T>> modifiableDelegate() {
if (delegate.getCount() != 0) {
delegate = new ArrayListImpl<>(delegate);
}
return delegate;
} | [
"private",
"ArrayListImpl",
"<",
"ChildLink",
"<",
"T",
">",
">",
"modifiableDelegate",
"(",
")",
"{",
"if",
"(",
"delegate",
".",
"getCount",
"(",
")",
"!=",
"0",
")",
"{",
"delegate",
"=",
"new",
"ArrayListImpl",
"<>",
"(",
"delegate",
")",
";",
"}",... | Returns an ArrayListImpl that is safe to modify. If delegate.count does not equal to zero,
returns a copy of delegate. | [
"Returns",
"an",
"ArrayListImpl",
"that",
"is",
"safe",
"to",
"modify",
".",
"If",
"delegate",
".",
"count",
"does",
"not",
"equal",
"to",
"zero",
"returns",
"a",
"copy",
"of",
"delegate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/ChildList.java#L105-L110 |
34,573 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java | SpinedBuffer.ensureCapacity | @SuppressWarnings("unchecked")
protected final void ensureCapacity(long targetSize) {
long capacity = capacity();
if (targetSize > capacity) {
inflateSpine();
for (int i=spineIndex+1; targetSize > capacity; i++) {
if (i >= spine.length) {
int newSpineSize = spine.length * 2;
spine = Arrays.copyOf(spine, newSpineSize);
priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
}
int nextChunkSize = chunkSize(i);
spine[i] = (E[]) new Object[nextChunkSize];
priorElementCount[i] = priorElementCount[i-1] + spine[i-1].length;
capacity += nextChunkSize;
}
}
} | java | @SuppressWarnings("unchecked")
protected final void ensureCapacity(long targetSize) {
long capacity = capacity();
if (targetSize > capacity) {
inflateSpine();
for (int i=spineIndex+1; targetSize > capacity; i++) {
if (i >= spine.length) {
int newSpineSize = spine.length * 2;
spine = Arrays.copyOf(spine, newSpineSize);
priorElementCount = Arrays.copyOf(priorElementCount, newSpineSize);
}
int nextChunkSize = chunkSize(i);
spine[i] = (E[]) new Object[nextChunkSize];
priorElementCount[i] = priorElementCount[i-1] + spine[i-1].length;
capacity += nextChunkSize;
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"final",
"void",
"ensureCapacity",
"(",
"long",
"targetSize",
")",
"{",
"long",
"capacity",
"=",
"capacity",
"(",
")",
";",
"if",
"(",
"targetSize",
">",
"capacity",
")",
"{",
"inflateSpine",
"... | Ensure that the buffer has at least capacity to hold the target size | [
"Ensure",
"that",
"the",
"buffer",
"has",
"at",
"least",
"capacity",
"to",
"hold",
"the",
"target",
"size"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java#L132-L149 |
34,574 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java | SpinedBuffer.get | public E get(long index) {
// @@@ can further optimize by caching last seen spineIndex,
// which is going to be right most of the time
// Casts to int are safe since the spine array index is the index minus
// the prior element count from the current spine
if (spineIndex == 0) {
if (index < elementIndex)
return curChunk[((int) index)];
else
throw new IndexOutOfBoundsException(Long.toString(index));
}
if (index >= count())
throw new IndexOutOfBoundsException(Long.toString(index));
for (int j=0; j <= spineIndex; j++)
if (index < priorElementCount[j] + spine[j].length)
return spine[j][((int) (index - priorElementCount[j]))];
throw new IndexOutOfBoundsException(Long.toString(index));
} | java | public E get(long index) {
// @@@ can further optimize by caching last seen spineIndex,
// which is going to be right most of the time
// Casts to int are safe since the spine array index is the index minus
// the prior element count from the current spine
if (spineIndex == 0) {
if (index < elementIndex)
return curChunk[((int) index)];
else
throw new IndexOutOfBoundsException(Long.toString(index));
}
if (index >= count())
throw new IndexOutOfBoundsException(Long.toString(index));
for (int j=0; j <= spineIndex; j++)
if (index < priorElementCount[j] + spine[j].length)
return spine[j][((int) (index - priorElementCount[j]))];
throw new IndexOutOfBoundsException(Long.toString(index));
} | [
"public",
"E",
"get",
"(",
"long",
"index",
")",
"{",
"// @@@ can further optimize by caching last seen spineIndex,",
"// which is going to be right most of the time",
"// Casts to int are safe since the spine array index is the index minus",
"// the prior element count from the current spine"... | Retrieve the element at the specified index. | [
"Retrieve",
"the",
"element",
"at",
"the",
"specified",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java#L161-L182 |
34,575 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java | SpinedBuffer.copyInto | public void copyInto(E[] array, int offset) {
long finalOffset = offset + count();
if (finalOffset > array.length || finalOffset < offset) {
throw new IndexOutOfBoundsException("does not fit");
}
if (spineIndex == 0)
System.arraycopy(curChunk, 0, array, offset, elementIndex);
else {
// full chunks
for (int i=0; i < spineIndex; i++) {
System.arraycopy(spine[i], 0, array, offset, spine[i].length);
offset += spine[i].length;
}
if (elementIndex > 0)
System.arraycopy(curChunk, 0, array, offset, elementIndex);
}
} | java | public void copyInto(E[] array, int offset) {
long finalOffset = offset + count();
if (finalOffset > array.length || finalOffset < offset) {
throw new IndexOutOfBoundsException("does not fit");
}
if (spineIndex == 0)
System.arraycopy(curChunk, 0, array, offset, elementIndex);
else {
// full chunks
for (int i=0; i < spineIndex; i++) {
System.arraycopy(spine[i], 0, array, offset, spine[i].length);
offset += spine[i].length;
}
if (elementIndex > 0)
System.arraycopy(curChunk, 0, array, offset, elementIndex);
}
} | [
"public",
"void",
"copyInto",
"(",
"E",
"[",
"]",
"array",
",",
"int",
"offset",
")",
"{",
"long",
"finalOffset",
"=",
"offset",
"+",
"count",
"(",
")",
";",
"if",
"(",
"finalOffset",
">",
"array",
".",
"length",
"||",
"finalOffset",
"<",
"offset",
"... | Copy the elements, starting at the specified offset, into the specified
array. | [
"Copy",
"the",
"elements",
"starting",
"at",
"the",
"specified",
"offset",
"into",
"the",
"specified",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java#L188-L205 |
34,576 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java | SpinedBuffer.asArray | public E[] asArray(IntFunction<E[]> arrayFactory) {
long size = count();
if (size >= Nodes.MAX_ARRAY_SIZE)
throw new IllegalArgumentException(Nodes.BAD_SIZE);
E[] result = arrayFactory.apply((int) size);
copyInto(result, 0);
return result;
} | java | public E[] asArray(IntFunction<E[]> arrayFactory) {
long size = count();
if (size >= Nodes.MAX_ARRAY_SIZE)
throw new IllegalArgumentException(Nodes.BAD_SIZE);
E[] result = arrayFactory.apply((int) size);
copyInto(result, 0);
return result;
} | [
"public",
"E",
"[",
"]",
"asArray",
"(",
"IntFunction",
"<",
"E",
"[",
"]",
">",
"arrayFactory",
")",
"{",
"long",
"size",
"=",
"count",
"(",
")",
";",
"if",
"(",
"size",
">=",
"Nodes",
".",
"MAX_ARRAY_SIZE",
")",
"throw",
"new",
"IllegalArgumentExcept... | Create a new array using the specified array factory, and copy the
elements into it. | [
"Create",
"a",
"new",
"array",
"using",
"the",
"specified",
"array",
"factory",
"and",
"copy",
"the",
"elements",
"into",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SpinedBuffer.java#L211-L218 |
34,577 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java | FileLockTable.newSharedFileLockTable | public static FileLockTable newSharedFileLockTable(Channel channel,
FileDescriptor fd)
throws IOException
{
return new SharedFileLockTable(channel, fd);
} | java | public static FileLockTable newSharedFileLockTable(Channel channel,
FileDescriptor fd)
throws IOException
{
return new SharedFileLockTable(channel, fd);
} | [
"public",
"static",
"FileLockTable",
"newSharedFileLockTable",
"(",
"Channel",
"channel",
",",
"FileDescriptor",
"fd",
")",
"throws",
"IOException",
"{",
"return",
"new",
"SharedFileLockTable",
"(",
"channel",
",",
"fd",
")",
";",
"}"
] | Creates and returns a file lock table for a channel that is connected to
the a system-wide map of all file locks for the Java virtual machine. | [
"Creates",
"and",
"returns",
"a",
"file",
"lock",
"table",
"for",
"a",
"channel",
"that",
"is",
"connected",
"to",
"the",
"a",
"system",
"-",
"wide",
"map",
"of",
"all",
"file",
"locks",
"for",
"the",
"Java",
"virtual",
"machine",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java#L43-L48 |
34,578 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java | SharedFileLockTable.checkList | private void checkList(List<FileLockReference> list, long position, long size)
throws OverlappingFileLockException
{
assert Thread.holdsLock(list);
for (FileLockReference ref: list) {
FileLock fl = ref.get();
if (fl != null && fl.overlaps(position, size))
throw new OverlappingFileLockException();
}
} | java | private void checkList(List<FileLockReference> list, long position, long size)
throws OverlappingFileLockException
{
assert Thread.holdsLock(list);
for (FileLockReference ref: list) {
FileLock fl = ref.get();
if (fl != null && fl.overlaps(position, size))
throw new OverlappingFileLockException();
}
} | [
"private",
"void",
"checkList",
"(",
"List",
"<",
"FileLockReference",
">",
"list",
",",
"long",
"position",
",",
"long",
"size",
")",
"throws",
"OverlappingFileLockException",
"{",
"assert",
"Thread",
".",
"holdsLock",
"(",
"list",
")",
";",
"for",
"(",
"Fi... | Check for overlapping file locks | [
"Check",
"for",
"overlapping",
"file",
"locks"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java#L248-L257 |
34,579 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java | SharedFileLockTable.removeStaleEntries | private void removeStaleEntries() {
FileLockReference ref;
while ((ref = (FileLockReference)queue.poll()) != null) {
FileKey fk = ref.fileKey();
List<FileLockReference> list = lockMap.get(fk);
if (list != null) {
synchronized (list) {
list.remove(ref);
removeKeyIfEmpty(fk, list);
}
}
}
} | java | private void removeStaleEntries() {
FileLockReference ref;
while ((ref = (FileLockReference)queue.poll()) != null) {
FileKey fk = ref.fileKey();
List<FileLockReference> list = lockMap.get(fk);
if (list != null) {
synchronized (list) {
list.remove(ref);
removeKeyIfEmpty(fk, list);
}
}
}
} | [
"private",
"void",
"removeStaleEntries",
"(",
")",
"{",
"FileLockReference",
"ref",
";",
"while",
"(",
"(",
"ref",
"=",
"(",
"FileLockReference",
")",
"queue",
".",
"poll",
"(",
")",
")",
"!=",
"null",
")",
"{",
"FileKey",
"fk",
"=",
"ref",
".",
"fileK... | Process the reference queue | [
"Process",
"the",
"reference",
"queue"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/FileLockTable.java#L260-L272 |
34,580 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java | TransliteratorIDParser.parseCompoundID | public static boolean parseCompoundID(String id, int dir,
StringBuffer canonID,
List<SingleID> list,
UnicodeSet[] globalFilter) {
int[] pos = new int[] { 0 };
int[] withParens = new int[1];
list.clear();
UnicodeSet filter;
globalFilter[0] = null;
canonID.setLength(0);
// Parse leading global filter, if any
withParens[0] = 0; // parens disallowed
filter = parseGlobalFilter(id, pos, dir, withParens, canonID);
if (filter != null) {
if (!Utility.parseChar(id, pos, ID_DELIM)) {
// Not a global filter; backup and resume
canonID.setLength(0);
pos[0] = 0;
}
if (dir == FORWARD) {
globalFilter[0] = filter;
}
}
boolean sawDelimiter = true;
for (;;) {
SingleID single = parseSingleID(id, pos, dir);
if (single == null) {
break;
}
if (dir == FORWARD) {
list.add(single);
} else {
list.add(0, single);
}
if (!Utility.parseChar(id, pos, ID_DELIM)) {
sawDelimiter = false;
break;
}
}
if (list.size() == 0) {
return false;
}
// Construct canonical ID
for (int i=0; i<list.size(); ++i) {
SingleID single = list.get(i);
canonID.append(single.canonID);
if (i != (list.size()-1)) {
canonID.append(ID_DELIM);
}
}
// Parse trailing global filter, if any, and only if we saw
// a trailing delimiter after the IDs.
if (sawDelimiter) {
withParens[0] = 1; // parens required
filter = parseGlobalFilter(id, pos, dir, withParens, canonID);
if (filter != null) {
// Don't require trailing ';', but parse it if present
Utility.parseChar(id, pos, ID_DELIM);
if (dir == REVERSE) {
globalFilter[0] = filter;
}
}
}
// Trailing unparsed text is a syntax error
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (pos[0] != id.length()) {
return false;
}
return true;
} | java | public static boolean parseCompoundID(String id, int dir,
StringBuffer canonID,
List<SingleID> list,
UnicodeSet[] globalFilter) {
int[] pos = new int[] { 0 };
int[] withParens = new int[1];
list.clear();
UnicodeSet filter;
globalFilter[0] = null;
canonID.setLength(0);
// Parse leading global filter, if any
withParens[0] = 0; // parens disallowed
filter = parseGlobalFilter(id, pos, dir, withParens, canonID);
if (filter != null) {
if (!Utility.parseChar(id, pos, ID_DELIM)) {
// Not a global filter; backup and resume
canonID.setLength(0);
pos[0] = 0;
}
if (dir == FORWARD) {
globalFilter[0] = filter;
}
}
boolean sawDelimiter = true;
for (;;) {
SingleID single = parseSingleID(id, pos, dir);
if (single == null) {
break;
}
if (dir == FORWARD) {
list.add(single);
} else {
list.add(0, single);
}
if (!Utility.parseChar(id, pos, ID_DELIM)) {
sawDelimiter = false;
break;
}
}
if (list.size() == 0) {
return false;
}
// Construct canonical ID
for (int i=0; i<list.size(); ++i) {
SingleID single = list.get(i);
canonID.append(single.canonID);
if (i != (list.size()-1)) {
canonID.append(ID_DELIM);
}
}
// Parse trailing global filter, if any, and only if we saw
// a trailing delimiter after the IDs.
if (sawDelimiter) {
withParens[0] = 1; // parens required
filter = parseGlobalFilter(id, pos, dir, withParens, canonID);
if (filter != null) {
// Don't require trailing ';', but parse it if present
Utility.parseChar(id, pos, ID_DELIM);
if (dir == REVERSE) {
globalFilter[0] = filter;
}
}
}
// Trailing unparsed text is a syntax error
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (pos[0] != id.length()) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"parseCompoundID",
"(",
"String",
"id",
",",
"int",
"dir",
",",
"StringBuffer",
"canonID",
",",
"List",
"<",
"SingleID",
">",
"list",
",",
"UnicodeSet",
"[",
"]",
"globalFilter",
")",
"{",
"int",
"[",
"]",
"pos",
"=",
"new"... | Parse a compound ID, consisting of an optional forward global
filter, a separator, one or more single IDs delimited by
separators, an an optional reverse global filter. The
separator is a semicolon. The global filters are UnicodeSet
patterns. The reverse global filter must be enclosed in
parentheses.
@param id the pattern the parse
@param dir the direction.
@param canonID OUTPUT parameter that receives the canonical ID,
consisting of canonical IDs for all elements, as returned by
parseSingleID(), separated by semicolons. Previous contents
are discarded.
@param list OUTPUT parameter that receives a list of SingleID
objects representing the parsed IDs. Previous contents are
discarded.
@param globalFilter OUTPUT parameter that receives a pointer to
a newly created global filter for this ID in this direction, or
null if there is none.
@return true if the parse succeeds, that is, if the entire
id is consumed without syntax error. | [
"Parse",
"a",
"compound",
"ID",
"consisting",
"of",
"an",
"optional",
"forward",
"global",
"filter",
"a",
"separator",
"one",
"or",
"more",
"single",
"IDs",
"delimited",
"by",
"separators",
"an",
"an",
"optional",
"reverse",
"global",
"filter",
".",
"The",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java#L345-L422 |
34,581 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java | TransliteratorIDParser.instantiateList | static List<Transliterator> instantiateList(List<SingleID> ids) {
Transliterator t;
List<Transliterator> translits = new ArrayList<Transliterator>();
for (SingleID single : ids) {
if (single.basicID.length() == 0) {
continue;
}
t = single.getInstance();
if (t == null) {
throw new IllegalArgumentException("Illegal ID " + single.canonID);
}
translits.add(t);
}
// An empty list is equivalent to a Null transliterator.
if (translits.size() == 0) {
t = Transliterator.getBasicInstance("Any-Null", null);
if (t == null) {
// Should never happen
throw new IllegalArgumentException("Internal error; cannot instantiate Any-Null");
}
translits.add(t);
}
return translits;
} | java | static List<Transliterator> instantiateList(List<SingleID> ids) {
Transliterator t;
List<Transliterator> translits = new ArrayList<Transliterator>();
for (SingleID single : ids) {
if (single.basicID.length() == 0) {
continue;
}
t = single.getInstance();
if (t == null) {
throw new IllegalArgumentException("Illegal ID " + single.canonID);
}
translits.add(t);
}
// An empty list is equivalent to a Null transliterator.
if (translits.size() == 0) {
t = Transliterator.getBasicInstance("Any-Null", null);
if (t == null) {
// Should never happen
throw new IllegalArgumentException("Internal error; cannot instantiate Any-Null");
}
translits.add(t);
}
return translits;
} | [
"static",
"List",
"<",
"Transliterator",
">",
"instantiateList",
"(",
"List",
"<",
"SingleID",
">",
"ids",
")",
"{",
"Transliterator",
"t",
";",
"List",
"<",
"Transliterator",
">",
"translits",
"=",
"new",
"ArrayList",
"<",
"Transliterator",
">",
"(",
")",
... | Returns the list of Transliterator objects for the
given list of SingleID objects.
@param ids list vector of SingleID objects.
@return Actual transliterators for the list of SingleIDs | [
"Returns",
"the",
"list",
"of",
"Transliterator",
"objects",
"for",
"the",
"given",
"list",
"of",
"SingleID",
"objects",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java#L431-L455 |
34,582 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java | TransliteratorIDParser.specsToID | private static SingleID specsToID(Specs specs, int dir) {
String canonID = "";
String basicID = "";
String basicPrefix = "";
if (specs != null) {
StringBuilder buf = new StringBuilder();
if (dir == FORWARD) {
if (specs.sawSource) {
buf.append(specs.source).append(TARGET_SEP);
} else {
basicPrefix = specs.source + TARGET_SEP;
}
buf.append(specs.target);
} else {
buf.append(specs.target).append(TARGET_SEP).append(specs.source);
}
if (specs.variant != null) {
buf.append(VARIANT_SEP).append(specs.variant);
}
basicID = basicPrefix + buf.toString();
if (specs.filter != null) {
buf.insert(0, specs.filter);
}
canonID = buf.toString();
}
return new SingleID(canonID, basicID);
} | java | private static SingleID specsToID(Specs specs, int dir) {
String canonID = "";
String basicID = "";
String basicPrefix = "";
if (specs != null) {
StringBuilder buf = new StringBuilder();
if (dir == FORWARD) {
if (specs.sawSource) {
buf.append(specs.source).append(TARGET_SEP);
} else {
basicPrefix = specs.source + TARGET_SEP;
}
buf.append(specs.target);
} else {
buf.append(specs.target).append(TARGET_SEP).append(specs.source);
}
if (specs.variant != null) {
buf.append(VARIANT_SEP).append(specs.variant);
}
basicID = basicPrefix + buf.toString();
if (specs.filter != null) {
buf.insert(0, specs.filter);
}
canonID = buf.toString();
}
return new SingleID(canonID, basicID);
} | [
"private",
"static",
"SingleID",
"specsToID",
"(",
"Specs",
"specs",
",",
"int",
"dir",
")",
"{",
"String",
"canonID",
"=",
"\"\"",
";",
"String",
"basicID",
"=",
"\"\"",
";",
"String",
"basicPrefix",
"=",
"\"\"",
";",
"if",
"(",
"specs",
"!=",
"null",
... | Givens a Spec object, convert it to a SingleID object. The
Spec object is a more unprocessed parse result. The SingleID
object contains information about canonical and basic IDs.
@return a SingleID; never returns null. Returned object always
has 'filter' field of null. | [
"Givens",
"a",
"Spec",
"object",
"convert",
"it",
"to",
"a",
"SingleID",
"object",
".",
"The",
"Spec",
"object",
"is",
"a",
"more",
"unprocessed",
"parse",
"result",
".",
"The",
"SingleID",
"object",
"contains",
"information",
"about",
"canonical",
"and",
"b... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java#L701-L727 |
34,583 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java | TransliteratorIDParser.specsToSpecialInverse | private static SingleID specsToSpecialInverse(Specs specs) {
if (!specs.source.equalsIgnoreCase(ANY)) {
return null;
}
String inverseTarget = SPECIAL_INVERSES.get(new CaseInsensitiveString(specs.target));
if (inverseTarget != null) {
// If the original ID contained "Any-" then make the
// special inverse "Any-Foo"; otherwise make it "Foo".
// So "Any-NFC" => "Any-NFD" but "NFC" => "NFD".
StringBuilder buf = new StringBuilder();
if (specs.filter != null) {
buf.append(specs.filter);
}
if (specs.sawSource) {
buf.append(ANY).append(TARGET_SEP);
}
buf.append(inverseTarget);
String basicID = ANY + TARGET_SEP + inverseTarget;
if (specs.variant != null) {
buf.append(VARIANT_SEP).append(specs.variant);
basicID = basicID + VARIANT_SEP + specs.variant;
}
return new SingleID(buf.toString(), basicID);
}
return null;
} | java | private static SingleID specsToSpecialInverse(Specs specs) {
if (!specs.source.equalsIgnoreCase(ANY)) {
return null;
}
String inverseTarget = SPECIAL_INVERSES.get(new CaseInsensitiveString(specs.target));
if (inverseTarget != null) {
// If the original ID contained "Any-" then make the
// special inverse "Any-Foo"; otherwise make it "Foo".
// So "Any-NFC" => "Any-NFD" but "NFC" => "NFD".
StringBuilder buf = new StringBuilder();
if (specs.filter != null) {
buf.append(specs.filter);
}
if (specs.sawSource) {
buf.append(ANY).append(TARGET_SEP);
}
buf.append(inverseTarget);
String basicID = ANY + TARGET_SEP + inverseTarget;
if (specs.variant != null) {
buf.append(VARIANT_SEP).append(specs.variant);
basicID = basicID + VARIANT_SEP + specs.variant;
}
return new SingleID(buf.toString(), basicID);
}
return null;
} | [
"private",
"static",
"SingleID",
"specsToSpecialInverse",
"(",
"Specs",
"specs",
")",
"{",
"if",
"(",
"!",
"specs",
".",
"source",
".",
"equalsIgnoreCase",
"(",
"ANY",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"inverseTarget",
"=",
"SPECIAL_INVERS... | Given a Specs object, return a SingleID representing the
special inverse of that ID. If there is no special inverse
then return null.
@return a SingleID or null. Returned object always has
'filter' field of null. | [
"Given",
"a",
"Specs",
"object",
"return",
"a",
"SingleID",
"representing",
"the",
"special",
"inverse",
"of",
"that",
"ID",
".",
"If",
"there",
"is",
"no",
"special",
"inverse",
"then",
"return",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java#L736-L763 |
34,584 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyFactory.java | KeyFactory.translateKey | public final Key translateKey(Key key) throws InvalidKeyException {
if (serviceIterator == null) {
return spi.engineTranslateKey(key);
}
Exception failure = null;
KeyFactorySpi mySpi = spi;
do {
try {
return mySpi.engineTranslateKey(key);
} catch (Exception e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi);
}
} while (mySpi != null);
if (failure instanceof RuntimeException) {
throw (RuntimeException)failure;
}
if (failure instanceof InvalidKeyException) {
throw (InvalidKeyException)failure;
}
throw new InvalidKeyException
("Could not translate key", failure);
} | java | public final Key translateKey(Key key) throws InvalidKeyException {
if (serviceIterator == null) {
return spi.engineTranslateKey(key);
}
Exception failure = null;
KeyFactorySpi mySpi = spi;
do {
try {
return mySpi.engineTranslateKey(key);
} catch (Exception e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi);
}
} while (mySpi != null);
if (failure instanceof RuntimeException) {
throw (RuntimeException)failure;
}
if (failure instanceof InvalidKeyException) {
throw (InvalidKeyException)failure;
}
throw new InvalidKeyException
("Could not translate key", failure);
} | [
"public",
"final",
"Key",
"translateKey",
"(",
"Key",
"key",
")",
"throws",
"InvalidKeyException",
"{",
"if",
"(",
"serviceIterator",
"==",
"null",
")",
"{",
"return",
"spi",
".",
"engineTranslateKey",
"(",
"key",
")",
";",
"}",
"Exception",
"failure",
"=",
... | Translates a key object, whose provider may be unknown or potentially
untrusted, into a corresponding key object of this key factory.
@param key the key whose provider is unknown or untrusted.
@return the translated key.
@exception InvalidKeyException if the given key cannot be processed
by this key factory. | [
"Translates",
"a",
"key",
"object",
"whose",
"provider",
"may",
"be",
"unknown",
"or",
"potentially",
"untrusted",
"into",
"a",
"corresponding",
"key",
"object",
"of",
"this",
"key",
"factory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyFactory.java#L473-L497 |
34,585 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/SignerInfo.java | SignerInfo.convertToStandardName | private static String convertToStandardName(String internalName) {
if (internalName.equals("SHA")) {
return "SHA-1";
} else if (internalName.equals("SHA224")) {
return "SHA-224";
} else if (internalName.equals("SHA256")) {
return "SHA-256";
} else if (internalName.equals("SHA384")) {
return "SHA-384";
} else if (internalName.equals("SHA512")) {
return "SHA-512";
} else {
return internalName;
}
} | java | private static String convertToStandardName(String internalName) {
if (internalName.equals("SHA")) {
return "SHA-1";
} else if (internalName.equals("SHA224")) {
return "SHA-224";
} else if (internalName.equals("SHA256")) {
return "SHA-256";
} else if (internalName.equals("SHA384")) {
return "SHA-384";
} else if (internalName.equals("SHA512")) {
return "SHA-512";
} else {
return internalName;
}
} | [
"private",
"static",
"String",
"convertToStandardName",
"(",
"String",
"internalName",
")",
"{",
"if",
"(",
"internalName",
".",
"equals",
"(",
"\"SHA\"",
")",
")",
"{",
"return",
"\"SHA-1\"",
";",
"}",
"else",
"if",
"(",
"internalName",
".",
"equals",
"(",
... | Copied from com.sun.crypto.provider.OAEPParameters. | [
"Copied",
"from",
"com",
".",
"sun",
".",
"crypto",
".",
"provider",
".",
"OAEPParameters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/SignerInfo.java#L280-L294 |
34,586 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RDN.java | RDN.avas | public List<AVA> avas() {
List<AVA> list = avaList;
if (list == null) {
list = Collections.unmodifiableList(Arrays.asList(assertion));
avaList = list;
}
return list;
} | java | public List<AVA> avas() {
List<AVA> list = avaList;
if (list == null) {
list = Collections.unmodifiableList(Arrays.asList(assertion));
avaList = list;
}
return list;
} | [
"public",
"List",
"<",
"AVA",
">",
"avas",
"(",
")",
"{",
"List",
"<",
"AVA",
">",
"list",
"=",
"avaList",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"Collections",
".",
"unmodifiableList",
"(",
"Arrays",
".",
"asList",
"(",
"asse... | Return an immutable List of the AVAs in this RDN. | [
"Return",
"an",
"immutable",
"List",
"of",
"the",
"AVAs",
"in",
"this",
"RDN",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RDN.java#L275-L282 |
34,587 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RDN.java | AVAComparator.compare | @Override
public int compare(AVA a1, AVA a2) {
boolean a1Has2253 = a1.hasRFC2253Keyword();
boolean a2Has2253 = a2.hasRFC2253Keyword();
if (a1Has2253) {
if (a2Has2253) {
return a1.toRFC2253CanonicalString().compareTo
(a2.toRFC2253CanonicalString());
} else {
return -1;
}
} else {
if (a2Has2253) {
return 1;
} else {
int[] a1Oid = a1.getObjectIdentifier().toIntArray();
int[] a2Oid = a2.getObjectIdentifier().toIntArray();
int pos = 0;
int len = (a1Oid.length > a2Oid.length) ? a2Oid.length :
a1Oid.length;
while (pos < len && a1Oid[pos] == a2Oid[pos]) {
++pos;
}
return (pos == len) ? a1Oid.length - a2Oid.length :
a1Oid[pos] - a2Oid[pos];
}
}
} | java | @Override
public int compare(AVA a1, AVA a2) {
boolean a1Has2253 = a1.hasRFC2253Keyword();
boolean a2Has2253 = a2.hasRFC2253Keyword();
if (a1Has2253) {
if (a2Has2253) {
return a1.toRFC2253CanonicalString().compareTo
(a2.toRFC2253CanonicalString());
} else {
return -1;
}
} else {
if (a2Has2253) {
return 1;
} else {
int[] a1Oid = a1.getObjectIdentifier().toIntArray();
int[] a2Oid = a2.getObjectIdentifier().toIntArray();
int pos = 0;
int len = (a1Oid.length > a2Oid.length) ? a2Oid.length :
a1Oid.length;
while (pos < len && a1Oid[pos] == a2Oid[pos]) {
++pos;
}
return (pos == len) ? a1Oid.length - a2Oid.length :
a1Oid[pos] - a2Oid[pos];
}
}
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"AVA",
"a1",
",",
"AVA",
"a2",
")",
"{",
"boolean",
"a1Has2253",
"=",
"a1",
".",
"hasRFC2253Keyword",
"(",
")",
";",
"boolean",
"a2Has2253",
"=",
"a2",
".",
"hasRFC2253Keyword",
"(",
")",
";",
"if",
"("... | AVA's containing a standard keyword are ordered alphabetically,
followed by AVA's containing an OID keyword, ordered numerically | [
"AVA",
"s",
"containing",
"a",
"standard",
"keyword",
"are",
"ordered",
"alphabetically",
"followed",
"by",
"AVA",
"s",
"containing",
"an",
"OID",
"keyword",
"ordered",
"numerically"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RDN.java#L491-L519 |
34,588 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java | Region.getInstance | public static Region getInstance(String id) {
if ( id == null ) {
throw new NullPointerException();
}
loadRegionData();
Region r = regionIDMap.get(id);
if ( r == null ) {
r = regionAliases.get(id);
}
if ( r == null ) {
throw new IllegalArgumentException("Unknown region id: " + id);
}
if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
r = r.preferredValues.get(0);
}
return r;
} | java | public static Region getInstance(String id) {
if ( id == null ) {
throw new NullPointerException();
}
loadRegionData();
Region r = regionIDMap.get(id);
if ( r == null ) {
r = regionAliases.get(id);
}
if ( r == null ) {
throw new IllegalArgumentException("Unknown region id: " + id);
}
if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
r = r.preferredValues.get(0);
}
return r;
} | [
"public",
"static",
"Region",
"getInstance",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"loadRegionData",
"(",
")",
";",
"Region",
"r",
"=",
"regionIDMap",
".",
"g... | Returns a Region using the given region ID. The region ID can be either a 2-letter ISO code,
3-letter ISO code, UNM.49 numeric code, or other valid Unicode Region Code as defined by the CLDR.
@param id The id of the region to be retrieved.
@return The corresponding region.
@throws NullPointerException if the supplied id is null.
@throws IllegalArgumentException if the supplied ID cannot be canonicalized to a Region ID that is known by ICU. | [
"Returns",
"a",
"Region",
"using",
"the",
"given",
"region",
"ID",
".",
"The",
"region",
"ID",
"can",
"be",
"either",
"a",
"2",
"-",
"letter",
"ISO",
"code",
"3",
"-",
"letter",
"ISO",
"code",
"UNM",
".",
"49",
"numeric",
"code",
"or",
"other",
"vali... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java#L364-L387 |
34,589 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java | Region.getInstance | public static Region getInstance(int code) {
loadRegionData();
Region r = numericCodeMap.get(code);
if ( r == null ) { // Just in case there's an alias that's numeric, try to find it.
String pad = "";
if ( code < 10 ) {
pad = "00";
} else if ( code < 100 ) {
pad = "0";
}
String id = pad + Integer.toString(code);
r = regionAliases.get(id);
}
if ( r == null ) {
throw new IllegalArgumentException("Unknown region code: " + code);
}
if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
r = r.preferredValues.get(0);
}
return r;
} | java | public static Region getInstance(int code) {
loadRegionData();
Region r = numericCodeMap.get(code);
if ( r == null ) { // Just in case there's an alias that's numeric, try to find it.
String pad = "";
if ( code < 10 ) {
pad = "00";
} else if ( code < 100 ) {
pad = "0";
}
String id = pad + Integer.toString(code);
r = regionAliases.get(id);
}
if ( r == null ) {
throw new IllegalArgumentException("Unknown region code: " + code);
}
if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
r = r.preferredValues.get(0);
}
return r;
} | [
"public",
"static",
"Region",
"getInstance",
"(",
"int",
"code",
")",
"{",
"loadRegionData",
"(",
")",
";",
"Region",
"r",
"=",
"numericCodeMap",
".",
"get",
"(",
"code",
")",
";",
"if",
"(",
"r",
"==",
"null",
")",
"{",
"// Just in case there's an alias t... | Returns a Region using the given numeric code as defined by UNM.49
@param code The numeric code of the region to be retrieved.
@return The corresponding region.
@throws IllegalArgumentException if the supplied numeric code is not recognized. | [
"Returns",
"a",
"Region",
"using",
"the",
"given",
"numeric",
"code",
"as",
"defined",
"by",
"UNM",
".",
"49"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java#L396-L422 |
34,590 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java | Region.getAvailable | public static Set<Region> getAvailable(RegionType type) {
loadRegionData();
return Collections.unmodifiableSet(availableRegions.get(type.ordinal()));
} | java | public static Set<Region> getAvailable(RegionType type) {
loadRegionData();
return Collections.unmodifiableSet(availableRegions.get(type.ordinal()));
} | [
"public",
"static",
"Set",
"<",
"Region",
">",
"getAvailable",
"(",
"RegionType",
"type",
")",
"{",
"loadRegionData",
"(",
")",
";",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"availableRegions",
".",
"get",
"(",
"type",
".",
"ordinal",
"(",
")",
... | Used to retrieve all available regions of a specific type.
@param type The type of regions to be returned ( TERRITORY, MACROREGION, etc. )
@return An unmodifiable set of all known regions that match the given type. | [
"Used",
"to",
"retrieve",
"all",
"available",
"regions",
"of",
"a",
"specific",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java#L431-L435 |
34,591 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java | Region.getContainingRegion | public Region getContainingRegion(RegionType type) {
loadRegionData();
if ( containingRegion == null ) {
return null;
}
if ( containingRegion.type.equals(type)) {
return containingRegion;
} else {
return containingRegion.getContainingRegion(type);
}
} | java | public Region getContainingRegion(RegionType type) {
loadRegionData();
if ( containingRegion == null ) {
return null;
}
if ( containingRegion.type.equals(type)) {
return containingRegion;
} else {
return containingRegion.getContainingRegion(type);
}
} | [
"public",
"Region",
"getContainingRegion",
"(",
"RegionType",
"type",
")",
"{",
"loadRegionData",
"(",
")",
";",
"if",
"(",
"containingRegion",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"containingRegion",
".",
"type",
".",
"equals",
"... | Used to determine the macroregion that geographically contains this region and that matches the given type.
@return The region that geographically contains this region and matches the given type. May return NULL if
no containing region can be found that matches the given type. For example, calling this method with region "IT" (Italy)
and type CONTINENT returns the region "150" (Europe). | [
"Used",
"to",
"determine",
"the",
"macroregion",
"that",
"geographically",
"contains",
"this",
"region",
"and",
"that",
"matches",
"the",
"given",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java#L457-L467 |
34,592 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java | Region.getContainedRegions | public Set<Region> getContainedRegions(RegionType type) {
loadRegionData();
Set<Region> result = new TreeSet<Region>();
Set<Region> cr = getContainedRegions();
for ( Region r : cr ) {
if ( r.getType() == type ) {
result.add(r);
} else {
result.addAll(r.getContainedRegions(type));
}
}
return Collections.unmodifiableSet(result);
} | java | public Set<Region> getContainedRegions(RegionType type) {
loadRegionData();
Set<Region> result = new TreeSet<Region>();
Set<Region> cr = getContainedRegions();
for ( Region r : cr ) {
if ( r.getType() == type ) {
result.add(r);
} else {
result.addAll(r.getContainedRegions(type));
}
}
return Collections.unmodifiableSet(result);
} | [
"public",
"Set",
"<",
"Region",
">",
"getContainedRegions",
"(",
"RegionType",
"type",
")",
"{",
"loadRegionData",
"(",
")",
";",
"Set",
"<",
"Region",
">",
"result",
"=",
"new",
"TreeSet",
"<",
"Region",
">",
"(",
")",
";",
"Set",
"<",
"Region",
">",
... | Used to determine all the regions that are contained within this region and that match the given type
@return An unmodifiable set containing all the regions that are children of this region
anywhere in the region hierarchy and match the given type. This API may return an empty set
if this region doesn't have any sub-regions that match the given type.
For example, calling this method with region "150" (Europe) and type "TERRITORY" returns a set
containing all the territories in Europe ( "FR" (France) - "IT" (Italy) - "DE" (Germany) etc. ) | [
"Used",
"to",
"determine",
"all",
"the",
"regions",
"that",
"are",
"contained",
"within",
"this",
"region",
"and",
"that",
"match",
"the",
"given",
"type"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Region.java#L494-L509 |
34,593 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DOMConfigurationImpl.java | DOMConfigurationImpl.isValid | private boolean isValid(CharSequence text) {
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
// as defined by http://www.w3.org/TR/REC-xml/#charsets.
boolean valid = c == 0x9 || c == 0xA || c == 0xD
|| (c >= 0x20 && c <= 0xd7ff)
|| (c >= 0xe000 && c <= 0xfffd);
if (!valid) {
return false;
}
}
return true;
} | java | private boolean isValid(CharSequence text) {
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
// as defined by http://www.w3.org/TR/REC-xml/#charsets.
boolean valid = c == 0x9 || c == 0xA || c == 0xD
|| (c >= 0x20 && c <= 0xd7ff)
|| (c >= 0xe000 && c <= 0xfffd);
if (!valid) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"isValid",
"(",
"CharSequence",
"text",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"text",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"text",
".",
"charAt",
"(",
"i",
")",
";",
"... | Returns true if all of the characters in the text are permitted for use
in XML documents. | [
"Returns",
"true",
"if",
"all",
"of",
"the",
"characters",
"in",
"the",
"text",
"are",
"permitted",
"for",
"use",
"in",
"XML",
"documents",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DOMConfigurationImpl.java#L469-L481 |
34,594 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java | MessageDigest.digest | public int digest(byte[] buf, int offset, int len) throws DigestException {
if (buf == null) {
throw new IllegalArgumentException("No output buffer given");
}
if (buf.length - offset < len) {
throw new IllegalArgumentException
("Output buffer too small for specified offset and length");
}
int numBytes = engineDigest(buf, offset, len);
state = INITIAL;
return numBytes;
} | java | public int digest(byte[] buf, int offset, int len) throws DigestException {
if (buf == null) {
throw new IllegalArgumentException("No output buffer given");
}
if (buf.length - offset < len) {
throw new IllegalArgumentException
("Output buffer too small for specified offset and length");
}
int numBytes = engineDigest(buf, offset, len);
state = INITIAL;
return numBytes;
} | [
"public",
"int",
"digest",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"DigestException",
"{",
"if",
"(",
"buf",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No output buffer given\"",
... | Completes the hash computation by performing final operations
such as padding. The digest is reset after this call is made.
@param buf output buffer for the computed digest
@param offset offset into the output buffer to begin storing the digest
@param len number of bytes within buf allotted for the digest
@return the number of bytes placed into {@code buf}
@exception DigestException if an error occurs. | [
"Completes",
"the",
"hash",
"computation",
"by",
"performing",
"final",
"operations",
"such",
"as",
"padding",
".",
"The",
"digest",
"is",
"reset",
"after",
"this",
"call",
"is",
"made",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java#L419-L430 |
34,595 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java | MessageDigest.isEqual | public static boolean isEqual(byte[] digesta, byte[] digestb) {
if (digesta == digestb) return true;
if (digesta == null || digestb == null) {
return false;
}
if (digesta.length != digestb.length) {
return false;
}
int result = 0;
// time-constant comparison
for (int i = 0; i < digesta.length; i++) {
result |= digesta[i] ^ digestb[i];
}
return result == 0;
} | java | public static boolean isEqual(byte[] digesta, byte[] digestb) {
if (digesta == digestb) return true;
if (digesta == null || digestb == null) {
return false;
}
if (digesta.length != digestb.length) {
return false;
}
int result = 0;
// time-constant comparison
for (int i = 0; i < digesta.length; i++) {
result |= digesta[i] ^ digestb[i];
}
return result == 0;
} | [
"public",
"static",
"boolean",
"isEqual",
"(",
"byte",
"[",
"]",
"digesta",
",",
"byte",
"[",
"]",
"digestb",
")",
"{",
"if",
"(",
"digesta",
"==",
"digestb",
")",
"return",
"true",
";",
"if",
"(",
"digesta",
"==",
"null",
"||",
"digestb",
"==",
"nul... | Compares two digests for equality. Does a simple byte compare.
@param digesta one of the digests to compare.
@param digestb the other digest to compare.
@return true if the digests are equal, false otherwise. | [
"Compares",
"two",
"digests",
"for",
"equality",
".",
"Does",
"a",
"simple",
"byte",
"compare",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java#L480-L495 |
34,596 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java | MessageDigest.getDigestLength | public final int getDigestLength() {
int digestLen = engineGetDigestLength();
if (digestLen == 0) {
try {
MessageDigest md = (MessageDigest)clone();
byte[] digest = md.digest();
return digest.length;
} catch (CloneNotSupportedException e) {
return digestLen;
}
}
return digestLen;
} | java | public final int getDigestLength() {
int digestLen = engineGetDigestLength();
if (digestLen == 0) {
try {
MessageDigest md = (MessageDigest)clone();
byte[] digest = md.digest();
return digest.length;
} catch (CloneNotSupportedException e) {
return digestLen;
}
}
return digestLen;
} | [
"public",
"final",
"int",
"getDigestLength",
"(",
")",
"{",
"int",
"digestLen",
"=",
"engineGetDigestLength",
"(",
")",
";",
"if",
"(",
"digestLen",
"==",
"0",
")",
"{",
"try",
"{",
"MessageDigest",
"md",
"=",
"(",
"MessageDigest",
")",
"clone",
"(",
")"... | Returns the length of the digest in bytes, or 0 if this operation is
not supported by the provider and the implementation is not cloneable.
@return the digest length in bytes, or 0 if this operation is not
supported by the provider and the implementation is not cloneable.
@since 1.2 | [
"Returns",
"the",
"length",
"of",
"the",
"digest",
"in",
"bytes",
"or",
"0",
"if",
"this",
"operation",
"is",
"not",
"supported",
"by",
"the",
"provider",
"and",
"the",
"implementation",
"is",
"not",
"cloneable",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java#L529-L541 |
34,597 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java | MessageFormat.toPattern | public String toPattern() {
// later, make this more extensible
int lastOffset = 0;
StringBuilder result = new StringBuilder();
for (int i = 0; i <= maxOffset; ++i) {
copyAndFixQuotes(pattern, lastOffset, offsets[i], result);
lastOffset = offsets[i];
result.append('{').append(argumentNumbers[i]);
Format fmt = formats[i];
if (fmt == null) {
// do nothing, string format
} else if (fmt instanceof NumberFormat) {
if (fmt.equals(NumberFormat.getInstance(locale))) {
result.append(",number");
} else if (fmt.equals(NumberFormat.getCurrencyInstance(locale))) {
result.append(",number,currency");
} else if (fmt.equals(NumberFormat.getPercentInstance(locale))) {
result.append(",number,percent");
} else if (fmt.equals(NumberFormat.getIntegerInstance(locale))) {
result.append(",number,integer");
} else {
if (fmt instanceof DecimalFormat) {
result.append(",number,").append(((DecimalFormat)fmt).toPattern());
} else if (fmt instanceof ChoiceFormat) {
result.append(",choice,").append(((ChoiceFormat)fmt).toPattern());
} else {
// UNKNOWN
}
}
} else if (fmt instanceof DateFormat) {
int index;
for (index = MODIFIER_DEFAULT; index < DATE_TIME_MODIFIERS.length; index++) {
DateFormat df = DateFormat.getDateInstance(DATE_TIME_MODIFIERS[index],
locale);
if (fmt.equals(df)) {
result.append(",date");
break;
}
df = DateFormat.getTimeInstance(DATE_TIME_MODIFIERS[index],
locale);
if (fmt.equals(df)) {
result.append(",time");
break;
}
}
if (index >= DATE_TIME_MODIFIERS.length) {
if (fmt instanceof SimpleDateFormat) {
result.append(",date,").append(((SimpleDateFormat)fmt).toPattern());
} else {
// UNKNOWN
}
} else if (index != MODIFIER_DEFAULT) {
result.append(',').append(DATE_TIME_MODIFIER_KEYWORDS[index]);
}
} else {
//result.append(", unknown");
}
result.append('}');
}
copyAndFixQuotes(pattern, lastOffset, pattern.length(), result);
return result.toString();
} | java | public String toPattern() {
// later, make this more extensible
int lastOffset = 0;
StringBuilder result = new StringBuilder();
for (int i = 0; i <= maxOffset; ++i) {
copyAndFixQuotes(pattern, lastOffset, offsets[i], result);
lastOffset = offsets[i];
result.append('{').append(argumentNumbers[i]);
Format fmt = formats[i];
if (fmt == null) {
// do nothing, string format
} else if (fmt instanceof NumberFormat) {
if (fmt.equals(NumberFormat.getInstance(locale))) {
result.append(",number");
} else if (fmt.equals(NumberFormat.getCurrencyInstance(locale))) {
result.append(",number,currency");
} else if (fmt.equals(NumberFormat.getPercentInstance(locale))) {
result.append(",number,percent");
} else if (fmt.equals(NumberFormat.getIntegerInstance(locale))) {
result.append(",number,integer");
} else {
if (fmt instanceof DecimalFormat) {
result.append(",number,").append(((DecimalFormat)fmt).toPattern());
} else if (fmt instanceof ChoiceFormat) {
result.append(",choice,").append(((ChoiceFormat)fmt).toPattern());
} else {
// UNKNOWN
}
}
} else if (fmt instanceof DateFormat) {
int index;
for (index = MODIFIER_DEFAULT; index < DATE_TIME_MODIFIERS.length; index++) {
DateFormat df = DateFormat.getDateInstance(DATE_TIME_MODIFIERS[index],
locale);
if (fmt.equals(df)) {
result.append(",date");
break;
}
df = DateFormat.getTimeInstance(DATE_TIME_MODIFIERS[index],
locale);
if (fmt.equals(df)) {
result.append(",time");
break;
}
}
if (index >= DATE_TIME_MODIFIERS.length) {
if (fmt instanceof SimpleDateFormat) {
result.append(",date,").append(((SimpleDateFormat)fmt).toPattern());
} else {
// UNKNOWN
}
} else if (index != MODIFIER_DEFAULT) {
result.append(',').append(DATE_TIME_MODIFIER_KEYWORDS[index]);
}
} else {
//result.append(", unknown");
}
result.append('}');
}
copyAndFixQuotes(pattern, lastOffset, pattern.length(), result);
return result.toString();
} | [
"public",
"String",
"toPattern",
"(",
")",
"{",
"// later, make this more extensible",
"int",
"lastOffset",
"=",
"0",
";",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"maxOffset",
... | Returns a pattern representing the current state of the message format.
The string is constructed from internal information and therefore
does not necessarily equal the previously applied pattern.
@return a pattern representing the current state of the message format | [
"Returns",
"a",
"pattern",
"representing",
"the",
"current",
"state",
"of",
"the",
"message",
"format",
".",
"The",
"string",
"is",
"constructed",
"from",
"internal",
"information",
"and",
"therefore",
"does",
"not",
"necessarily",
"equal",
"the",
"previously",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java#L522-L583 |
34,598 | google/j2objc | cycle_finder/src/main/java/com/google/devtools/cyclefinder/NameUtil.java | NameUtil.getSignature | public String getSignature(TypeMirror type) {
StringBuilder sb = new StringBuilder();
buildTypeSignature(type, sb);
return sb.toString();
} | java | public String getSignature(TypeMirror type) {
StringBuilder sb = new StringBuilder();
buildTypeSignature(type, sb);
return sb.toString();
} | [
"public",
"String",
"getSignature",
"(",
"TypeMirror",
"type",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buildTypeSignature",
"(",
"type",
",",
"sb",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Generates a unique signature for this type that can be used as a key. | [
"Generates",
"a",
"unique",
"signature",
"for",
"this",
"type",
"that",
"can",
"be",
"used",
"as",
"a",
"key",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/cycle_finder/src/main/java/com/google/devtools/cyclefinder/NameUtil.java#L58-L62 |
34,599 | google/j2objc | cycle_finder/src/main/java/com/google/devtools/cyclefinder/NameUtil.java | NameUtil.getName | public static String getName(TypeMirror type) {
StringBuilder sb = new StringBuilder();
buildTypeName(type, sb);
return sb.toString();
} | java | public static String getName(TypeMirror type) {
StringBuilder sb = new StringBuilder();
buildTypeName(type, sb);
return sb.toString();
} | [
"public",
"static",
"String",
"getName",
"(",
"TypeMirror",
"type",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buildTypeName",
"(",
"type",
",",
"sb",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Generates a readable name for this type. | [
"Generates",
"a",
"readable",
"name",
"for",
"this",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/cycle_finder/src/main/java/com/google/devtools/cyclefinder/NameUtil.java#L187-L191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.