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,100
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.valuesMatch
private final static boolean valuesMatch(Object value1, Object value2) { if (value1 == null) { return value2 == null; } else { return value1.equals(value2); } }
java
private final static boolean valuesMatch(Object value1, Object value2) { if (value1 == null) { return value2 == null; } else { return value1.equals(value2); } }
[ "private", "final", "static", "boolean", "valuesMatch", "(", "Object", "value1", ",", "Object", "value2", ")", "{", "if", "(", "value1", "==", "null", ")", "{", "return", "value2", "==", "null", ";", "}", "else", "{", "return", "value1", ".", "equals", ...
returns whether the two objects are either both null or equal
[ "returns", "whether", "the", "two", "objects", "are", "either", "both", "null", "or", "equal" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L665-L671
34,101
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.appendContents
private final void appendContents(StringBuffer buf, CharacterIterator iterator) { int index = iterator.getBeginIndex(); int end = iterator.getEndIndex(); while (index < end) { iterator.setIndex(index++); buf.append(iterator.current()); } }
java
private final void appendContents(StringBuffer buf, CharacterIterator iterator) { int index = iterator.getBeginIndex(); int end = iterator.getEndIndex(); while (index < end) { iterator.setIndex(index++); buf.append(iterator.current()); } }
[ "private", "final", "void", "appendContents", "(", "StringBuffer", "buf", ",", "CharacterIterator", "iterator", ")", "{", "int", "index", "=", "iterator", ".", "getBeginIndex", "(", ")", ";", "int", "end", "=", "iterator", ".", "getEndIndex", "(", ")", ";", ...
Appends the contents of the CharacterIterator iterator into the StringBuffer buf.
[ "Appends", "the", "contents", "of", "the", "CharacterIterator", "iterator", "into", "the", "StringBuffer", "buf", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L677-L686
34,102
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.mapsDiffer
private static boolean mapsDiffer(Map last, Map attrs) { if (last == null) { return (attrs != null && attrs.size() > 0); } return (!last.equals(attrs)); }
java
private static boolean mapsDiffer(Map last, Map attrs) { if (last == null) { return (attrs != null && attrs.size() > 0); } return (!last.equals(attrs)); }
[ "private", "static", "boolean", "mapsDiffer", "(", "Map", "last", ",", "Map", "attrs", ")", "{", "if", "(", "last", "==", "null", ")", "{", "return", "(", "attrs", "!=", "null", "&&", "attrs", ".", "size", "(", ")", ">", "0", ")", ";", "}", "retu...
Returns true if the attributes specified in last and attrs differ.
[ "Returns", "true", "if", "the", "attributes", "specified", "in", "last", "and", "attrs", "differ", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L720-L725
34,103
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.nextAfter
public static double nextAfter(double start, double direction) { /* * The cases: * * nextAfter(+infinity, 0) == MAX_VALUE * nextAfter(+infinity, +infinity) == +infinity * nextAfter(-infinity, 0) == -MAX_VALUE * nextAfter(-infinity, -infinity) == -infinity * * are naturally handled without any additional testing */ // First check for NaN values if (Double.isNaN(start) || Double.isNaN(direction)) { // return a NaN derived from the input NaN(s) return start + direction; } else if (start == direction) { return direction; } else { // start > direction or start < direction // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0) // then bitwise convert start to integer. long transducer = Double.doubleToRawLongBits(start + 0.0d); /* * IEEE 754 floating-point numbers are lexicographically * ordered if treated as signed- magnitude integers . * Since Java's integers are two's complement, * incrementing" the two's complement representation of a * logically negative floating-point value *decrements* * the signed-magnitude representation. Therefore, when * the integer representation of a floating-point values * is less than zero, the adjustment to the representation * is in the opposite direction than would be expected at * first . */ if (direction > start) { // Calculate next greater value transducer = transducer + (transducer >= 0L ? 1L:-1L); } else { // Calculate next lesser value assert direction < start; if (transducer > 0L) --transducer; else if (transducer < 0L ) ++transducer; /* * transducer==0, the result is -MIN_VALUE * * The transition from zero (implicitly * positive) to the smallest negative * signed magnitude value must be done * explicitly. */ else transducer = DoubleConsts.SIGN_BIT_MASK | 1L; } return Double.longBitsToDouble(transducer); } }
java
public static double nextAfter(double start, double direction) { /* * The cases: * * nextAfter(+infinity, 0) == MAX_VALUE * nextAfter(+infinity, +infinity) == +infinity * nextAfter(-infinity, 0) == -MAX_VALUE * nextAfter(-infinity, -infinity) == -infinity * * are naturally handled without any additional testing */ // First check for NaN values if (Double.isNaN(start) || Double.isNaN(direction)) { // return a NaN derived from the input NaN(s) return start + direction; } else if (start == direction) { return direction; } else { // start > direction or start < direction // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0) // then bitwise convert start to integer. long transducer = Double.doubleToRawLongBits(start + 0.0d); /* * IEEE 754 floating-point numbers are lexicographically * ordered if treated as signed- magnitude integers . * Since Java's integers are two's complement, * incrementing" the two's complement representation of a * logically negative floating-point value *decrements* * the signed-magnitude representation. Therefore, when * the integer representation of a floating-point values * is less than zero, the adjustment to the representation * is in the opposite direction than would be expected at * first . */ if (direction > start) { // Calculate next greater value transducer = transducer + (transducer >= 0L ? 1L:-1L); } else { // Calculate next lesser value assert direction < start; if (transducer > 0L) --transducer; else if (transducer < 0L ) ++transducer; /* * transducer==0, the result is -MIN_VALUE * * The transition from zero (implicitly * positive) to the smallest negative * signed magnitude value must be done * explicitly. */ else transducer = DoubleConsts.SIGN_BIT_MASK | 1L; } return Double.longBitsToDouble(transducer); } }
[ "public", "static", "double", "nextAfter", "(", "double", "start", ",", "double", "direction", ")", "{", "/*\n * The cases:\n *\n * nextAfter(+infinity, 0) == MAX_VALUE\n * nextAfter(+infinity, +infinity) == +infinity\n * nextAfter(-infinity, 0) == ...
Returns the floating-point number adjacent to the first argument in the direction of the second argument. If both arguments compare as equal the second argument is returned. <p> Special cases: <ul> <li> If either argument is a NaN, then NaN is returned. <li> If both arguments are signed zeros, {@code direction} is returned unchanged (as implied by the requirement of returning the second argument if the arguments compare as equal). <li> If {@code start} is &plusmn;{@link Double#MIN_VALUE} and {@code direction} has a value such that the result should have a smaller magnitude, then a zero with the same sign as {@code start} is returned. <li> If {@code start} is infinite and {@code direction} has a value such that the result should have a smaller magnitude, {@link Double#MAX_VALUE} with the same sign as {@code start} is returned. <li> If {@code start} is equal to &plusmn; {@link Double#MAX_VALUE} and {@code direction} has a value such that the result should have a larger magnitude, an infinity with same sign as {@code start} is returned. </ul> @param start starting floating-point value @param direction value indicating which of {@code start}'s neighbors or {@code start} should be returned @return The floating-point number adjacent to {@code start} in the direction of {@code direction}. @since 1.6
[ "Returns", "the", "floating", "-", "point", "number", "adjacent", "to", "the", "first", "argument", "in", "the", "direction", "of", "the", "second", "argument", ".", "If", "both", "arguments", "compare", "as", "equal", "the", "second", "argument", "is", "ret...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1889-L1947
34,104
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.nextAfter
public static float nextAfter(float start, double direction) { /* * The cases: * * nextAfter(+infinity, 0) == MAX_VALUE * nextAfter(+infinity, +infinity) == +infinity * nextAfter(-infinity, 0) == -MAX_VALUE * nextAfter(-infinity, -infinity) == -infinity * * are naturally handled without any additional testing */ // First check for NaN values if (Float.isNaN(start) || Double.isNaN(direction)) { // return a NaN derived from the input NaN(s) return start + (float)direction; } else if (start == direction) { return (float)direction; } else { // start > direction or start < direction // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0) // then bitwise convert start to integer. int transducer = Float.floatToRawIntBits(start + 0.0f); /* * IEEE 754 floating-point numbers are lexicographically * ordered if treated as signed- magnitude integers . * Since Java's integers are two's complement, * incrementing" the two's complement representation of a * logically negative floating-point value *decrements* * the signed-magnitude representation. Therefore, when * the integer representation of a floating-point values * is less than zero, the adjustment to the representation * is in the opposite direction than would be expected at * first. */ if (direction > start) {// Calculate next greater value transducer = transducer + (transducer >= 0 ? 1:-1); } else { // Calculate next lesser value assert direction < start; if (transducer > 0) --transducer; else if (transducer < 0 ) ++transducer; /* * transducer==0, the result is -MIN_VALUE * * The transition from zero (implicitly * positive) to the smallest negative * signed magnitude value must be done * explicitly. */ else transducer = FloatConsts.SIGN_BIT_MASK | 1; } return Float.intBitsToFloat(transducer); } }
java
public static float nextAfter(float start, double direction) { /* * The cases: * * nextAfter(+infinity, 0) == MAX_VALUE * nextAfter(+infinity, +infinity) == +infinity * nextAfter(-infinity, 0) == -MAX_VALUE * nextAfter(-infinity, -infinity) == -infinity * * are naturally handled without any additional testing */ // First check for NaN values if (Float.isNaN(start) || Double.isNaN(direction)) { // return a NaN derived from the input NaN(s) return start + (float)direction; } else if (start == direction) { return (float)direction; } else { // start > direction or start < direction // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0) // then bitwise convert start to integer. int transducer = Float.floatToRawIntBits(start + 0.0f); /* * IEEE 754 floating-point numbers are lexicographically * ordered if treated as signed- magnitude integers . * Since Java's integers are two's complement, * incrementing" the two's complement representation of a * logically negative floating-point value *decrements* * the signed-magnitude representation. Therefore, when * the integer representation of a floating-point values * is less than zero, the adjustment to the representation * is in the opposite direction than would be expected at * first. */ if (direction > start) {// Calculate next greater value transducer = transducer + (transducer >= 0 ? 1:-1); } else { // Calculate next lesser value assert direction < start; if (transducer > 0) --transducer; else if (transducer < 0 ) ++transducer; /* * transducer==0, the result is -MIN_VALUE * * The transition from zero (implicitly * positive) to the smallest negative * signed magnitude value must be done * explicitly. */ else transducer = FloatConsts.SIGN_BIT_MASK | 1; } return Float.intBitsToFloat(transducer); } }
[ "public", "static", "float", "nextAfter", "(", "float", "start", ",", "double", "direction", ")", "{", "/*\n * The cases:\n *\n * nextAfter(+infinity, 0) == MAX_VALUE\n * nextAfter(+infinity, +infinity) == +infinity\n * nextAfter(-infinity, 0) == -M...
Returns the floating-point number adjacent to the first argument in the direction of the second argument. If both arguments compare as equal a value equivalent to the second argument is returned. <p> Special cases: <ul> <li> If either argument is a NaN, then NaN is returned. <li> If both arguments are signed zeros, a value equivalent to {@code direction} is returned. <li> If {@code start} is &plusmn;{@link Float#MIN_VALUE} and {@code direction} has a value such that the result should have a smaller magnitude, then a zero with the same sign as {@code start} is returned. <li> If {@code start} is infinite and {@code direction} has a value such that the result should have a smaller magnitude, {@link Float#MAX_VALUE} with the same sign as {@code start} is returned. <li> If {@code start} is equal to &plusmn; {@link Float#MAX_VALUE} and {@code direction} has a value such that the result should have a larger magnitude, an infinity with same sign as {@code start} is returned. </ul> @param start starting floating-point value @param direction value indicating which of {@code start}'s neighbors or {@code start} should be returned @return The floating-point number adjacent to {@code start} in the direction of {@code direction}. @since 1.6
[ "Returns", "the", "floating", "-", "point", "number", "adjacent", "to", "the", "first", "argument", "in", "the", "direction", "of", "the", "second", "argument", ".", "If", "both", "arguments", "compare", "as", "equal", "a", "value", "equivalent", "to", "the"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1988-L2046
34,105
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableString.java
ReplaceableString.replace
public void replace(int start, int limit, char[] chars, int charsStart, int charsLen) { buf.delete(start, limit); buf.insert(start, chars, charsStart, charsLen); }
java
public void replace(int start, int limit, char[] chars, int charsStart, int charsLen) { buf.delete(start, limit); buf.insert(start, chars, charsStart, charsLen); }
[ "public", "void", "replace", "(", "int", "start", ",", "int", "limit", ",", "char", "[", "]", "chars", ",", "int", "charsStart", ",", "int", "charsLen", ")", "{", "buf", ".", "delete", "(", "start", ",", "limit", ")", ";", "buf", ".", "insert", "("...
Replace a substring of this object with the given text. @param start the beginning index, inclusive; <code>0 &lt;= start &lt;= limit</code>. @param limit the ending index, exclusive; <code>start &lt;= limit &lt;= length()</code>. @param chars the text to replace characters <code>start</code> to <code>limit - 1</code> @param charsStart the beginning index into <code>chars</code>, inclusive; <code>0 &lt;= start &lt;= limit</code>. @param charsLen the number of characters of <code>chars</code>.
[ "Replace", "a", "substring", "of", "this", "object", "with", "the", "given", "text", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableString.java#L152-L156
34,106
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeNode.java
TreeNode.validate
public final void validate() { this.accept(new TreeVisitor() { @Override public boolean preVisit(TreeNode node) { node.validateInner(); return true; } }); }
java
public final void validate() { this.accept(new TreeVisitor() { @Override public boolean preVisit(TreeNode node) { node.validateInner(); return true; } }); }
[ "public", "final", "void", "validate", "(", ")", "{", "this", ".", "accept", "(", "new", "TreeVisitor", "(", ")", "{", "@", "Override", "public", "boolean", "preVisit", "(", "TreeNode", "node", ")", "{", "node", ".", "validateInner", "(", ")", ";", "re...
Validates the tree to preemptively catch errors.
[ "Validates", "the", "tree", "to", "preemptively", "catch", "errors", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeNode.java#L103-L111
34,107
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/Collator.java
Collator.compare
public int compare(Object object1, Object object2) { return compare((String) object1, (String) object2); }
java
public int compare(Object object1, Object object2) { return compare((String) object1, (String) object2); }
[ "public", "int", "compare", "(", "Object", "object1", ",", "Object", "object2", ")", "{", "return", "compare", "(", "(", "String", ")", "object1", ",", "(", "String", ")", "object2", ")", ";", "}" ]
Compares two objects to determine their relative order. The objects must be strings. @param object1 the first string to compare. @param object2 the second string to compare. @return a negative value if {@code object1} is less than {@code object2}, 0 if they are equal, and a positive value if {@code object1} is greater than {@code object2}. @throws ClassCastException if {@code object1} or {@code object2} is not a {@code String}.
[ "Compares", "two", "objects", "to", "determine", "their", "relative", "order", ".", "The", "objects", "must", "be", "strings", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/Collator.java#L160-L162
34,108
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/QName.java
QName.getQNameFromString
public static QName getQNameFromString(String name) { StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); QName qname; String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) qname = new QName(null, s1); else qname = new QName(s1, s2); return qname; }
java
public static QName getQNameFromString(String name) { StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); QName qname; String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) qname = new QName(null, s1); else qname = new QName(s1, s2); return qname; }
[ "public", "static", "QName", "getQNameFromString", "(", "String", "name", ")", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "name", ",", "\"{}\"", ",", "false", ")", ";", "QName", "qname", ";", "String", "s1", "=", "tokenizer", "....
Given a string, create and return a QName object @param name String to use to create QName @return a QName object
[ "Given", "a", "string", "create", "and", "return", "a", "QName", "object" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/QName.java#L632-L646
34,109
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/QName.java
QName.getPrefixFromXMLNSDecl
public static String getPrefixFromXMLNSDecl(String attRawName) { int index = attRawName.indexOf(':'); return (index >= 0) ? attRawName.substring(index + 1) : ""; }
java
public static String getPrefixFromXMLNSDecl(String attRawName) { int index = attRawName.indexOf(':'); return (index >= 0) ? attRawName.substring(index + 1) : ""; }
[ "public", "static", "String", "getPrefixFromXMLNSDecl", "(", "String", "attRawName", ")", "{", "int", "index", "=", "attRawName", ".", "indexOf", "(", "'", "'", ")", ";", "return", "(", "index", ">=", "0", ")", "?", "attRawName", ".", "substring", "(", "...
This function tells if a raw attribute name is a xmlns attribute. @param attRawName Raw name of attribute @return Prefix of attribute
[ "This", "function", "tells", "if", "a", "raw", "attribute", "name", "is", "a", "xmlns", "attribute", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/QName.java#L672-L678
34,110
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java
DecimalStyle.convertNumberToI18N
String convertNumberToI18N(String numericText) { if (zeroDigit == '0') { return numericText; } int diff = zeroDigit - '0'; char[] array = numericText.toCharArray(); for (int i = 0; i < array.length; i++) { array[i] = (char) (array[i] + diff); } return new String(array); }
java
String convertNumberToI18N(String numericText) { if (zeroDigit == '0') { return numericText; } int diff = zeroDigit - '0'; char[] array = numericText.toCharArray(); for (int i = 0; i < array.length; i++) { array[i] = (char) (array[i] + diff); } return new String(array); }
[ "String", "convertNumberToI18N", "(", "String", "numericText", ")", "{", "if", "(", "zeroDigit", "==", "'", "'", ")", "{", "return", "numericText", ";", "}", "int", "diff", "=", "zeroDigit", "-", "'", "'", ";", "char", "[", "]", "array", "=", "numericT...
Converts the input numeric text to the internationalized form using the zero character. @param numericText the text, consisting of digits 0 to 9, to convert, not null @return the internationalized text, not null
[ "Converts", "the", "input", "numeric", "text", "to", "the", "internationalized", "form", "using", "the", "zero", "character", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java#L328-L338
34,111
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.checkReadPrimitiveTypes
private void checkReadPrimitiveTypes() throws IOException { // If we still have primitive data, it is ok to read primitive data if (primitiveData == input || primitiveData.available() > 0) { return; } // If we got here either we had no Stream previously created or // we no longer have data in that one, so get more bytes do { int next = 0; if (hasPushbackTC) { hasPushbackTC = false; } else { next = input.read(); pushbackTC = (byte) next; } switch (pushbackTC) { case TC_BLOCKDATA: primitiveData = new ByteArrayInputStream(readBlockData()); return; case TC_BLOCKDATALONG: primitiveData = new ByteArrayInputStream(readBlockDataLong()); return; case TC_RESET: resetState(); break; default: if (next != -1) { pushbackTC(); } return; } // Only TC_RESET falls through } while (true); }
java
private void checkReadPrimitiveTypes() throws IOException { // If we still have primitive data, it is ok to read primitive data if (primitiveData == input || primitiveData.available() > 0) { return; } // If we got here either we had no Stream previously created or // we no longer have data in that one, so get more bytes do { int next = 0; if (hasPushbackTC) { hasPushbackTC = false; } else { next = input.read(); pushbackTC = (byte) next; } switch (pushbackTC) { case TC_BLOCKDATA: primitiveData = new ByteArrayInputStream(readBlockData()); return; case TC_BLOCKDATALONG: primitiveData = new ByteArrayInputStream(readBlockDataLong()); return; case TC_RESET: resetState(); break; default: if (next != -1) { pushbackTC(); } return; } // Only TC_RESET falls through } while (true); }
[ "private", "void", "checkReadPrimitiveTypes", "(", ")", "throws", "IOException", "{", "// If we still have primitive data, it is ok to read primitive data", "if", "(", "primitiveData", "==", "input", "||", "primitiveData", ".", "available", "(", ")", ">", "0", ")", "{",...
Checks to if it is ok to read primitive types from this stream at this point. One is not supposed to read primitive types when about to read an object, for example, so an exception has to be thrown. @throws IOException If any IO problem occurred when trying to read primitive type or if it is illegal to read primitive types
[ "Checks", "to", "if", "it", "is", "ok", "to", "read", "primitive", "types", "from", "this", "stream", "at", "this", "point", ".", "One", "is", "not", "supposed", "to", "read", "primitive", "types", "when", "about", "to", "read", "an", "object", "for", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L394-L428
34,112
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.defaultReadObject
public void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException { if (currentObject != null || !mustResolve) { readFieldValues(currentObject, currentClass); } else { throw new NotActiveException(); } }
java
public void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException { if (currentObject != null || !mustResolve) { readFieldValues(currentObject, currentClass); } else { throw new NotActiveException(); } }
[ "public", "void", "defaultReadObject", "(", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "NotActiveException", "{", "if", "(", "currentObject", "!=", "null", "||", "!", "mustResolve", ")", "{", "readFieldValues", "(", "currentObject", ",", "cu...
Default method to read objects from this stream. Serializable fields defined in the object's class and superclasses are read from the source stream. @throws ClassNotFoundException if the object's class cannot be found. @throws IOException if an I/O error occurs while reading the object data. @throws NotActiveException if this method is not called from {@code readObject()}. @see ObjectOutputStream#defaultWriteObject
[ "Default", "method", "to", "read", "objects", "from", "this", "stream", ".", "Serializable", "fields", "defined", "in", "the", "object", "s", "class", "and", "superclasses", "are", "read", "from", "the", "source", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L454-L461
34,113
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.discardData
private void discardData() throws ClassNotFoundException, IOException { primitiveData = emptyStream; boolean resolve = mustResolve; mustResolve = false; do { byte tc = nextTC(); if (tc == TC_ENDBLOCKDATA) { mustResolve = resolve; return; // End of annotation } readContent(tc); } while (true); }
java
private void discardData() throws ClassNotFoundException, IOException { primitiveData = emptyStream; boolean resolve = mustResolve; mustResolve = false; do { byte tc = nextTC(); if (tc == TC_ENDBLOCKDATA) { mustResolve = resolve; return; // End of annotation } readContent(tc); } while (true); }
[ "private", "void", "discardData", "(", ")", "throws", "ClassNotFoundException", ",", "IOException", "{", "primitiveData", "=", "emptyStream", ";", "boolean", "resolve", "=", "mustResolve", ";", "mustResolve", "=", "false", ";", "do", "{", "byte", "tc", "=", "n...
Reads and discards block data and objects until TC_ENDBLOCKDATA is found. @throws IOException If an IO exception happened when reading the optional class annotation. @throws ClassNotFoundException If the class corresponding to the class descriptor could not be found.
[ "Reads", "and", "discards", "block", "data", "and", "objects", "until", "TC_ENDBLOCKDATA", "is", "found", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L654-L666
34,114
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.readFields
public GetField readFields() throws IOException, ClassNotFoundException, NotActiveException { if (currentObject == null) { throw new NotActiveException(); } EmulatedFieldsForLoading result = new EmulatedFieldsForLoading(currentClass); readFieldValues(result); return result; }
java
public GetField readFields() throws IOException, ClassNotFoundException, NotActiveException { if (currentObject == null) { throw new NotActiveException(); } EmulatedFieldsForLoading result = new EmulatedFieldsForLoading(currentClass); readFieldValues(result); return result; }
[ "public", "GetField", "readFields", "(", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "NotActiveException", "{", "if", "(", "currentObject", "==", "null", ")", "{", "throw", "new", "NotActiveException", "(", ")", ";", "}", "EmulatedFieldsForLo...
Reads the persistent fields of the object that is currently being read from the source stream. The values read are stored in a GetField object that provides access to the persistent fields. This GetField object is then returned. @return the GetField object from which persistent fields can be accessed by name. @throws ClassNotFoundException if the class of an object being deserialized can not be found. @throws IOException if an error occurs while reading from this stream. @throws NotActiveException if this stream is currently not reading an object.
[ "Reads", "the", "persistent", "fields", "of", "the", "object", "that", "is", "currently", "being", "read", "from", "the", "source", "stream", ".", "The", "values", "read", "are", "stored", "in", "a", "GetField", "object", "that", "provides", "access", "to", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L992-L999
34,115
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.readClassDescriptor
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass newClassDesc = new ObjectStreamClass(); String name = input.readUTF(); if (name.length() == 0) { throw new IOException("The stream is corrupted"); } newClassDesc.setName(name); newClassDesc.setSerialVersionUID(input.readLong()); newClassDesc.setFlags(input.readByte()); /* * We must register the class descriptor before reading field * descriptors. If called outside of readObject, the descriptorHandle * might be unset. */ if (descriptorHandle == -1) { descriptorHandle = nextHandle(); } registerObjectRead(newClassDesc, descriptorHandle, false); readFieldDescriptors(newClassDesc); return newClassDesc; }
java
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { ObjectStreamClass newClassDesc = new ObjectStreamClass(); String name = input.readUTF(); if (name.length() == 0) { throw new IOException("The stream is corrupted"); } newClassDesc.setName(name); newClassDesc.setSerialVersionUID(input.readLong()); newClassDesc.setFlags(input.readByte()); /* * We must register the class descriptor before reading field * descriptors. If called outside of readObject, the descriptorHandle * might be unset. */ if (descriptorHandle == -1) { descriptorHandle = nextHandle(); } registerObjectRead(newClassDesc, descriptorHandle, false); readFieldDescriptors(newClassDesc); return newClassDesc; }
[ "protected", "ObjectStreamClass", "readClassDescriptor", "(", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "ObjectStreamClass", "newClassDesc", "=", "new", "ObjectStreamClass", "(", ")", ";", "String", "name", "=", "input", ".", "readUTF", "(", ...
Reads a class descriptor from the source stream. @return the class descriptor read from the source stream. @throws ClassNotFoundException if a class for one of the objects cannot be found. @throws IOException if an error occurs while reading from the source stream.
[ "Reads", "a", "class", "descriptor", "from", "the", "source", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L1727-L1749
34,116
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.readNewLongString
private Object readNewLongString(boolean unshared) throws IOException { long length = input.readLong(); Object result = input.decodeUTF((int) length); if (enableResolve) { result = resolveObject(result); } registerObjectRead(result, nextHandle(), unshared); return result; }
java
private Object readNewLongString(boolean unshared) throws IOException { long length = input.readLong(); Object result = input.decodeUTF((int) length); if (enableResolve) { result = resolveObject(result); } registerObjectRead(result, nextHandle(), unshared); return result; }
[ "private", "Object", "readNewLongString", "(", "boolean", "unshared", ")", "throws", "IOException", "{", "long", "length", "=", "input", ".", "readLong", "(", ")", ";", "Object", "result", "=", "input", ".", "decodeUTF", "(", "(", "int", ")", "length", ")"...
Read a new String in UTF format from the receiver. Return the string read. @param unshared read the object unshared @return the string just read. @throws IOException If an IO exception happened when reading the String.
[ "Read", "a", "new", "String", "in", "UTF", "format", "from", "the", "receiver", ".", "Return", "the", "string", "read", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L1938-L1947
34,117
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.readStreamHeader
protected void readStreamHeader() throws IOException, StreamCorruptedException { if (input.readShort() == STREAM_MAGIC && input.readShort() == STREAM_VERSION) { return; } throw new StreamCorruptedException(); }
java
protected void readStreamHeader() throws IOException, StreamCorruptedException { if (input.readShort() == STREAM_MAGIC && input.readShort() == STREAM_VERSION) { return; } throw new StreamCorruptedException(); }
[ "protected", "void", "readStreamHeader", "(", ")", "throws", "IOException", ",", "StreamCorruptedException", "{", "if", "(", "input", ".", "readShort", "(", ")", "==", "STREAM_MAGIC", "&&", "input", ".", "readShort", "(", ")", "==", "STREAM_VERSION", ")", "{",...
Reads and validates the ObjectInputStream header from the source stream. @throws IOException if an error occurs while reading from the source stream. @throws StreamCorruptedException if the source stream does not contain readable serialized objects.
[ "Reads", "and", "validates", "the", "ObjectInputStream", "header", "from", "the", "source", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L2096-L2103
34,118
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.registeredObjectRead
private Object registeredObjectRead(int handle) throws InvalidObjectException { Object res = objectsRead.get(handle - ObjectStreamConstants.baseWireHandle); if (res == UNSHARED_OBJ) { throw new InvalidObjectException("Cannot read back reference to unshared object"); } return res; }
java
private Object registeredObjectRead(int handle) throws InvalidObjectException { Object res = objectsRead.get(handle - ObjectStreamConstants.baseWireHandle); if (res == UNSHARED_OBJ) { throw new InvalidObjectException("Cannot read back reference to unshared object"); } return res; }
[ "private", "Object", "registeredObjectRead", "(", "int", "handle", ")", "throws", "InvalidObjectException", "{", "Object", "res", "=", "objectsRead", ".", "get", "(", "handle", "-", "ObjectStreamConstants", ".", "baseWireHandle", ")", ";", "if", "(", "res", "=="...
Returns the previously-read object corresponding to the given serialization handle. @throws InvalidObjectException If there is no previously-read object with this handle
[ "Returns", "the", "previously", "-", "read", "object", "corresponding", "to", "the", "given", "serialization", "handle", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L2156-L2162
34,119
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.registerObjectRead
private void registerObjectRead(Object obj, int handle, boolean unshared) throws IOException { if (unshared) { obj = UNSHARED_OBJ; } int index = handle - ObjectStreamConstants.baseWireHandle; int size = objectsRead.size(); // ObjectOutputStream sometimes wastes a handle. I've compared hex dumps of the RI // and it seems like that's a 'feature'. Look for calls to objectsWritten.put that // are guarded by !unshared tests. while (index > size) { objectsRead.add(null); ++size; } if (index == size) { objectsRead.add(obj); } else { objectsRead.set(index, obj); } }
java
private void registerObjectRead(Object obj, int handle, boolean unshared) throws IOException { if (unshared) { obj = UNSHARED_OBJ; } int index = handle - ObjectStreamConstants.baseWireHandle; int size = objectsRead.size(); // ObjectOutputStream sometimes wastes a handle. I've compared hex dumps of the RI // and it seems like that's a 'feature'. Look for calls to objectsWritten.put that // are guarded by !unshared tests. while (index > size) { objectsRead.add(null); ++size; } if (index == size) { objectsRead.add(obj); } else { objectsRead.set(index, obj); } }
[ "private", "void", "registerObjectRead", "(", "Object", "obj", ",", "int", "handle", ",", "boolean", "unshared", ")", "throws", "IOException", "{", "if", "(", "unshared", ")", "{", "obj", "=", "UNSHARED_OBJ", ";", "}", "int", "index", "=", "handle", "-", ...
Associates a read object with the its serialization handle.
[ "Associates", "a", "read", "object", "with", "the", "its", "serialization", "handle", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L2167-L2185
34,120
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java
ObjectInputStream.checkedSetSuperClassDesc
private static void checkedSetSuperClassDesc(ObjectStreamClass desc, ObjectStreamClass superDesc) throws StreamCorruptedException { if (desc.equals(superDesc)) { throw new StreamCorruptedException(); } desc.setSuperclass(superDesc); }
java
private static void checkedSetSuperClassDesc(ObjectStreamClass desc, ObjectStreamClass superDesc) throws StreamCorruptedException { if (desc.equals(superDesc)) { throw new StreamCorruptedException(); } desc.setSuperclass(superDesc); }
[ "private", "static", "void", "checkedSetSuperClassDesc", "(", "ObjectStreamClass", "desc", ",", "ObjectStreamClass", "superDesc", ")", "throws", "StreamCorruptedException", "{", "if", "(", "desc", ".", "equals", "(", "superDesc", ")", ")", "{", "throw", "new", "St...
Avoid recursive defining.
[ "Avoid", "recursive", "defining", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L2408-L2414
34,121
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java
Encodings.isRecognizedEncoding
public static boolean isRecognizedEncoding(String encoding) { EncodingInfo ei; String normalizedEncoding = encoding.toUpperCase(); ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding); if (ei == null) ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding); if (ei != null) return true; return false; }
java
public static boolean isRecognizedEncoding(String encoding) { EncodingInfo ei; String normalizedEncoding = encoding.toUpperCase(); ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding); if (ei == null) ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding); if (ei != null) return true; return false; }
[ "public", "static", "boolean", "isRecognizedEncoding", "(", "String", "encoding", ")", "{", "EncodingInfo", "ei", ";", "String", "normalizedEncoding", "=", "encoding", ".", "toUpperCase", "(", ")", ";", "ei", "=", "(", "EncodingInfo", ")", "_encodingTableKeyJava",...
Determines if the encoding specified was recognized by the serializer or not. @param encoding The encoding @return boolean - true if the encoding was recognized else false
[ "Determines", "if", "the", "encoding", "specified", "was", "recognized", "by", "the", "serializer", "or", "not", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java#L139-L150
34,122
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java
Encodings.loadEncodingInfo
private static EncodingInfo[] loadEncodingInfo() { try { InputStream is; SecuritySupport ss = SecuritySupport.getInstance(); is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), ENCODINGS_FILE); // j2objc: if resource wasn't found, load defaults from string. if (is == null) { is = new ByteArrayInputStream( ENCODINGS_FILE_STR.getBytes(StandardCharsets.UTF_8)); } Properties props = new Properties(); if (is != null) { props.load(is); is.close(); } else { // Seems to be no real need to force failure here, let the // system do its best... The issue is not really very critical, // and the output will be in any case _correct_ though maybe not // always human-friendly... :) // But maybe report/log the resource problem? // Any standard ways to report/log errors (in static context)? } int totalEntries = props.size(); List encodingInfo_list = new ArrayList(); Enumeration keys = props.keys(); for (int i = 0; i < totalEntries; ++i) { String javaName = (String) keys.nextElement(); String val = props.getProperty(javaName); int len = lengthOfMimeNames(val); String mimeName; char highChar; if (len == 0) { // There is no property value, only the javaName, so try and recover mimeName = javaName; highChar = '\u0000'; // don't know the high code point, will need to test every character } else { try { // Get the substring after the Mime names final String highVal = val.substring(len).trim(); highChar = (char) Integer.decode(highVal).intValue(); } catch( NumberFormatException e) { highChar = 0; } String mimeNames = val.substring(0, len); StringTokenizer st = new StringTokenizer(mimeNames, ","); for (boolean first = true; st.hasMoreTokens(); first = false) { mimeName = st.nextToken(); EncodingInfo ei = new EncodingInfo(mimeName, javaName, highChar); encodingInfo_list.add(ei); _encodingTableKeyMime.put(mimeName.toUpperCase(), ei); if (first) _encodingTableKeyJava.put(javaName.toUpperCase(), ei); } } } // Convert the Vector of EncodingInfo objects into an array of them, // as that is the kind of thing this method returns. EncodingInfo[] ret_ei = new EncodingInfo[encodingInfo_list.size()]; encodingInfo_list.toArray(ret_ei); return ret_ei; } catch (java.net.MalformedURLException mue) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(mue); } catch (java.io.IOException ioe) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(ioe); } }
java
private static EncodingInfo[] loadEncodingInfo() { try { InputStream is; SecuritySupport ss = SecuritySupport.getInstance(); is = ss.getResourceAsStream(ObjectFactory.findClassLoader(), ENCODINGS_FILE); // j2objc: if resource wasn't found, load defaults from string. if (is == null) { is = new ByteArrayInputStream( ENCODINGS_FILE_STR.getBytes(StandardCharsets.UTF_8)); } Properties props = new Properties(); if (is != null) { props.load(is); is.close(); } else { // Seems to be no real need to force failure here, let the // system do its best... The issue is not really very critical, // and the output will be in any case _correct_ though maybe not // always human-friendly... :) // But maybe report/log the resource problem? // Any standard ways to report/log errors (in static context)? } int totalEntries = props.size(); List encodingInfo_list = new ArrayList(); Enumeration keys = props.keys(); for (int i = 0; i < totalEntries; ++i) { String javaName = (String) keys.nextElement(); String val = props.getProperty(javaName); int len = lengthOfMimeNames(val); String mimeName; char highChar; if (len == 0) { // There is no property value, only the javaName, so try and recover mimeName = javaName; highChar = '\u0000'; // don't know the high code point, will need to test every character } else { try { // Get the substring after the Mime names final String highVal = val.substring(len).trim(); highChar = (char) Integer.decode(highVal).intValue(); } catch( NumberFormatException e) { highChar = 0; } String mimeNames = val.substring(0, len); StringTokenizer st = new StringTokenizer(mimeNames, ","); for (boolean first = true; st.hasMoreTokens(); first = false) { mimeName = st.nextToken(); EncodingInfo ei = new EncodingInfo(mimeName, javaName, highChar); encodingInfo_list.add(ei); _encodingTableKeyMime.put(mimeName.toUpperCase(), ei); if (first) _encodingTableKeyJava.put(javaName.toUpperCase(), ei); } } } // Convert the Vector of EncodingInfo objects into an array of them, // as that is the kind of thing this method returns. EncodingInfo[] ret_ei = new EncodingInfo[encodingInfo_list.size()]; encodingInfo_list.toArray(ret_ei); return ret_ei; } catch (java.net.MalformedURLException mue) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(mue); } catch (java.io.IOException ioe) { throw new org.apache.xml.serializer.utils.WrappedRuntimeException(ioe); } }
[ "private", "static", "EncodingInfo", "[", "]", "loadEncodingInfo", "(", ")", "{", "try", "{", "InputStream", "is", ";", "SecuritySupport", "ss", "=", "SecuritySupport", ".", "getInstance", "(", ")", ";", "is", "=", "ss", ".", "getResourceAsStream", "(", "Obj...
Load a list of all the supported encodings. System property "encodings" formatted using URL syntax may define an external encodings list. Thanks to Sergey Ushakov for the code contribution! @xsl.usage internal
[ "Load", "a", "list", "of", "all", "the", "supported", "encodings", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java#L315-L402
34,123
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java
Encodings.lengthOfMimeNames
private static int lengthOfMimeNames(String val) { // look for the space preceding the optional high char int len = val.indexOf(' '); // If len is zero it means the optional part is not there, so // the value must be all Mime names, so set the length appropriately if (len < 0) len = val.length(); return len; }
java
private static int lengthOfMimeNames(String val) { // look for the space preceding the optional high char int len = val.indexOf(' '); // If len is zero it means the optional part is not there, so // the value must be all Mime names, so set the length appropriately if (len < 0) len = val.length(); return len; }
[ "private", "static", "int", "lengthOfMimeNames", "(", "String", "val", ")", "{", "// look for the space preceding the optional high char", "int", "len", "=", "val", ".", "indexOf", "(", "'", "'", ")", ";", "// If len is zero it means the optional part is not there, so", "...
Get the length of the Mime names within the property value @param val The value of the property, which should contain a comma separated list of Mime names, followed optionally by a space and the high char value @return
[ "Get", "the", "length", "of", "the", "Mime", "names", "within", "the", "property", "value" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java#L411-L420
34,124
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNumber.java
XNumber.zeros
static private String zeros(int n) { if (n < 1) return ""; char[] buf = new char[n]; for (int i = 0; i < n; i++) { buf[i] = '0'; } return new String(buf); }
java
static private String zeros(int n) { if (n < 1) return ""; char[] buf = new char[n]; for (int i = 0; i < n; i++) { buf[i] = '0'; } return new String(buf); }
[ "static", "private", "String", "zeros", "(", "int", "n", ")", "{", "if", "(", "n", "<", "1", ")", "return", "\"\"", ";", "char", "[", "]", "buf", "=", "new", "char", "[", "n", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ...
Return a string of '0' of the given length @param n Length of the string to be returned @return a string of '0' with the given length
[ "Return", "a", "string", "of", "0", "of", "the", "given", "length" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNumber.java#L356-L369
34,125
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java
FutureTask.report
@SuppressWarnings("unchecked") private V report(int s) throws ExecutionException { Object x = outcome; if (s == NORMAL) return (V)x; if (s >= CANCELLED) throw new CancellationException(); throw new ExecutionException((Throwable)x); }
java
@SuppressWarnings("unchecked") private V report(int s) throws ExecutionException { Object x = outcome; if (s == NORMAL) return (V)x; if (s >= CANCELLED) throw new CancellationException(); throw new ExecutionException((Throwable)x); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "V", "report", "(", "int", "s", ")", "throws", "ExecutionException", "{", "Object", "x", "=", "outcome", ";", "if", "(", "s", "==", "NORMAL", ")", "return", "(", "V", ")", "x", ";", "if", ...
Returns result or throws exception for completed task. @param s completed state value
[ "Returns", "result", "or", "throws", "exception", "for", "completed", "task", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java#L119-L127
34,126
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java
FutureTask.set
protected void set(V v) { if (U.compareAndSwapInt(this, STATE, NEW, COMPLETING)) { outcome = v; U.putOrderedInt(this, STATE, NORMAL); // final state finishCompletion(); } }
java
protected void set(V v) { if (U.compareAndSwapInt(this, STATE, NEW, COMPLETING)) { outcome = v; U.putOrderedInt(this, STATE, NORMAL); // final state finishCompletion(); } }
[ "protected", "void", "set", "(", "V", "v", ")", "{", "if", "(", "U", ".", "compareAndSwapInt", "(", "this", ",", "STATE", ",", "NEW", ",", "COMPLETING", ")", ")", "{", "outcome", "=", "v", ";", "U", ".", "putOrderedInt", "(", "this", ",", "STATE", ...
Sets the result of this future to the given value unless this future has already been set or has been cancelled. <p>This method is invoked internally by the {@link #run} method upon successful completion of the computation. @param v the value
[ "Sets", "the", "result", "of", "this", "future", "to", "the", "given", "value", "unless", "this", "future", "has", "already", "been", "set", "or", "has", "been", "cancelled", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java#L233-L239
34,127
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java
FutureTask.awaitDone
private int awaitDone(boolean timed, long nanos) throws InterruptedException { // The code below is very delicate, to achieve these goals: // - call nanoTime exactly once for each call to park // - if nanos <= 0L, return promptly without allocation or nanoTime // - if nanos == Long.MIN_VALUE, don't underflow // - if nanos == Long.MAX_VALUE, and nanoTime is non-monotonic // and we suffer a spurious wakeup, we will do no worse than // to park-spin for a while long startTime = 0L; // Special value 0L means not yet parked WaitNode q = null; boolean queued = false; for (;;) { int s = state; if (s > COMPLETING) { if (q != null) q.thread = null; return s; } else if (s == COMPLETING) // We may have already promised (via isDone) that we are done // so never return empty-handed or throw InterruptedException Thread.yield(); else if (Thread.interrupted()) { removeWaiter(q); throw new InterruptedException(); } else if (q == null) { if (timed && nanos <= 0L) return s; q = new WaitNode(); } else if (!queued) queued = U.compareAndSwapObject(this, WAITERS, q.next = waiters, q); else if (timed) { final long parkNanos; if (startTime == 0L) { // first time startTime = System.nanoTime(); if (startTime == 0L) startTime = 1L; parkNanos = nanos; } else { long elapsed = System.nanoTime() - startTime; if (elapsed >= nanos) { removeWaiter(q); return state; } parkNanos = nanos - elapsed; } // nanoTime may be slow; recheck before parking if (state < COMPLETING) LockSupport.parkNanos(this, parkNanos); } else LockSupport.park(this); } }
java
private int awaitDone(boolean timed, long nanos) throws InterruptedException { // The code below is very delicate, to achieve these goals: // - call nanoTime exactly once for each call to park // - if nanos <= 0L, return promptly without allocation or nanoTime // - if nanos == Long.MIN_VALUE, don't underflow // - if nanos == Long.MAX_VALUE, and nanoTime is non-monotonic // and we suffer a spurious wakeup, we will do no worse than // to park-spin for a while long startTime = 0L; // Special value 0L means not yet parked WaitNode q = null; boolean queued = false; for (;;) { int s = state; if (s > COMPLETING) { if (q != null) q.thread = null; return s; } else if (s == COMPLETING) // We may have already promised (via isDone) that we are done // so never return empty-handed or throw InterruptedException Thread.yield(); else if (Thread.interrupted()) { removeWaiter(q); throw new InterruptedException(); } else if (q == null) { if (timed && nanos <= 0L) return s; q = new WaitNode(); } else if (!queued) queued = U.compareAndSwapObject(this, WAITERS, q.next = waiters, q); else if (timed) { final long parkNanos; if (startTime == 0L) { // first time startTime = System.nanoTime(); if (startTime == 0L) startTime = 1L; parkNanos = nanos; } else { long elapsed = System.nanoTime() - startTime; if (elapsed >= nanos) { removeWaiter(q); return state; } parkNanos = nanos - elapsed; } // nanoTime may be slow; recheck before parking if (state < COMPLETING) LockSupport.parkNanos(this, parkNanos); } else LockSupport.park(this); } }
[ "private", "int", "awaitDone", "(", "boolean", "timed", ",", "long", "nanos", ")", "throws", "InterruptedException", "{", "// The code below is very delicate, to achieve these goals:", "// - call nanoTime exactly once for each call to park", "// - if nanos <= 0L, return promptly withou...
Awaits completion or aborts on interrupt or timeout. @param timed true if use timed waits @param nanos time to wait, if timed @return state upon completion or at timeout
[ "Awaits", "completion", "or", "aborts", "on", "interrupt", "or", "timeout", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java#L398-L455
34,128
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java
FutureTask.removeWaiter
private void removeWaiter(WaitNode node) { if (node != null) { node.thread = null; retry: for (;;) { // restart on removeWaiter race for (WaitNode pred = null, q = waiters, s; q != null; q = s) { s = q.next; if (q.thread != null) pred = q; else if (pred != null) { pred.next = s; if (pred.thread == null) // check for race continue retry; } else if (!U.compareAndSwapObject(this, WAITERS, q, s)) continue retry; } break; } } }
java
private void removeWaiter(WaitNode node) { if (node != null) { node.thread = null; retry: for (;;) { // restart on removeWaiter race for (WaitNode pred = null, q = waiters, s; q != null; q = s) { s = q.next; if (q.thread != null) pred = q; else if (pred != null) { pred.next = s; if (pred.thread == null) // check for race continue retry; } else if (!U.compareAndSwapObject(this, WAITERS, q, s)) continue retry; } break; } } }
[ "private", "void", "removeWaiter", "(", "WaitNode", "node", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "node", ".", "thread", "=", "null", ";", "retry", ":", "for", "(", ";", ";", ")", "{", "// restart on removeWaiter race", "for", "(", "Wait...
Tries to unlink a timed-out or interrupted wait node to avoid accumulating garbage. Internal nodes are simply unspliced without CAS since it is harmless if they are traversed anyway by releasers. To avoid effects of unsplicing from already removed nodes, the list is retraversed in case of an apparent race. This is slow when there are a lot of nodes, but we don't expect lists to be long enough to outweigh higher-overhead schemes.
[ "Tries", "to", "unlink", "a", "timed", "-", "out", "or", "interrupted", "wait", "node", "to", "avoid", "accumulating", "garbage", ".", "Internal", "nodes", "are", "simply", "unspliced", "without", "CAS", "since", "it", "is", "harmless", "if", "they", "are", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/FutureTask.java#L467-L487
34,129
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SortedOps.java
SortedOps.makeRef
static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) { return new OfRef<>(upstream, comparator); }
java
static <T> Stream<T> makeRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) { return new OfRef<>(upstream, comparator); }
[ "static", "<", "T", ">", "Stream", "<", "T", ">", "makeRef", "(", "AbstractPipeline", "<", "?", ",", "T", ",", "?", ">", "upstream", ",", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "new", "OfRef", "<>", "(", "upstr...
Appends a "sorted" operation to the provided stream. @param <T> the type of both input and output elements @param upstream a reference stream with element type T @param comparator the comparator to order elements by
[ "Appends", "a", "sorted", "operation", "to", "the", "provided", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SortedOps.java#L61-L64
34,130
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java
ZipOutputStream.setComment
public void setComment(String comment) { if (comment != null) { this.comment = zc.getBytes(comment); if (this.comment.length > 0xffff) throw new IllegalArgumentException("ZIP file comment too long."); } }
java
public void setComment(String comment) { if (comment != null) { this.comment = zc.getBytes(comment); if (this.comment.length > 0xffff) throw new IllegalArgumentException("ZIP file comment too long."); } }
[ "public", "void", "setComment", "(", "String", "comment", ")", "{", "if", "(", "comment", "!=", "null", ")", "{", "this", ".", "comment", "=", "zc", ".", "getBytes", "(", "comment", ")", ";", "if", "(", "this", ".", "comment", ".", "length", ">", "...
Sets the ZIP file comment. @param comment the comment string @exception IllegalArgumentException if the length of the specified ZIP file comment is greater than 0xFFFF bytes
[ "Sets", "the", "ZIP", "file", "comment", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java#L132-L138
34,131
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java
ZipOutputStream.putNextEntry
public void putNextEntry(ZipEntry e) throws IOException { ensureOpen(); if (current != null) { closeEntry(); // close previous entry } if (e.time == -1) { e.setTime(System.currentTimeMillis()); } if (e.method == -1) { e.method = method; // use default method } // store size, compressed size, and crc-32 in LOC header e.flag = 0; switch (e.method) { case DEFLATED: // store size, compressed size, and crc-32 in data descriptor // immediately following the compressed entry data if (e.size == -1 || e.csize == -1 || e.crc == -1) e.flag = 8; break; case STORED: // compressed size, uncompressed size, and crc-32 must all be // set for entries using STORED compression method if (e.size == -1) { e.size = e.csize; } else if (e.csize == -1) { e.csize = e.size; } else if (e.size != e.csize) { throw new ZipException( "STORED entry where compressed != uncompressed size"); } if (e.size == -1 || e.crc == -1) { throw new ZipException( "STORED entry missing size, compressed size, or crc-32"); } break; default: throw new ZipException("unsupported compression method"); } if (! names.add(e.name)) { throw new ZipException("duplicate entry: " + e.name); } if (zc.isUTF8()) e.flag |= EFS; current = new XEntry(e, written); xentries.add(current); writeLOC(current); }
java
public void putNextEntry(ZipEntry e) throws IOException { ensureOpen(); if (current != null) { closeEntry(); // close previous entry } if (e.time == -1) { e.setTime(System.currentTimeMillis()); } if (e.method == -1) { e.method = method; // use default method } // store size, compressed size, and crc-32 in LOC header e.flag = 0; switch (e.method) { case DEFLATED: // store size, compressed size, and crc-32 in data descriptor // immediately following the compressed entry data if (e.size == -1 || e.csize == -1 || e.crc == -1) e.flag = 8; break; case STORED: // compressed size, uncompressed size, and crc-32 must all be // set for entries using STORED compression method if (e.size == -1) { e.size = e.csize; } else if (e.csize == -1) { e.csize = e.size; } else if (e.size != e.csize) { throw new ZipException( "STORED entry where compressed != uncompressed size"); } if (e.size == -1 || e.crc == -1) { throw new ZipException( "STORED entry missing size, compressed size, or crc-32"); } break; default: throw new ZipException("unsupported compression method"); } if (! names.add(e.name)) { throw new ZipException("duplicate entry: " + e.name); } if (zc.isUTF8()) e.flag |= EFS; current = new XEntry(e, written); xentries.add(current); writeLOC(current); }
[ "public", "void", "putNextEntry", "(", "ZipEntry", "e", ")", "throws", "IOException", "{", "ensureOpen", "(", ")", ";", "if", "(", "current", "!=", "null", ")", "{", "closeEntry", "(", ")", ";", "// close previous entry", "}", "if", "(", "e", ".", "time"...
Begins writing a new ZIP file entry and positions the stream to the start of the entry data. Closes the current entry if still active. The default compression method will be used if no compression method was specified for the entry, and the current time will be used if the entry has no set modification time. @param e the ZIP entry to be written @exception ZipException if a ZIP format error has occurred @exception IOException if an I/O error has occurred
[ "Begins", "writing", "a", "new", "ZIP", "file", "entry", "and", "positions", "the", "stream", "to", "the", "start", "of", "the", "entry", "data", ".", "Closes", "the", "current", "entry", "if", "still", "active", ".", "The", "default", "compression", "meth...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java#L175-L223
34,132
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java
ZipOutputStream.closeEntry
public void closeEntry() throws IOException { ensureOpen(); if (current != null) { ZipEntry e = current.entry; switch (e.method) { case DEFLATED: def.finish(); while (!def.finished()) { deflate(); } if ((e.flag & 8) == 0) { // verify size, compressed size, and crc-32 settings if (e.size != def.getBytesRead()) { throw new ZipException( "invalid entry size (expected " + e.size + " but got " + def.getBytesRead() + " bytes)"); } if (e.csize != def.getBytesWritten()) { throw new ZipException( "invalid entry compressed size (expected " + e.csize + " but got " + def.getBytesWritten() + " bytes)"); } if (e.crc != crc.getValue()) { throw new ZipException( "invalid entry CRC-32 (expected 0x" + Long.toHexString(e.crc) + " but got 0x" + Long.toHexString(crc.getValue()) + ")"); } } else { e.size = def.getBytesRead(); e.csize = def.getBytesWritten(); e.crc = crc.getValue(); writeEXT(e); } def.reset(); written += e.csize; break; case STORED: // we already know that both e.size and e.csize are the same if (e.size != written - locoff) { throw new ZipException( "invalid entry size (expected " + e.size + " but got " + (written - locoff) + " bytes)"); } if (e.crc != crc.getValue()) { throw new ZipException( "invalid entry crc-32 (expected 0x" + Long.toHexString(e.crc) + " but got 0x" + Long.toHexString(crc.getValue()) + ")"); } break; default: throw new ZipException("invalid compression method"); } crc.reset(); current = null; } }
java
public void closeEntry() throws IOException { ensureOpen(); if (current != null) { ZipEntry e = current.entry; switch (e.method) { case DEFLATED: def.finish(); while (!def.finished()) { deflate(); } if ((e.flag & 8) == 0) { // verify size, compressed size, and crc-32 settings if (e.size != def.getBytesRead()) { throw new ZipException( "invalid entry size (expected " + e.size + " but got " + def.getBytesRead() + " bytes)"); } if (e.csize != def.getBytesWritten()) { throw new ZipException( "invalid entry compressed size (expected " + e.csize + " but got " + def.getBytesWritten() + " bytes)"); } if (e.crc != crc.getValue()) { throw new ZipException( "invalid entry CRC-32 (expected 0x" + Long.toHexString(e.crc) + " but got 0x" + Long.toHexString(crc.getValue()) + ")"); } } else { e.size = def.getBytesRead(); e.csize = def.getBytesWritten(); e.crc = crc.getValue(); writeEXT(e); } def.reset(); written += e.csize; break; case STORED: // we already know that both e.size and e.csize are the same if (e.size != written - locoff) { throw new ZipException( "invalid entry size (expected " + e.size + " but got " + (written - locoff) + " bytes)"); } if (e.crc != crc.getValue()) { throw new ZipException( "invalid entry crc-32 (expected 0x" + Long.toHexString(e.crc) + " but got 0x" + Long.toHexString(crc.getValue()) + ")"); } break; default: throw new ZipException("invalid compression method"); } crc.reset(); current = null; } }
[ "public", "void", "closeEntry", "(", ")", "throws", "IOException", "{", "ensureOpen", "(", ")", ";", "if", "(", "current", "!=", "null", ")", "{", "ZipEntry", "e", "=", "current", ".", "entry", ";", "switch", "(", "e", ".", "method", ")", "{", "case"...
Closes the current ZIP entry and positions the stream for writing the next entry. @exception ZipException if a ZIP format error has occurred @exception IOException if an I/O error has occurred
[ "Closes", "the", "current", "ZIP", "entry", "and", "positions", "the", "stream", "for", "writing", "the", "next", "entry", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java#L231-L288
34,133
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java
ZipOutputStream.write
public synchronized void write(byte[] b, int off, int len) throws IOException { ensureOpen(); if (off < 0 || len < 0 || off > b.length - len) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } if (current == null) { throw new ZipException("no current ZIP entry"); } ZipEntry entry = current.entry; switch (entry.method) { case DEFLATED: super.write(b, off, len); break; case STORED: written += len; if (written - locoff > entry.size) { throw new ZipException( "attempt to write past end of STORED entry"); } out.write(b, off, len); break; default: throw new ZipException("invalid compression method"); } crc.update(b, off, len); }
java
public synchronized void write(byte[] b, int off, int len) throws IOException { ensureOpen(); if (off < 0 || len < 0 || off > b.length - len) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return; } if (current == null) { throw new ZipException("no current ZIP entry"); } ZipEntry entry = current.entry; switch (entry.method) { case DEFLATED: super.write(b, off, len); break; case STORED: written += len; if (written - locoff > entry.size) { throw new ZipException( "attempt to write past end of STORED entry"); } out.write(b, off, len); break; default: throw new ZipException("invalid compression method"); } crc.update(b, off, len); }
[ "public", "synchronized", "void", "write", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "ensureOpen", "(", ")", ";", "if", "(", "off", "<", "0", "||", "len", "<", "0", "||", "off", ">", "b",...
Writes an array of bytes to the current ZIP entry data. This method will block until all the bytes are written. @param b the data to be written @param off the start offset in the data @param len the number of bytes that are written @exception ZipException if a ZIP file error has occurred @exception IOException if an I/O error has occurred
[ "Writes", "an", "array", "of", "bytes", "to", "the", "current", "ZIP", "entry", "data", ".", "This", "method", "will", "block", "until", "all", "the", "bytes", "are", "written", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java#L299-L329
34,134
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java
ZipOutputStream.finish
public void finish() throws IOException { ensureOpen(); if (finished) { return; } if (xentries.isEmpty()) { throw new ZipException("No entries"); } if (current != null) { closeEntry(); } // write central directory long off = written; for (XEntry xentry : xentries) writeCEN(xentry); writeEND(off, written - off); finished = true; }
java
public void finish() throws IOException { ensureOpen(); if (finished) { return; } if (xentries.isEmpty()) { throw new ZipException("No entries"); } if (current != null) { closeEntry(); } // write central directory long off = written; for (XEntry xentry : xentries) writeCEN(xentry); writeEND(off, written - off); finished = true; }
[ "public", "void", "finish", "(", ")", "throws", "IOException", "{", "ensureOpen", "(", ")", ";", "if", "(", "finished", ")", "{", "return", ";", "}", "if", "(", "xentries", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "ZipException", "(", "\"N...
Finishes writing the contents of the ZIP output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream. @exception ZipException if a ZIP file error has occurred @exception IOException if an I/O exception has occurred
[ "Finishes", "writing", "the", "contents", "of", "the", "ZIP", "output", "stream", "without", "closing", "the", "underlying", "stream", ".", "Use", "this", "method", "when", "applying", "multiple", "filters", "in", "succession", "to", "the", "same", "output", "...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipOutputStream.java#L338-L356
34,135
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.getDisplayName
public String getDisplayName(TimeZone tz, GenericNameType type, long date) { String name = null; String tzCanonicalID = null; switch (type) { case LOCATION: tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } break; case LONG: case SHORT: name = formatGenericNonLocationName(tz, type, date); if (name == null) { tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } } break; } return name; }
java
public String getDisplayName(TimeZone tz, GenericNameType type, long date) { String name = null; String tzCanonicalID = null; switch (type) { case LOCATION: tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } break; case LONG: case SHORT: name = formatGenericNonLocationName(tz, type, date); if (name == null) { tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } } break; } return name; }
[ "public", "String", "getDisplayName", "(", "TimeZone", "tz", ",", "GenericNameType", "type", ",", "long", "date", ")", "{", "String", "name", "=", "null", ";", "String", "tzCanonicalID", "=", "null", ";", "switch", "(", "type", ")", "{", "case", "LOCATION"...
Returns the display name of the time zone for the given name type at the given date, or null if the display name is not available. @param tz the time zone @param type the generic name type - see {@link GenericNameType} @param date the date @return the display name of the time zone for the given name type at the given date, or null.
[ "Returns", "the", "display", "name", "of", "the", "time", "zone", "for", "the", "given", "name", "type", "at", "the", "given", "date", "or", "null", "if", "the", "display", "name", "is", "not", "available", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L197-L219
34,136
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.getGenericLocationName
public String getGenericLocationName(String canonicalTzID) { if (canonicalTzID == null || canonicalTzID.length() == 0) { return null; } String name = _genericLocationNamesMap.get(canonicalTzID); if (name != null) { if (name.length() == 0) { // empty string to indicate the name is not available return null; } return name; } Output<Boolean> isPrimary = new Output<Boolean>(); String countryCode = ZoneMeta.getCanonicalCountry(canonicalTzID, isPrimary); if (countryCode != null) { if (isPrimary.value) { // If this is only the single zone in the country, use the country name String country = getLocaleDisplayNames().regionDisplayName(countryCode); name = formatPattern(Pattern.REGION_FORMAT, country); } else { // If there are multiple zones including this in the country, // use the exemplar city name // getExemplarLocationName should return non-empty String // if the time zone is associated with a location String city = _tznames.getExemplarLocationName(canonicalTzID); name = formatPattern(Pattern.REGION_FORMAT, city); } } if (name == null) { _genericLocationNamesMap.putIfAbsent(canonicalTzID.intern(), ""); } else { synchronized (this) { // we have to sync the name map and the trie canonicalTzID = canonicalTzID.intern(); String tmp = _genericLocationNamesMap.putIfAbsent(canonicalTzID, name.intern()); if (tmp == null) { // Also put the name info the to trie NameInfo info = new NameInfo(canonicalTzID, GenericNameType.LOCATION); _gnamesTrie.put(name, info); } else { name = tmp; } } } return name; }
java
public String getGenericLocationName(String canonicalTzID) { if (canonicalTzID == null || canonicalTzID.length() == 0) { return null; } String name = _genericLocationNamesMap.get(canonicalTzID); if (name != null) { if (name.length() == 0) { // empty string to indicate the name is not available return null; } return name; } Output<Boolean> isPrimary = new Output<Boolean>(); String countryCode = ZoneMeta.getCanonicalCountry(canonicalTzID, isPrimary); if (countryCode != null) { if (isPrimary.value) { // If this is only the single zone in the country, use the country name String country = getLocaleDisplayNames().regionDisplayName(countryCode); name = formatPattern(Pattern.REGION_FORMAT, country); } else { // If there are multiple zones including this in the country, // use the exemplar city name // getExemplarLocationName should return non-empty String // if the time zone is associated with a location String city = _tznames.getExemplarLocationName(canonicalTzID); name = formatPattern(Pattern.REGION_FORMAT, city); } } if (name == null) { _genericLocationNamesMap.putIfAbsent(canonicalTzID.intern(), ""); } else { synchronized (this) { // we have to sync the name map and the trie canonicalTzID = canonicalTzID.intern(); String tmp = _genericLocationNamesMap.putIfAbsent(canonicalTzID, name.intern()); if (tmp == null) { // Also put the name info the to trie NameInfo info = new NameInfo(canonicalTzID, GenericNameType.LOCATION); _gnamesTrie.put(name, info); } else { name = tmp; } } } return name; }
[ "public", "String", "getGenericLocationName", "(", "String", "canonicalTzID", ")", "{", "if", "(", "canonicalTzID", "==", "null", "||", "canonicalTzID", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "String", "name", "=", "_gene...
Returns the generic location name for the given canonical time zone ID. @param canonicalTzID the canonical time zone ID @return the generic location name for the given canonical time zone ID.
[ "Returns", "the", "generic", "location", "name", "for", "the", "given", "canonical", "time", "zone", "ID", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L227-L274
34,137
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.formatPattern
private synchronized String formatPattern(Pattern pat, String... args) { if (_patternFormatters == null) { _patternFormatters = new MessageFormat[Pattern.values().length]; } int idx = pat.ordinal(); if (_patternFormatters[idx] == null) { String patText; try { ICUResourceBundle bundle = (ICUResourceBundle) ICUResourceBundle.getBundleInstance( ICUData.ICU_ZONE_BASE_NAME, _locale); patText = bundle.getStringWithFallback("zoneStrings/" + pat.key()); } catch (MissingResourceException e) { patText = pat.defaultValue(); } _patternFormatters[idx] = new MessageFormat(patText); } return _patternFormatters[idx].format(args); }
java
private synchronized String formatPattern(Pattern pat, String... args) { if (_patternFormatters == null) { _patternFormatters = new MessageFormat[Pattern.values().length]; } int idx = pat.ordinal(); if (_patternFormatters[idx] == null) { String patText; try { ICUResourceBundle bundle = (ICUResourceBundle) ICUResourceBundle.getBundleInstance( ICUData.ICU_ZONE_BASE_NAME, _locale); patText = bundle.getStringWithFallback("zoneStrings/" + pat.key()); } catch (MissingResourceException e) { patText = pat.defaultValue(); } _patternFormatters[idx] = new MessageFormat(patText); } return _patternFormatters[idx].format(args); }
[ "private", "synchronized", "String", "formatPattern", "(", "Pattern", "pat", ",", "String", "...", "args", ")", "{", "if", "(", "_patternFormatters", "==", "null", ")", "{", "_patternFormatters", "=", "new", "MessageFormat", "[", "Pattern", ".", "values", "(",...
Private simple pattern formatter used for formatting generic location names and partial location names. We intentionally use JDK MessageFormat for performance reason. @param pat the message pattern enum @param args the format argument(s) @return the formatted string
[ "Private", "simple", "pattern", "formatter", "used", "for", "formatting", "generic", "location", "names", "and", "partial", "location", "names", ".", "We", "intentionally", "use", "JDK", "MessageFormat", "for", "performance", "reason", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L443-L462
34,138
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.getLocaleDisplayNames
private synchronized LocaleDisplayNames getLocaleDisplayNames() { LocaleDisplayNames locNames = null; if (_localeDisplayNamesRef != null) { locNames = _localeDisplayNamesRef.get(); } if (locNames == null) { locNames = LocaleDisplayNames.getInstance(_locale); _localeDisplayNamesRef = new WeakReference<LocaleDisplayNames>(locNames); } return locNames; }
java
private synchronized LocaleDisplayNames getLocaleDisplayNames() { LocaleDisplayNames locNames = null; if (_localeDisplayNamesRef != null) { locNames = _localeDisplayNamesRef.get(); } if (locNames == null) { locNames = LocaleDisplayNames.getInstance(_locale); _localeDisplayNamesRef = new WeakReference<LocaleDisplayNames>(locNames); } return locNames; }
[ "private", "synchronized", "LocaleDisplayNames", "getLocaleDisplayNames", "(", ")", "{", "LocaleDisplayNames", "locNames", "=", "null", ";", "if", "(", "_localeDisplayNamesRef", "!=", "null", ")", "{", "locNames", "=", "_localeDisplayNamesRef", ".", "get", "(", ")",...
Private method returning LocaleDisplayNames instance for the locale of this instance. Because LocaleDisplayNames is only used for generic location formant and partial location format, the LocaleDisplayNames is instantiated lazily. @return the instance of LocaleDisplayNames for the locale of this object.
[ "Private", "method", "returning", "LocaleDisplayNames", "instance", "for", "the", "locale", "of", "this", "instance", ".", "Because", "LocaleDisplayNames", "is", "only", "used", "for", "generic", "location", "formant", "and", "partial", "location", "format", "the", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L472-L482
34,139
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.findBestMatch
public GenericMatchInfo findBestMatch(String text, int start, EnumSet<GenericNameType> genericTypes) { if (text == null || text.length() == 0 || start < 0 || start >= text.length()) { throw new IllegalArgumentException("bad input text or range"); } GenericMatchInfo bestMatch = null; // Find matches in the TimeZoneNames first Collection<MatchInfo> tznamesMatches = findTimeZoneNames(text, start, genericTypes); if (tznamesMatches != null) { MatchInfo longestMatch = null; for (MatchInfo match : tznamesMatches) { if (longestMatch == null || match.matchLength() > longestMatch.matchLength()) { longestMatch = match; } } if (longestMatch != null) { bestMatch = createGenericMatchInfo(longestMatch); if (bestMatch.matchLength() == (text.length() - start)) { // Full match //return bestMatch; // TODO Some time zone uses a same name for the long standard name // and the location name. When the match is a long standard name, // then we need to check if the name is same with the location name. // This is probably a data error or a design bug. // if (bestMatch.nameType != GenericNameType.LONG || bestMatch.timeType != TimeType.STANDARD) { // return bestMatch; // } // TODO The deprecation of commonlyUsed flag introduced the name // conflict not only for long standard names, but short standard names too. // These short names (found in zh_Hant) should be gone once we clean // up CLDR time zone display name data. Once the short name conflict // problem (with location name) is resolved, we should change the condition // below back to the original one above. -Yoshito (2011-09-14) if (bestMatch.timeType != TimeType.STANDARD) { return bestMatch; } } } } // Find matches in the local trie Collection<GenericMatchInfo> localMatches = findLocal(text, start, genericTypes); if (localMatches != null) { for (GenericMatchInfo match : localMatches) { // TODO See the above TODO. We use match.matchLength() >= bestMatch.matcheLength() // for the reason described above. //if (bestMatch == null || match.matchLength() > bestMatch.matchLength()) { if (bestMatch == null || match.matchLength() >= bestMatch.matchLength()) { bestMatch = match; } } } return bestMatch; }
java
public GenericMatchInfo findBestMatch(String text, int start, EnumSet<GenericNameType> genericTypes) { if (text == null || text.length() == 0 || start < 0 || start >= text.length()) { throw new IllegalArgumentException("bad input text or range"); } GenericMatchInfo bestMatch = null; // Find matches in the TimeZoneNames first Collection<MatchInfo> tznamesMatches = findTimeZoneNames(text, start, genericTypes); if (tznamesMatches != null) { MatchInfo longestMatch = null; for (MatchInfo match : tznamesMatches) { if (longestMatch == null || match.matchLength() > longestMatch.matchLength()) { longestMatch = match; } } if (longestMatch != null) { bestMatch = createGenericMatchInfo(longestMatch); if (bestMatch.matchLength() == (text.length() - start)) { // Full match //return bestMatch; // TODO Some time zone uses a same name for the long standard name // and the location name. When the match is a long standard name, // then we need to check if the name is same with the location name. // This is probably a data error or a design bug. // if (bestMatch.nameType != GenericNameType.LONG || bestMatch.timeType != TimeType.STANDARD) { // return bestMatch; // } // TODO The deprecation of commonlyUsed flag introduced the name // conflict not only for long standard names, but short standard names too. // These short names (found in zh_Hant) should be gone once we clean // up CLDR time zone display name data. Once the short name conflict // problem (with location name) is resolved, we should change the condition // below back to the original one above. -Yoshito (2011-09-14) if (bestMatch.timeType != TimeType.STANDARD) { return bestMatch; } } } } // Find matches in the local trie Collection<GenericMatchInfo> localMatches = findLocal(text, start, genericTypes); if (localMatches != null) { for (GenericMatchInfo match : localMatches) { // TODO See the above TODO. We use match.matchLength() >= bestMatch.matcheLength() // for the reason described above. //if (bestMatch == null || match.matchLength() > bestMatch.matchLength()) { if (bestMatch == null || match.matchLength() >= bestMatch.matchLength()) { bestMatch = match; } } } return bestMatch; }
[ "public", "GenericMatchInfo", "findBestMatch", "(", "String", "text", ",", "int", "start", ",", "EnumSet", "<", "GenericNameType", ">", "genericTypes", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "length", "(", ")", "==", "0", "||", "st...
Returns the best match of time zone display name for the specified types in the given text at the given offset. @param text the text @param start the start offset in the text @param genericTypes the set of name types. @return the best matching name info.
[ "Returns", "the", "best", "match", "of", "time", "zone", "display", "name", "for", "the", "specified", "types", "in", "the", "given", "text", "at", "the", "given", "offset", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L704-L760
34,140
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.find
public Collection<GenericMatchInfo> find(String text, int start, EnumSet<GenericNameType> genericTypes) { if (text == null || text.length() == 0 || start < 0 || start >= text.length()) { throw new IllegalArgumentException("bad input text or range"); } // Find matches in the local trie Collection<GenericMatchInfo> results = findLocal(text, start, genericTypes); // Also find matches in the TimeZoneNames Collection<MatchInfo> tznamesMatches = findTimeZoneNames(text, start, genericTypes); if (tznamesMatches != null) { // transform matches and append them to local matches for (MatchInfo match : tznamesMatches) { if (results == null) { results = new LinkedList<GenericMatchInfo>(); } results.add(createGenericMatchInfo(match)); } } return results; }
java
public Collection<GenericMatchInfo> find(String text, int start, EnumSet<GenericNameType> genericTypes) { if (text == null || text.length() == 0 || start < 0 || start >= text.length()) { throw new IllegalArgumentException("bad input text or range"); } // Find matches in the local trie Collection<GenericMatchInfo> results = findLocal(text, start, genericTypes); // Also find matches in the TimeZoneNames Collection<MatchInfo> tznamesMatches = findTimeZoneNames(text, start, genericTypes); if (tznamesMatches != null) { // transform matches and append them to local matches for (MatchInfo match : tznamesMatches) { if (results == null) { results = new LinkedList<GenericMatchInfo>(); } results.add(createGenericMatchInfo(match)); } } return results; }
[ "public", "Collection", "<", "GenericMatchInfo", ">", "find", "(", "String", "text", ",", "int", "start", ",", "EnumSet", "<", "GenericNameType", ">", "genericTypes", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "length", "(", ")", "==",...
Returns a collection of time zone display name matches for the specified types in the given text at the given offset. @param text the text @param start the start offset in the text @param genericTypes the set of name types. @return A collection of match info.
[ "Returns", "a", "collection", "of", "time", "zone", "display", "name", "matches", "for", "the", "specified", "types", "in", "the", "given", "text", "at", "the", "given", "offset", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L770-L789
34,141
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.findTimeZoneNames
private Collection<MatchInfo> findTimeZoneNames(String text, int start, EnumSet<GenericNameType> types) { Collection<MatchInfo> tznamesMatches = null; // Check if the target name type is really in the TimeZoneNames EnumSet<NameType> nameTypes = EnumSet.noneOf(NameType.class); if (types.contains(GenericNameType.LONG)) { nameTypes.add(NameType.LONG_GENERIC); nameTypes.add(NameType.LONG_STANDARD); } if (types.contains(GenericNameType.SHORT)) { nameTypes.add(NameType.SHORT_GENERIC); nameTypes.add(NameType.SHORT_STANDARD); } if (!nameTypes.isEmpty()) { // Find matches in the TimeZoneNames tznamesMatches = _tznames.find(text, start, nameTypes); } return tznamesMatches; }
java
private Collection<MatchInfo> findTimeZoneNames(String text, int start, EnumSet<GenericNameType> types) { Collection<MatchInfo> tznamesMatches = null; // Check if the target name type is really in the TimeZoneNames EnumSet<NameType> nameTypes = EnumSet.noneOf(NameType.class); if (types.contains(GenericNameType.LONG)) { nameTypes.add(NameType.LONG_GENERIC); nameTypes.add(NameType.LONG_STANDARD); } if (types.contains(GenericNameType.SHORT)) { nameTypes.add(NameType.SHORT_GENERIC); nameTypes.add(NameType.SHORT_STANDARD); } if (!nameTypes.isEmpty()) { // Find matches in the TimeZoneNames tznamesMatches = _tznames.find(text, start, nameTypes); } return tznamesMatches; }
[ "private", "Collection", "<", "MatchInfo", ">", "findTimeZoneNames", "(", "String", "text", ",", "int", "start", ",", "EnumSet", "<", "GenericNameType", ">", "types", ")", "{", "Collection", "<", "MatchInfo", ">", "tznamesMatches", "=", "null", ";", "// Check ...
Returns a collection of time zone display name matches for the specified types in the given text at the given offset. This method only finds matches from the TimeZoneNames used by this object. @param text the text @param start the start offset in the text @param types the set of name types. @return A collection of match info.
[ "Returns", "a", "collection", "of", "time", "zone", "display", "name", "matches", "for", "the", "specified", "types", "in", "the", "given", "text", "at", "the", "given", "offset", ".", "This", "method", "only", "finds", "matches", "from", "the", "TimeZoneNam...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L840-L859
34,142
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.applyFilter
protected boolean applyFilter(Node node, int nodeType) { if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) { short code = fFilter.acceptNode(node); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : return false; // skip the node default : // fall through.. } } return true; }
java
protected boolean applyFilter(Node node, int nodeType) { if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) { short code = fFilter.acceptNode(node); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : return false; // skip the node default : // fall through.. } } return true; }
[ "protected", "boolean", "applyFilter", "(", "Node", "node", ",", "int", "nodeType", ")", "{", "if", "(", "fFilter", "!=", "null", "&&", "(", "fWhatToShowFilter", "&", "nodeType", ")", "!=", "0", ")", "{", "short", "code", "=", "fFilter", ".", "acceptNode...
Applies a filter on the node to serialize @param node The Node to serialize @return True if the node is to be serialized else false if the node is to be rejected or skipped.
[ "Applies", "a", "filter", "on", "the", "node", "to", "serialize" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L476-L488
34,143
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializeDocType
protected void serializeDocType(DocumentType node, boolean bStart) throws SAXException { // The DocType and internalSubset can not be modified in DOM and is // considered to be well-formed as the outcome of successful parsing. String docTypeName = node.getNodeName(); String publicId = node.getPublicId(); String systemId = node.getSystemId(); String internalSubset = node.getInternalSubset(); //DocumentType nodes are never passed to the filter if (internalSubset != null && !"".equals(internalSubset)) { if (bStart) { try { // The Serializer does not provide a way to write out the // DOCTYPE internal subset via an event call, so we write it // out here. Writer writer = fSerializer.getWriter(); StringBuffer dtd = new StringBuffer(); dtd.append("<!DOCTYPE "); dtd.append(docTypeName); if (null != publicId) { dtd.append(" PUBLIC \""); dtd.append(publicId); dtd.append('\"'); } if (null != systemId) { if (null == publicId) { dtd.append(" SYSTEM \""); } else { dtd.append(" \""); } dtd.append(systemId); dtd.append('\"'); } dtd.append(" [ "); dtd.append(fNewLine); dtd.append(internalSubset); dtd.append("]>"); dtd.append(new String(fNewLine)); writer.write(dtd.toString()); writer.flush(); } catch (IOException e) { throw new SAXException(Utils.messages.createMessage( MsgKey.ER_WRITING_INTERNAL_SUBSET, null), e); } } // else if !bStart do nothing } else { if (bStart) { if (fLexicalHandler != null) { fLexicalHandler.startDTD(docTypeName, publicId, systemId); } } else { if (fLexicalHandler != null) { fLexicalHandler.endDTD(); } } } }
java
protected void serializeDocType(DocumentType node, boolean bStart) throws SAXException { // The DocType and internalSubset can not be modified in DOM and is // considered to be well-formed as the outcome of successful parsing. String docTypeName = node.getNodeName(); String publicId = node.getPublicId(); String systemId = node.getSystemId(); String internalSubset = node.getInternalSubset(); //DocumentType nodes are never passed to the filter if (internalSubset != null && !"".equals(internalSubset)) { if (bStart) { try { // The Serializer does not provide a way to write out the // DOCTYPE internal subset via an event call, so we write it // out here. Writer writer = fSerializer.getWriter(); StringBuffer dtd = new StringBuffer(); dtd.append("<!DOCTYPE "); dtd.append(docTypeName); if (null != publicId) { dtd.append(" PUBLIC \""); dtd.append(publicId); dtd.append('\"'); } if (null != systemId) { if (null == publicId) { dtd.append(" SYSTEM \""); } else { dtd.append(" \""); } dtd.append(systemId); dtd.append('\"'); } dtd.append(" [ "); dtd.append(fNewLine); dtd.append(internalSubset); dtd.append("]>"); dtd.append(new String(fNewLine)); writer.write(dtd.toString()); writer.flush(); } catch (IOException e) { throw new SAXException(Utils.messages.createMessage( MsgKey.ER_WRITING_INTERNAL_SUBSET, null), e); } } // else if !bStart do nothing } else { if (bStart) { if (fLexicalHandler != null) { fLexicalHandler.startDTD(docTypeName, publicId, systemId); } } else { if (fLexicalHandler != null) { fLexicalHandler.endDTD(); } } } }
[ "protected", "void", "serializeDocType", "(", "DocumentType", "node", ",", "boolean", "bStart", ")", "throws", "SAXException", "{", "// The DocType and internalSubset can not be modified in DOM and is", "// considered to be well-formed as the outcome of successful parsing.", "String", ...
Serializes a Document Type Node. @param node The Docuemnt Type Node to serialize @param bStart Invoked at the start or end of node. Default true.
[ "Serializes", "a", "Document", "Type", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L496-L563
34,144
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializeComment
protected void serializeComment(Comment node) throws SAXException { // comments=true if ((fFeatures & COMMENTS) != 0) { String data = node.getData(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCommentWellFormed(data); } if (fLexicalHandler != null) { // apply the LSSerializer filter after the operations requested by the // DOMConfiguration parameters have been applied if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) { return; } fLexicalHandler.comment(data.toCharArray(), 0, data.length()); } } }
java
protected void serializeComment(Comment node) throws SAXException { // comments=true if ((fFeatures & COMMENTS) != 0) { String data = node.getData(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCommentWellFormed(data); } if (fLexicalHandler != null) { // apply the LSSerializer filter after the operations requested by the // DOMConfiguration parameters have been applied if (!applyFilter(node, NodeFilter.SHOW_COMMENT)) { return; } fLexicalHandler.comment(data.toCharArray(), 0, data.length()); } } }
[ "protected", "void", "serializeComment", "(", "Comment", "node", ")", "throws", "SAXException", "{", "// comments=true", "if", "(", "(", "fFeatures", "&", "COMMENTS", ")", "!=", "0", ")", "{", "String", "data", "=", "node", ".", "getData", "(", ")", ";", ...
Serializes a Comment Node. @param node The Comment Node to serialize
[ "Serializes", "a", "Comment", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L570-L590
34,145
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializeElement
protected void serializeElement(Element node, boolean bStart) throws SAXException { if (bStart) { fElementDepth++; // We use the Xalan specific startElement and starPrefixMapping calls // (and addAttribute and namespaceAfterStartElement) as opposed to // SAX specific, for performance reasons as they reduce the overhead // of creating an AttList object upfront. // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isElementWellFormed(node); } // REVISIT: We apply the LSSerializer filter for elements before // namesapce fixup if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } // namespaces=true, record and fixup namspaced element if ((fFeatures & NAMESPACES) != 0) { fNSBinder.pushContext(); fLocalNSBinder.reset(); recordLocalNSDecl(node); fixupElementNS(node); } // Namespace normalization fSerializer.startElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); serializeAttList(node); } else { fElementDepth--; // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } this.fSerializer.endElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); // since endPrefixMapping was not used by SerializationHandler it was removed // for performance reasons. if ((fFeatures & NAMESPACES) != 0 ) { fNSBinder.popContext(); } } }
java
protected void serializeElement(Element node, boolean bStart) throws SAXException { if (bStart) { fElementDepth++; // We use the Xalan specific startElement and starPrefixMapping calls // (and addAttribute and namespaceAfterStartElement) as opposed to // SAX specific, for performance reasons as they reduce the overhead // of creating an AttList object upfront. // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isElementWellFormed(node); } // REVISIT: We apply the LSSerializer filter for elements before // namesapce fixup if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } // namespaces=true, record and fixup namspaced element if ((fFeatures & NAMESPACES) != 0) { fNSBinder.pushContext(); fLocalNSBinder.reset(); recordLocalNSDecl(node); fixupElementNS(node); } // Namespace normalization fSerializer.startElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); serializeAttList(node); } else { fElementDepth--; // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_ELEMENT)) { return; } this.fSerializer.endElement( node.getNamespaceURI(), node.getLocalName(), node.getNodeName()); // since endPrefixMapping was not used by SerializationHandler it was removed // for performance reasons. if ((fFeatures & NAMESPACES) != 0 ) { fNSBinder.popContext(); } } }
[ "protected", "void", "serializeElement", "(", "Element", "node", ",", "boolean", "bStart", ")", "throws", "SAXException", "{", "if", "(", "bStart", ")", "{", "fElementDepth", "++", ";", "// We use the Xalan specific startElement and starPrefixMapping calls ", "// (and add...
Serializes an Element Node. @param node The Element Node to serialize @param bStart Invoked at the start or end of node.
[ "Serializes", "an", "Element", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L598-L656
34,146
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializePI
protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
java
protected void serializePI(ProcessingInstruction node) throws SAXException { ProcessingInstruction pi = node; String name = pi.getNodeName(); // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isPIWellFormed(node); } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_PROCESSING_INSTRUCTION)) { return; } // String data = pi.getData(); if (name.equals("xslt-next-is-raw")) { fNextIsRaw = true; } else { this.fSerializer.processingInstruction(name, pi.getData()); } }
[ "protected", "void", "serializePI", "(", "ProcessingInstruction", "node", ")", "throws", "SAXException", "{", "ProcessingInstruction", "pi", "=", "node", ";", "String", "name", "=", "pi", ".", "getNodeName", "(", ")", ";", "// well-formed=true", "if", "(", "(", ...
Serializes an ProcessingInstruction Node. @param node The ProcessingInstruction Node to serialize
[ "Serializes", "an", "ProcessingInstruction", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L887-L908
34,147
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializeCDATASection
protected void serializeCDATASection(CDATASection node) throws SAXException { // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCDATASectionWellFormed(node); } // cdata-sections = true if ((fFeatures & CDATA) != 0) { // split-cdata-sections = true // Assumption: This parameter has an effect only when // cdata-sections=true // ToStream, by default splits cdata-sections. Hence the check // below. String nodeValue = node.getNodeValue(); int endIndex = nodeValue.indexOf("]]>"); if ((fFeatures & SPLITCDATA) != 0) { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_WARNING, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT, null, relatedData, null)); } } } else { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT)); } // Report an error and return. What error??? return; } } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; } // splits the cdata-section if (fLexicalHandler != null) { fLexicalHandler.startCDATA(); } dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); } } else { dispatachChars(node); } }
java
protected void serializeCDATASection(CDATASection node) throws SAXException { // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isCDATASectionWellFormed(node); } // cdata-sections = true if ((fFeatures & CDATA) != 0) { // split-cdata-sections = true // Assumption: This parameter has an effect only when // cdata-sections=true // ToStream, by default splits cdata-sections. Hence the check // below. String nodeValue = node.getNodeValue(); int endIndex = nodeValue.indexOf("]]>"); if ((fFeatures & SPLITCDATA) != 0) { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_WARNING, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT, null, relatedData, null)); } } } else { if (endIndex >= 0) { // The first node split will contain the ]] markers String relatedData = nodeValue.substring(0, endIndex + 2); String msg = Utils.messages.createMessage( MsgKey.ER_CDATA_SECTIONS_SPLIT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_CDATA_SECTIONS_SPLIT)); } // Report an error and return. What error??? return; } } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_CDATA_SECTION)) { return; } // splits the cdata-section if (fLexicalHandler != null) { fLexicalHandler.startCDATA(); } dispatachChars(node); if (fLexicalHandler != null) { fLexicalHandler.endCDATA(); } } else { dispatachChars(node); } }
[ "protected", "void", "serializeCDATASection", "(", "CDATASection", "node", ")", "throws", "SAXException", "{", "// well-formed=true", "if", "(", "(", "fFeatures", "&", "WELLFORMED", ")", "!=", "0", ")", "{", "isCDATASectionWellFormed", "(", "node", ")", ";", "}"...
Serializes an CDATASection Node. @param node The CDATASection Node to serialize
[ "Serializes", "an", "CDATASection", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L915-L991
34,148
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializeText
protected void serializeText(Text node) throws SAXException { if (fNextIsRaw) { fNextIsRaw = false; fSerializer.processingInstruction( javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); fSerializer.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { // keep track of dispatch or not to avoid duplicaiton of filter code boolean bDispatch = false; // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isTextWellFormed(node); } // if the node is whitespace // Determine the Attr's type. boolean isElementContentWhitespace = false; if (fIsLevel3DOM) { isElementContentWhitespace = node.isElementContentWhitespace(); } if (isElementContentWhitespace) { // element-content-whitespace=true if ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) { bDispatch = true; } } else { bDispatch = true; } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_TEXT)) { return; } if (bDispatch) { dispatachChars(node); } } }
java
protected void serializeText(Text node) throws SAXException { if (fNextIsRaw) { fNextIsRaw = false; fSerializer.processingInstruction( javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, ""); dispatachChars(node); fSerializer.processingInstruction( javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, ""); } else { // keep track of dispatch or not to avoid duplicaiton of filter code boolean bDispatch = false; // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isTextWellFormed(node); } // if the node is whitespace // Determine the Attr's type. boolean isElementContentWhitespace = false; if (fIsLevel3DOM) { isElementContentWhitespace = node.isElementContentWhitespace(); } if (isElementContentWhitespace) { // element-content-whitespace=true if ((fFeatures & ELEM_CONTENT_WHITESPACE) != 0) { bDispatch = true; } } else { bDispatch = true; } // apply the LSSerializer filter if (!applyFilter(node, NodeFilter.SHOW_TEXT)) { return; } if (bDispatch) { dispatachChars(node); } } }
[ "protected", "void", "serializeText", "(", "Text", "node", ")", "throws", "SAXException", "{", "if", "(", "fNextIsRaw", ")", "{", "fNextIsRaw", "=", "false", ";", "fSerializer", ".", "processingInstruction", "(", "javax", ".", "xml", ".", "transform", ".", "...
Serializes an Text Node. @param node The Text Node to serialize
[ "Serializes", "an", "Text", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L998-L1043
34,149
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.serializeEntityReference
protected void serializeEntityReference( EntityReference node, boolean bStart) throws SAXException { if (bStart) { EntityReference eref = node; // entities=true if ((fFeatures & ENTITIES) != 0) { // perform well-formedness and other checking only if // entities = true // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isEntityReferneceWellFormed(node); } // check "unbound-prefix-in-entity-reference" [fatal] // Raised if the configuration parameter "namespaces" is set to true if ((fFeatures & NAMESPACES) != 0) { checkUnboundPrefixInEntRef(node); } // The filter should not apply in this case, since the // EntityReference is not being expanded. // should we pass entity reference nodes to the filter??? } if (fLexicalHandler != null) { // startEntity outputs only Text but not Element, Attr, Comment // and PI child nodes. It does so by setting the m_inEntityRef // in ToStream and using this to decide if a node is to be // serialized or not. fLexicalHandler.startEntity(eref.getNodeName()); } } else { EntityReference eref = node; // entities=true or false, if (fLexicalHandler != null) { fLexicalHandler.endEntity(eref.getNodeName()); } } }
java
protected void serializeEntityReference( EntityReference node, boolean bStart) throws SAXException { if (bStart) { EntityReference eref = node; // entities=true if ((fFeatures & ENTITIES) != 0) { // perform well-formedness and other checking only if // entities = true // well-formed=true if ((fFeatures & WELLFORMED) != 0) { isEntityReferneceWellFormed(node); } // check "unbound-prefix-in-entity-reference" [fatal] // Raised if the configuration parameter "namespaces" is set to true if ((fFeatures & NAMESPACES) != 0) { checkUnboundPrefixInEntRef(node); } // The filter should not apply in this case, since the // EntityReference is not being expanded. // should we pass entity reference nodes to the filter??? } if (fLexicalHandler != null) { // startEntity outputs only Text but not Element, Attr, Comment // and PI child nodes. It does so by setting the m_inEntityRef // in ToStream and using this to decide if a node is to be // serialized or not. fLexicalHandler.startEntity(eref.getNodeName()); } } else { EntityReference eref = node; // entities=true or false, if (fLexicalHandler != null) { fLexicalHandler.endEntity(eref.getNodeName()); } } }
[ "protected", "void", "serializeEntityReference", "(", "EntityReference", "node", ",", "boolean", "bStart", ")", "throws", "SAXException", "{", "if", "(", "bStart", ")", "{", "EntityReference", "eref", "=", "node", ";", "// entities=true", "if", "(", "(", "fFeatu...
Serializes an EntityReference Node. @param node The EntityReference Node to serialize @param bStart Inicates if called from start or endNode
[ "Serializes", "an", "EntityReference", "Node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1051-L1095
34,150
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isWFXMLChar
protected boolean isWFXMLChar(String chardata, Character refInvalidChar) { if (chardata == null || (chardata.length() == 0)) { return true; } char[] dataarray = chardata.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { //we need to check all characters as per production rules of XML11 int i = 0; while (i < datalength) { if (XML11Char.isXML11Invalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // version of the document is XML 1.0 else { // we need to check all characters as per production rules of XML 1.0 int i = 0; while (i < datalength) { if (XMLChar.isInvalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // end-else fDocument.isXMLVersion() return true; }
java
protected boolean isWFXMLChar(String chardata, Character refInvalidChar) { if (chardata == null || (chardata.length() == 0)) { return true; } char[] dataarray = chardata.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { //we need to check all characters as per production rules of XML11 int i = 0; while (i < datalength) { if (XML11Char.isXML11Invalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // version of the document is XML 1.0 else { // we need to check all characters as per production rules of XML 1.0 int i = 0; while (i < datalength) { if (XMLChar.isInvalid(dataarray[i++])) { // check if this is a supplemental character char ch = dataarray[i - 1]; if (XMLChar.isHighSurrogate(ch) && i < datalength) { char ch2 = dataarray[i++]; if (XMLChar.isLowSurrogate(ch2) && XMLChar.isSupplemental( XMLChar.supplemental(ch, ch2))) { continue; } } // Reference to invalid character which is returned refInvalidChar = new Character(ch); return false; } } } // end-else fDocument.isXMLVersion() return true; }
[ "protected", "boolean", "isWFXMLChar", "(", "String", "chardata", ",", "Character", "refInvalidChar", ")", "{", "if", "(", "chardata", "==", "null", "||", "(", "chardata", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "true", ";", "}", "...
Checks if a XML character is well-formed @param characters A String of characters to be checked for Well-Formedness @param refInvalidChar A reference to the character to be returned that was determined invalid.
[ "Checks", "if", "a", "XML", "character", "is", "well", "-", "formed" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1157-L1210
34,151
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isCommentWellFormed
protected void isCommentWellFormed(String data) { if (data == null || (data.length() == 0)) { return; } char[] dataarray = data.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { // we need to check all chracters as per production rules of XML11 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XML11Char.isXML11Invalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } // version of the document is XML 1.0 else { // we need to check all chracters as per production rules of XML 1.0 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XMLChar.isInvalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } return; }
java
protected void isCommentWellFormed(String data) { if (data == null || (data.length() == 0)) { return; } char[] dataarray = data.toCharArray(); int datalength = dataarray.length; // version of the document is XML 1.1 if (fIsXMLVersion11) { // we need to check all chracters as per production rules of XML11 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XML11Char.isXML11Invalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } // version of the document is XML 1.0 else { // we need to check all chracters as per production rules of XML 1.0 int i = 0; while (i < datalength) { char c = dataarray[i++]; if (XMLChar.isInvalid(c)) { // check if this is a supplemental character if (XMLChar.isHighSurrogate(c) && i < datalength) { char c2 = dataarray[i++]; if (XMLChar.isLowSurrogate(c2) && XMLChar.isSupplemental( XMLChar.supplemental(c, c2))) { continue; } } String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_COMMENT, new Object[] { new Character(c)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } else if (c == '-' && i < datalength && dataarray[i] == '-') { String msg = Utils.messages.createMessage( MsgKey.ER_WF_DASH_IN_COMMENT, null); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } } } return; }
[ "protected", "void", "isCommentWellFormed", "(", "String", "data", ")", "{", "if", "(", "data", "==", "null", "||", "(", "data", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", ";", "}", "char", "[", "]", "dataarray", "=", "data", ".",...
Checks if a comment node is well-formed @param data The contents of the comment node @return a boolean indiacating if the comment is well-formed or not.
[ "Checks", "if", "a", "comment", "node", "is", "well", "-", "formed" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1281-L1389
34,152
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isElementWellFormed
protected void isElementWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Element", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } }
java
protected void isElementWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Element", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } }
[ "protected", "void", "isElementWellFormed", "(", "Node", "node", ")", "{", "boolean", "isNameWF", "=", "false", ";", "if", "(", "(", "fFeatures", "&", "NAMESPACES", ")", "!=", "0", ")", "{", "isNameWF", "=", "isValidQName", "(", "node", ".", "getPrefix", ...
Checks if an element node is well-formed, by checking its Name for well-formedness. @param data The contents of the comment node @return a boolean indiacating if the comment is well-formed or not.
[ "Checks", "if", "an", "element", "node", "is", "well", "-", "formed", "by", "checking", "its", "Name", "for", "well", "-", "formedness", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1397-L1426
34,153
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isAttributeWellFormed
protected void isAttributeWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Attr", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Check the Attr's node value // WFC: No < in Attribute Values String value = node.getNodeValue(); if (value.indexOf('<') >= 0) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_LT_IN_ATTVAL, new Object[] { ((Attr) node).getOwnerElement().getNodeName(), node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_LT_IN_ATTVAL, null, null, null)); } } // we need to loop through the children of attr nodes and check their values for // well-formedness NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); // An attribute node with no text or entity ref child for example // doc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns"); // followes by // element.setAttributeNodeNS(attribute); // can potentially lead to this situation. If the attribute // was a prefix Namespace attribute declaration then then DOM Core // should have some exception defined for this. if (child == null) { // we should probably report an error continue; } switch (child.getNodeType()) { case Node.TEXT_NODE : isTextWellFormed((Text) child); break; case Node.ENTITY_REFERENCE_NODE : isEntityReferneceWellFormed((EntityReference) child); break; default : } } // TODO: // WFC: Check if the attribute prefix is bound to // http://www.w3.org/2000/xmlns/ // WFC: Unique Att Spec // Perhaps pass a seen boolean value to this method. serializeAttList will determine // if the attr was seen before. }
java
protected void isAttributeWellFormed(Node node) { boolean isNameWF = false; if ((fFeatures & NAMESPACES) != 0) { isNameWF = isValidQName( node.getPrefix(), node.getLocalName(), fIsXMLVersion11); } else { isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11); } if (!isNameWF) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "Attr", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Check the Attr's node value // WFC: No < in Attribute Values String value = node.getNodeValue(); if (value.indexOf('<') >= 0) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_LT_IN_ATTVAL, new Object[] { ((Attr) node).getOwnerElement().getNodeName(), node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_LT_IN_ATTVAL, null, null, null)); } } // we need to loop through the children of attr nodes and check their values for // well-formedness NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); // An attribute node with no text or entity ref child for example // doc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns"); // followes by // element.setAttributeNodeNS(attribute); // can potentially lead to this situation. If the attribute // was a prefix Namespace attribute declaration then then DOM Core // should have some exception defined for this. if (child == null) { // we should probably report an error continue; } switch (child.getNodeType()) { case Node.TEXT_NODE : isTextWellFormed((Text) child); break; case Node.ENTITY_REFERENCE_NODE : isEntityReferneceWellFormed((EntityReference) child); break; default : } } // TODO: // WFC: Check if the attribute prefix is bound to // http://www.w3.org/2000/xmlns/ // WFC: Unique Att Spec // Perhaps pass a seen boolean value to this method. serializeAttList will determine // if the attr was seen before. }
[ "protected", "void", "isAttributeWellFormed", "(", "Node", "node", ")", "{", "boolean", "isNameWF", "=", "false", ";", "if", "(", "(", "fFeatures", "&", "NAMESPACES", ")", "!=", "0", ")", "{", "isNameWF", "=", "isValidQName", "(", "node", ".", "getPrefix",...
Checks if an attr node is well-formed, by checking it's Name and value for well-formedness. @param data The contents of the comment node @return a boolean indiacating if the comment is well-formed or not.
[ "Checks", "if", "an", "attr", "node", "is", "well", "-", "formed", "by", "checking", "it", "s", "Name", "and", "value", "for", "well", "-", "formedness", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1435-L1522
34,154
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isPIWellFormed
protected void isPIWellFormed(ProcessingInstruction node) { // Is the PI Target a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "ProcessingInstruction", node.getTarget()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Does the PI Data carry valid XML characters // REVISIT: Should we check if the PI DATA contains a ?> ??? Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
java
protected void isPIWellFormed(ProcessingInstruction node) { // Is the PI Target a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "ProcessingInstruction", node.getTarget()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // Does the PI Data carry valid XML characters // REVISIT: Should we check if the PI DATA contains a ?> ??? Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_PI, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
[ "protected", "void", "isPIWellFormed", "(", "ProcessingInstruction", "node", ")", "{", "// Is the PI Target a valid XML name", "if", "(", "!", "isXMLName", "(", "node", ".", "getNodeName", "(", ")", ",", "fIsXMLVersion11", ")", ")", "{", "String", "msg", "=", "U...
Checks if a PI node is well-formed, by checking it's Name and data for well-formedness. @param data The contents of the comment node
[ "Checks", "if", "a", "PI", "node", "is", "well", "-", "formed", "by", "checking", "it", "s", "Name", "and", "data", "for", "well", "-", "formedness", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1530-L1571
34,155
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isCDATASectionWellFormed
protected void isCDATASectionWellFormed(CDATASection node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); //if (!isWFXMLChar(node.getData(), invalidChar)) { if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
java
protected void isCDATASectionWellFormed(CDATASection node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); //if (!isWFXMLChar(node.getData(), invalidChar)) { if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_CDATA, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
[ "protected", "void", "isCDATASectionWellFormed", "(", "CDATASection", "node", ")", "{", "// Does the data valid XML character data ", "Character", "invalidChar", "=", "isWFXMLChar", "(", "node", ".", "getData", "(", ")", ")", ";", "//if (!isWFXMLChar(node.getData(), ...
Checks if an CDATASection node is well-formed, by checking it's data for well-formedness. Note that the presence of a CDATA termination mark in the contents of a CDATASection is handled by the parameter spli-cdata-sections @param data The contents of the comment node
[ "Checks", "if", "an", "CDATASection", "node", "is", "well", "-", "formed", "by", "checking", "it", "s", "data", "for", "well", "-", "formedness", ".", "Note", "that", "the", "presence", "of", "a", "CDATA", "termination", "mark", "in", "the", "contents", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1581-L1602
34,156
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isTextWellFormed
protected void isTextWellFormed(Text node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
java
protected void isTextWellFormed(Text node) { // Does the data valid XML character data Character invalidChar = isWFXMLChar(node.getData()); if (invalidChar != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_TEXT, new Object[] { Integer.toHexString(Character.getNumericValue(invalidChar.charValue())) }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER, null, null, null)); } } }
[ "protected", "void", "isTextWellFormed", "(", "Text", "node", ")", "{", "// Does the data valid XML character data ", "Character", "invalidChar", "=", "isWFXMLChar", "(", "node", ".", "getData", "(", ")", ")", ";", "if", "(", "invalidChar", "!=", "null", ")...
Checks if an Text node is well-formed, by checking if it contains invalid XML characters. @param data The contents of the comment node
[ "Checks", "if", "an", "Text", "node", "is", "well", "-", "formed", "by", "checking", "if", "it", "contains", "invalid", "XML", "characters", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1610-L1630
34,157
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.isEntityReferneceWellFormed
protected void isEntityReferneceWellFormed(EntityReference node) { // Is the EntityReference name a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "EntityReference", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // determine the parent node Node parent = node.getParentNode(); // Traverse the declared entities and check if the nodeName and namespaceURI // of the EntityReference matches an Entity. If so, check the if the notationName // is not null, if so, report an error. DocumentType docType = node.getOwnerDocument().getDoctype(); if (docType != null) { NamedNodeMap entities = docType.getEntities(); for (int i = 0; i < entities.getLength(); i++) { Entity ent = (Entity) entities.item(i); String nodeName = node.getNodeName() == null ? "" : node.getNodeName(); String nodeNamespaceURI = node.getNamespaceURI() == null ? "" : node.getNamespaceURI(); String entName = ent.getNodeName() == null ? "" : ent.getNodeName(); String entNamespaceURI = ent.getNamespaceURI() == null ? "" : ent.getNamespaceURI(); // If referenced in Element content // WFC: Parsed Entity if (parent.getNodeType() == Node.ELEMENT_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_UNPARSED_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_UNPARSED_ENT, null, null, null)); } } } } // end if WFC: Parsed Entity // If referenced in an Attr value // WFC: No External Entity References if (parent.getNodeType() == Node.ATTRIBUTE_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getPublicId() != null || ent.getSystemId() != null || ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, null, null, null)); } } } } //end if WFC: No External Entity References } } }
java
protected void isEntityReferneceWellFormed(EntityReference node) { // Is the EntityReference name a valid XML name if (!isXMLName(node.getNodeName(), fIsXMLVersion11)) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, new Object[] { "EntityReference", node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME, null, null, null)); } } // determine the parent node Node parent = node.getParentNode(); // Traverse the declared entities and check if the nodeName and namespaceURI // of the EntityReference matches an Entity. If so, check the if the notationName // is not null, if so, report an error. DocumentType docType = node.getOwnerDocument().getDoctype(); if (docType != null) { NamedNodeMap entities = docType.getEntities(); for (int i = 0; i < entities.getLength(); i++) { Entity ent = (Entity) entities.item(i); String nodeName = node.getNodeName() == null ? "" : node.getNodeName(); String nodeNamespaceURI = node.getNamespaceURI() == null ? "" : node.getNamespaceURI(); String entName = ent.getNodeName() == null ? "" : ent.getNodeName(); String entNamespaceURI = ent.getNamespaceURI() == null ? "" : ent.getNamespaceURI(); // If referenced in Element content // WFC: Parsed Entity if (parent.getNodeType() == Node.ELEMENT_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_UNPARSED_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_UNPARSED_ENT, null, null, null)); } } } } // end if WFC: Parsed Entity // If referenced in an Attr value // WFC: No External Entity References if (parent.getNodeType() == Node.ATTRIBUTE_NODE) { if (entNamespaceURI.equals(nodeNamespaceURI) && entName.equals(nodeName)) { if (ent.getPublicId() != null || ent.getSystemId() != null || ent.getNotationName() != null) { String msg = Utils.messages.createMessage( MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_WF_REF_TO_EXTERNAL_ENT, null, null, null)); } } } } //end if WFC: No External Entity References } } }
[ "protected", "void", "isEntityReferneceWellFormed", "(", "EntityReference", "node", ")", "{", "// Is the EntityReference name a valid XML name", "if", "(", "!", "isXMLName", "(", "node", ".", "getNodeName", "(", ")", ",", "fIsXMLVersion11", ")", ")", "{", "String", ...
Checks if an EntityRefernece node is well-formed, by checking it's node name. Then depending on whether it is referenced in Element content or in an Attr Node, checks if the EntityReference references an unparsed entity or a external entity and if so throws raises the appropriate well-formedness error. @param data The contents of the comment node @parent The parent of the EntityReference Node
[ "Checks", "if", "an", "EntityRefernece", "node", "is", "well", "-", "formed", "by", "checking", "it", "s", "node", "name", ".", "Then", "depending", "on", "whether", "it", "is", "referenced", "in", "Element", "content", "or", "in", "an", "Attr", "Node", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1641-L1738
34,158
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.checkUnboundPrefixInEntRef
protected void checkUnboundPrefixInEntRef(Node node) { Node child, next; for (child = node.getFirstChild(); child != null; child = next) { next = child.getNextSibling(); if (child.getNodeType() == Node.ELEMENT_NODE) { //If a NamespaceURI is not declared for the current //node's prefix, raise a fatal error. String prefix = child.getPrefix(); if (prefix != null && fNSBinder.getURI(prefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), prefix }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } NamedNodeMap attrs = child.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { String attrPrefix = attrs.item(i).getPrefix(); if (attrPrefix != null && fNSBinder.getURI(attrPrefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), attrs.item(i)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } } } if (child.hasChildNodes()) { checkUnboundPrefixInEntRef(child); } } }
java
protected void checkUnboundPrefixInEntRef(Node node) { Node child, next; for (child = node.getFirstChild(); child != null; child = next) { next = child.getNextSibling(); if (child.getNodeType() == Node.ELEMENT_NODE) { //If a NamespaceURI is not declared for the current //node's prefix, raise a fatal error. String prefix = child.getPrefix(); if (prefix != null && fNSBinder.getURI(prefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), prefix }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ELEM_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } NamedNodeMap attrs = child.getAttributes(); for (int i = 0; i < attrs.getLength(); i++) { String attrPrefix = attrs.item(i).getPrefix(); if (attrPrefix != null && fNSBinder.getURI(attrPrefix) == null) { String msg = Utils.messages.createMessage( MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, new Object[] { node.getNodeName(), child.getNodeName(), attrs.item(i)}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_FATAL_ERROR, msg, MsgKey.ER_ATTR_UNBOUND_PREFIX_IN_ENTREF, null, null, null)); } } } } if (child.hasChildNodes()) { checkUnboundPrefixInEntRef(child); } } }
[ "protected", "void", "checkUnboundPrefixInEntRef", "(", "Node", "node", ")", "{", "Node", "child", ",", "next", ";", "for", "(", "child", "=", "node", ".", "getFirstChild", "(", ")", ";", "child", "!=", "null", ";", "child", "=", "next", ")", "{", "nex...
If the configuration parameter "namespaces" is set to true, this methods checks if an entity whose replacement text contains unbound namespace prefixes is referenced in a location where there are no bindings for the namespace prefixes and if so raises a LSException with the error-type "unbound-prefix-in-entity-reference" @param Node, The EntityReference nodes whose children are to be checked
[ "If", "the", "configuration", "parameter", "namespaces", "is", "set", "to", "true", "this", "methods", "checks", "if", "an", "entity", "whose", "replacement", "text", "contains", "unbound", "namespace", "prefixes", "is", "referenced", "in", "a", "location", "whe...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1749-L1813
34,159
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.recordLocalNSDecl
protected void recordLocalNSDecl(Node node) { NamedNodeMap atts = ((Element) node).getAttributes(); int length = atts.getLength(); for (int i = 0; i < length; i++) { Node attr = atts.item(i); String localName = attr.getLocalName(); String attrPrefix = attr.getPrefix(); String attrValue = attr.getNodeValue(); String attrNS = attr.getNamespaceURI(); localName = localName == null || XMLNS_PREFIX.equals(localName) ? "" : localName; attrPrefix = attrPrefix == null ? "" : attrPrefix; attrValue = attrValue == null ? "" : attrValue; attrNS = attrNS == null ? "" : attrNS; // check if attribute is a namespace decl if (XMLNS_URI.equals(attrNS)) { // No prefix may be bound to http://www.w3.org/2000/xmlns/. if (XMLNS_URI.equals(attrValue)) { String msg = Utils.messages.createMessage( MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, new Object[] { attrPrefix, XMLNS_URI }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, null, null, null)); } } else { // store the namespace-declaration if (XMLNS_PREFIX.equals(attrPrefix) ) { // record valid decl if (attrValue.length() != 0) { fNSBinder.declarePrefix(localName, attrValue); } else { // Error; xmlns:prefix="" } } else { // xmlns // empty prefix is always bound ("" or some string) fNSBinder.declarePrefix("", attrValue); } } } } }
java
protected void recordLocalNSDecl(Node node) { NamedNodeMap atts = ((Element) node).getAttributes(); int length = atts.getLength(); for (int i = 0; i < length; i++) { Node attr = atts.item(i); String localName = attr.getLocalName(); String attrPrefix = attr.getPrefix(); String attrValue = attr.getNodeValue(); String attrNS = attr.getNamespaceURI(); localName = localName == null || XMLNS_PREFIX.equals(localName) ? "" : localName; attrPrefix = attrPrefix == null ? "" : attrPrefix; attrValue = attrValue == null ? "" : attrValue; attrNS = attrNS == null ? "" : attrNS; // check if attribute is a namespace decl if (XMLNS_URI.equals(attrNS)) { // No prefix may be bound to http://www.w3.org/2000/xmlns/. if (XMLNS_URI.equals(attrValue)) { String msg = Utils.messages.createMessage( MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, new Object[] { attrPrefix, XMLNS_URI }); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NS_PREFIX_CANNOT_BE_BOUND, null, null, null)); } } else { // store the namespace-declaration if (XMLNS_PREFIX.equals(attrPrefix) ) { // record valid decl if (attrValue.length() != 0) { fNSBinder.declarePrefix(localName, attrValue); } else { // Error; xmlns:prefix="" } } else { // xmlns // empty prefix is always bound ("" or some string) fNSBinder.declarePrefix("", attrValue); } } } } }
[ "protected", "void", "recordLocalNSDecl", "(", "Node", "node", ")", "{", "NamedNodeMap", "atts", "=", "(", "(", "Element", ")", "node", ")", ".", "getAttributes", "(", ")", ";", "int", "length", "=", "atts", ".", "getLength", "(", ")", ";", "for", "(",...
Records local namespace declarations, to be used for normalization later @param Node, The element node, whose namespace declarations are to be recorded
[ "Records", "local", "namespace", "declarations", "to", "be", "used", "for", "normalization", "later" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1823-L1879
34,160
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.fixupElementNS
protected void fixupElementNS(Node node) throws SAXException { String namespaceURI = ((Element) node).getNamespaceURI(); String prefix = ((Element) node).getPrefix(); String localName = ((Element) node).getLocalName(); if (namespaceURI != null) { //if ( Element's prefix/namespace pair (or default namespace, // if no prefix) are within the scope of a binding ) prefix = prefix == null ? "" : prefix; String inScopeNamespaceURI = fNSBinder.getURI(prefix); if ((inScopeNamespaceURI != null && inScopeNamespaceURI.equals(namespaceURI))) { // do nothing, declaration in scope is inherited } else { // Create a local namespace declaration attr for this namespace, // with Element's current prefix (or a default namespace, if // no prefix). If there's a conflicting local declaration // already present, change its value to use this namespace. // Add the xmlns declaration attribute //fNSBinder.pushNamespace(prefix, namespaceURI, fElementDepth); if ((fFeatures & NAMESPACEDECLS) != 0) { if ("".equals(prefix) || "".equals(namespaceURI)) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceURI); } else { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX + ":" + prefix, namespaceURI); } } fLocalNSBinder.declarePrefix(prefix, namespaceURI); fNSBinder.declarePrefix(prefix, namespaceURI); } } else { // Element has no namespace // DOM Level 1 if (localName == null || "".equals(localName)) { // DOM Level 1 node! String msg = Utils.messages.createMessage( MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null, null, null)); } } else { namespaceURI = fNSBinder.getURI(""); if (namespaceURI !=null && namespaceURI.length() > 0) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, ""); fLocalNSBinder.declarePrefix("", ""); fNSBinder.declarePrefix("", ""); } } } }
java
protected void fixupElementNS(Node node) throws SAXException { String namespaceURI = ((Element) node).getNamespaceURI(); String prefix = ((Element) node).getPrefix(); String localName = ((Element) node).getLocalName(); if (namespaceURI != null) { //if ( Element's prefix/namespace pair (or default namespace, // if no prefix) are within the scope of a binding ) prefix = prefix == null ? "" : prefix; String inScopeNamespaceURI = fNSBinder.getURI(prefix); if ((inScopeNamespaceURI != null && inScopeNamespaceURI.equals(namespaceURI))) { // do nothing, declaration in scope is inherited } else { // Create a local namespace declaration attr for this namespace, // with Element's current prefix (or a default namespace, if // no prefix). If there's a conflicting local declaration // already present, change its value to use this namespace. // Add the xmlns declaration attribute //fNSBinder.pushNamespace(prefix, namespaceURI, fElementDepth); if ((fFeatures & NAMESPACEDECLS) != 0) { if ("".equals(prefix) || "".equals(namespaceURI)) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceURI); } else { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX + ":" + prefix, namespaceURI); } } fLocalNSBinder.declarePrefix(prefix, namespaceURI); fNSBinder.declarePrefix(prefix, namespaceURI); } } else { // Element has no namespace // DOM Level 1 if (localName == null || "".equals(localName)) { // DOM Level 1 node! String msg = Utils.messages.createMessage( MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, new Object[] { node.getNodeName()}); if (fErrorHandler != null) { fErrorHandler.handleError( new DOMErrorImpl( DOMError.SEVERITY_ERROR, msg, MsgKey.ER_NULL_LOCAL_ELEMENT_NAME, null, null, null)); } } else { namespaceURI = fNSBinder.getURI(""); if (namespaceURI !=null && namespaceURI.length() > 0) { ((Element)node).setAttributeNS(XMLNS_URI, XMLNS_PREFIX, ""); fLocalNSBinder.declarePrefix("", ""); fNSBinder.declarePrefix("", ""); } } } }
[ "protected", "void", "fixupElementNS", "(", "Node", "node", ")", "throws", "SAXException", "{", "String", "namespaceURI", "=", "(", "(", "Element", ")", "node", ")", ".", "getNamespaceURI", "(", ")", ";", "String", "prefix", "=", "(", "(", "Element", ")", ...
Fixes an element's namespace @param Node, The element node, whose namespace is to be fixed
[ "Fixes", "an", "element", "s", "namespace" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L1886-L1949
34,161
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.initProperties
protected void initProperties(Properties properties) { for (Enumeration keys = properties.keys(); keys.hasMoreElements();) { final String key = (String) keys.nextElement(); // caonical-form // Other features will be enabled or disabled when this is set to true or false. // error-handler; set via the constructor // infoset // Other features will be enabled or disabled when this is set to true // A quick lookup for the given set of properties (cdata-sections ...) final Object iobj = s_propKeys.get(key); if (iobj != null) { if (iobj instanceof Integer) { // Dealing with a property that has a simple bit value that // we need to set // cdata-sections // comments // element-content-whitespace // entities // namespaces // namespace-declarations // split-cdata-sections // well-formed // discard-default-content final int BITFLAG = ((Integer) iobj).intValue(); if ((properties.getProperty(key).endsWith("yes"))) { fFeatures = fFeatures | BITFLAG; } else { fFeatures = fFeatures & ~BITFLAG; } } else { // We are interested in the property, but it is not // a simple bit that we need to set. if ((DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT) .equals(key)) { // format-pretty-print; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setIndent(true); fSerializer.setIndentAmount(3); } else { fSerializer.setIndent(false); } } else if ( (DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL).equals( key)) { // omit-xml-declaration; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setOmitXMLDeclaration(true); } else { fSerializer.setOmitXMLDeclaration(false); } } else if ( ( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION).equals( key)) { // Retreive the value of the XML Version attribute via the xml-version String version = properties.getProperty(key); if ("1.1".equals(version)) { fIsXMLVersion11 = true; fSerializer.setVersion(version); } else { fSerializer.setVersion("1.0"); } } else if ( (DOMConstants.S_XSL_OUTPUT_ENCODING).equals(key)) { // Retreive the value of the XML Encoding attribute String encoding = properties.getProperty(key); if (encoding != null) { fSerializer.setEncoding(encoding); } } else if ((DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES).equals(key)) { // Preserve entity references in the document if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setDTDEntityExpansion(false); } else { fSerializer.setDTDEntityExpansion(true); } } else { // We shouldn't get here, ever, now what? } } } } // Set the newLine character to use if (fNewLine != null) { fSerializer.setOutputProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR, fNewLine); } }
java
protected void initProperties(Properties properties) { for (Enumeration keys = properties.keys(); keys.hasMoreElements();) { final String key = (String) keys.nextElement(); // caonical-form // Other features will be enabled or disabled when this is set to true or false. // error-handler; set via the constructor // infoset // Other features will be enabled or disabled when this is set to true // A quick lookup for the given set of properties (cdata-sections ...) final Object iobj = s_propKeys.get(key); if (iobj != null) { if (iobj instanceof Integer) { // Dealing with a property that has a simple bit value that // we need to set // cdata-sections // comments // element-content-whitespace // entities // namespaces // namespace-declarations // split-cdata-sections // well-formed // discard-default-content final int BITFLAG = ((Integer) iobj).intValue(); if ((properties.getProperty(key).endsWith("yes"))) { fFeatures = fFeatures | BITFLAG; } else { fFeatures = fFeatures & ~BITFLAG; } } else { // We are interested in the property, but it is not // a simple bit that we need to set. if ((DOMConstants.S_DOM3_PROPERTIES_NS + DOMConstants.DOM_FORMAT_PRETTY_PRINT) .equals(key)) { // format-pretty-print; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setIndent(true); fSerializer.setIndentAmount(3); } else { fSerializer.setIndent(false); } } else if ( (DOMConstants.S_XSL_OUTPUT_OMIT_XML_DECL).equals( key)) { // omit-xml-declaration; set internally on the serializers via xsl:output properties in LSSerializer if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setOmitXMLDeclaration(true); } else { fSerializer.setOmitXMLDeclaration(false); } } else if ( ( DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.S_XML_VERSION).equals( key)) { // Retreive the value of the XML Version attribute via the xml-version String version = properties.getProperty(key); if ("1.1".equals(version)) { fIsXMLVersion11 = true; fSerializer.setVersion(version); } else { fSerializer.setVersion("1.0"); } } else if ( (DOMConstants.S_XSL_OUTPUT_ENCODING).equals(key)) { // Retreive the value of the XML Encoding attribute String encoding = properties.getProperty(key); if (encoding != null) { fSerializer.setEncoding(encoding); } } else if ((DOMConstants.S_XERCES_PROPERTIES_NS + DOMConstants.DOM_ENTITIES).equals(key)) { // Preserve entity references in the document if ((properties.getProperty(key).endsWith("yes"))) { fSerializer.setDTDEntityExpansion(false); } else { fSerializer.setDTDEntityExpansion(true); } } else { // We shouldn't get here, ever, now what? } } } } // Set the newLine character to use if (fNewLine != null) { fSerializer.setOutputProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR, fNewLine); } }
[ "protected", "void", "initProperties", "(", "Properties", "properties", ")", "{", "for", "(", "Enumeration", "keys", "=", "properties", ".", "keys", "(", ")", ";", "keys", ".", "hasMoreElements", "(", ")", ";", ")", "{", "final", "String", "key", "=", "(...
Initializes fFeatures based on the DOMConfiguration Parameters set. @param properties DOMConfiguraiton properties that were set and which are to be used while serializing the DOM.
[ "Initializes", "fFeatures", "based", "on", "the", "DOMConfiguration", "Parameters", "set", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L2049-L2147
34,162
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryInitialize
private void tryInitialize(boolean checkTermination) { if (runState == 0) { // bootstrap by locking static field int p = config & SMASK; int n = (p > 1) ? p - 1 : 1; // ensure at least 2 slots n |= n >>> 1; // create workQueues array with size a power of two n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; n = ((n + 1) << 1) & SMASK; AuxState aux = new AuxState(); WorkQueue[] ws = new WorkQueue[n]; synchronized (modifyThreadPermission) { // double-check if (runState == 0) { workQueues = ws; auxState = aux; runState = STARTED; } } } if (checkTermination && runState < 0) { tryTerminate(false, false); // help terminate throw new RejectedExecutionException(); } }
java
private void tryInitialize(boolean checkTermination) { if (runState == 0) { // bootstrap by locking static field int p = config & SMASK; int n = (p > 1) ? p - 1 : 1; // ensure at least 2 slots n |= n >>> 1; // create workQueues array with size a power of two n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; n = ((n + 1) << 1) & SMASK; AuxState aux = new AuxState(); WorkQueue[] ws = new WorkQueue[n]; synchronized (modifyThreadPermission) { // double-check if (runState == 0) { workQueues = ws; auxState = aux; runState = STARTED; } } } if (checkTermination && runState < 0) { tryTerminate(false, false); // help terminate throw new RejectedExecutionException(); } }
[ "private", "void", "tryInitialize", "(", "boolean", "checkTermination", ")", "{", "if", "(", "runState", "==", "0", ")", "{", "// bootstrap by locking static field", "int", "p", "=", "config", "&", "SMASK", ";", "int", "n", "=", "(", "p", ">", "1", ")", ...
Instantiates fields upon first submission, or upon shutdown if no submissions. If checkTermination true, also responds to termination by external calls submitting tasks.
[ "Instantiates", "fields", "upon", "first", "submission", "or", "upon", "shutdown", "if", "no", "submissions", ".", "If", "checkTermination", "true", "also", "responds", "to", "termination", "by", "external", "calls", "submitting", "tasks", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1503-L1527
34,163
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.createWorker
private boolean createWorker(boolean isSpare) { ForkJoinWorkerThreadFactory fac = factory; Throwable ex = null; ForkJoinWorkerThread wt = null; WorkQueue q; try { if (fac != null && (wt = fac.newThread(this)) != null) { if (isSpare && (q = wt.workQueue) != null) q.config |= SPARE_WORKER; wt.start(); return true; } } catch (Throwable rex) { ex = rex; } deregisterWorker(wt, ex); return false; }
java
private boolean createWorker(boolean isSpare) { ForkJoinWorkerThreadFactory fac = factory; Throwable ex = null; ForkJoinWorkerThread wt = null; WorkQueue q; try { if (fac != null && (wt = fac.newThread(this)) != null) { if (isSpare && (q = wt.workQueue) != null) q.config |= SPARE_WORKER; wt.start(); return true; } } catch (Throwable rex) { ex = rex; } deregisterWorker(wt, ex); return false; }
[ "private", "boolean", "createWorker", "(", "boolean", "isSpare", ")", "{", "ForkJoinWorkerThreadFactory", "fac", "=", "factory", ";", "Throwable", "ex", "=", "null", ";", "ForkJoinWorkerThread", "wt", "=", "null", ";", "WorkQueue", "q", ";", "try", "{", "if", ...
Tries to construct and start one worker. Assumes that total count has already been incremented as a reservation. Invokes deregisterWorker on any failure. @param isSpare true if this is a spare thread @return true if successful
[ "Tries", "to", "construct", "and", "start", "one", "worker", ".", "Assumes", "that", "total", "count", "has", "already", "been", "incremented", "as", "a", "reservation", ".", "Invokes", "deregisterWorker", "on", "any", "failure", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1539-L1556
34,164
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryAddWorker
private void tryAddWorker(long c) { do { long nc = ((AC_MASK & (c + AC_UNIT)) | (TC_MASK & (c + TC_UNIT))); if (ctl == c && U.compareAndSwapLong(this, CTL, c, nc)) { createWorker(false); break; } } while (((c = ctl) & ADD_WORKER) != 0L && (int)c == 0); }
java
private void tryAddWorker(long c) { do { long nc = ((AC_MASK & (c + AC_UNIT)) | (TC_MASK & (c + TC_UNIT))); if (ctl == c && U.compareAndSwapLong(this, CTL, c, nc)) { createWorker(false); break; } } while (((c = ctl) & ADD_WORKER) != 0L && (int)c == 0); }
[ "private", "void", "tryAddWorker", "(", "long", "c", ")", "{", "do", "{", "long", "nc", "=", "(", "(", "AC_MASK", "&", "(", "c", "+", "AC_UNIT", ")", ")", "|", "(", "TC_MASK", "&", "(", "c", "+", "TC_UNIT", ")", ")", ")", ";", "if", "(", "ctl...
Tries to add one worker, incrementing ctl counts before doing so, relying on createWorker to back out on failure. @param c incoming ctl value, with total count negative and no idle workers. On CAS failure, c is refreshed and retried if this holds (otherwise, a new worker is not needed).
[ "Tries", "to", "add", "one", "worker", "incrementing", "ctl", "counts", "before", "doing", "so", "relying", "on", "createWorker", "to", "back", "out", "on", "failure", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1566-L1575
34,165
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.deregisterWorker
final void deregisterWorker(ForkJoinWorkerThread wt, Throwable ex) { WorkQueue w = null; if (wt != null && (w = wt.workQueue) != null) { AuxState aux; WorkQueue[] ws; // remove index from array int idx = w.config & SMASK; int ns = w.nsteals; if ((aux = auxState) != null) { aux.lock(); try { if ((ws = workQueues) != null && ws.length > idx && ws[idx] == w) ws[idx] = null; aux.stealCount += ns; } finally { aux.unlock(); } } } if (w == null || (w.config & UNREGISTERED) == 0) { // else pre-adjusted long c; // decrement counts do {} while (!U.compareAndSwapLong (this, CTL, c = ctl, ((AC_MASK & (c - AC_UNIT)) | (TC_MASK & (c - TC_UNIT)) | (SP_MASK & c)))); } if (w != null) { w.currentSteal = null; w.qlock = -1; // ensure set w.cancelAll(); // cancel remaining tasks } while (tryTerminate(false, false) >= 0) { // possibly replace WorkQueue[] ws; int wl, sp; long c; if (w == null || w.array == null || (ws = workQueues) == null || (wl = ws.length) <= 0) break; else if ((sp = (int)(c = ctl)) != 0) { // wake up replacement if (tryRelease(c, ws[(wl - 1) & sp], AC_UNIT)) break; } else if (ex != null && (c & ADD_WORKER) != 0L) { tryAddWorker(c); // create replacement break; } else // don't need replacement break; } if (ex == null) // help clean on way out ForkJoinTask.helpExpungeStaleExceptions(); else // rethrow ForkJoinTask.rethrow(ex); }
java
final void deregisterWorker(ForkJoinWorkerThread wt, Throwable ex) { WorkQueue w = null; if (wt != null && (w = wt.workQueue) != null) { AuxState aux; WorkQueue[] ws; // remove index from array int idx = w.config & SMASK; int ns = w.nsteals; if ((aux = auxState) != null) { aux.lock(); try { if ((ws = workQueues) != null && ws.length > idx && ws[idx] == w) ws[idx] = null; aux.stealCount += ns; } finally { aux.unlock(); } } } if (w == null || (w.config & UNREGISTERED) == 0) { // else pre-adjusted long c; // decrement counts do {} while (!U.compareAndSwapLong (this, CTL, c = ctl, ((AC_MASK & (c - AC_UNIT)) | (TC_MASK & (c - TC_UNIT)) | (SP_MASK & c)))); } if (w != null) { w.currentSteal = null; w.qlock = -1; // ensure set w.cancelAll(); // cancel remaining tasks } while (tryTerminate(false, false) >= 0) { // possibly replace WorkQueue[] ws; int wl, sp; long c; if (w == null || w.array == null || (ws = workQueues) == null || (wl = ws.length) <= 0) break; else if ((sp = (int)(c = ctl)) != 0) { // wake up replacement if (tryRelease(c, ws[(wl - 1) & sp], AC_UNIT)) break; } else if (ex != null && (c & ADD_WORKER) != 0L) { tryAddWorker(c); // create replacement break; } else // don't need replacement break; } if (ex == null) // help clean on way out ForkJoinTask.helpExpungeStaleExceptions(); else // rethrow ForkJoinTask.rethrow(ex); }
[ "final", "void", "deregisterWorker", "(", "ForkJoinWorkerThread", "wt", ",", "Throwable", "ex", ")", "{", "WorkQueue", "w", "=", "null", ";", "if", "(", "wt", "!=", "null", "&&", "(", "w", "=", "wt", ".", "workQueue", ")", "!=", "null", ")", "{", "Au...
Final callback from terminating worker, as well as upon failure to construct or start a worker. Removes record of worker from array, and adjusts counts. If pool is shutting down, tries to complete termination. @param wt the worker thread, or null if construction failed @param ex the exception causing failure, or null if none
[ "Final", "callback", "from", "terminating", "worker", "as", "well", "as", "upon", "failure", "to", "construct", "or", "start", "a", "worker", ".", "Removes", "record", "of", "worker", "from", "array", "and", "adjusts", "counts", ".", "If", "pool", "is", "s...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1633-L1683
34,166
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.signalWork
final void signalWork() { for (;;) { long c; int sp, i; WorkQueue v; WorkQueue[] ws; if ((c = ctl) >= 0L) // enough workers break; else if ((sp = (int)c) == 0) { // no idle workers if ((c & ADD_WORKER) != 0L) // too few workers tryAddWorker(c); break; } else if ((ws = workQueues) == null) break; // unstarted/terminated else if (ws.length <= (i = sp & SMASK)) break; // terminated else if ((v = ws[i]) == null) break; // terminating else { int ns = sp & ~UNSIGNALLED; int vs = v.scanState; long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + AC_UNIT)); if (sp == vs && U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = ns; LockSupport.unpark(v.parker); break; } } } }
java
final void signalWork() { for (;;) { long c; int sp, i; WorkQueue v; WorkQueue[] ws; if ((c = ctl) >= 0L) // enough workers break; else if ((sp = (int)c) == 0) { // no idle workers if ((c & ADD_WORKER) != 0L) // too few workers tryAddWorker(c); break; } else if ((ws = workQueues) == null) break; // unstarted/terminated else if (ws.length <= (i = sp & SMASK)) break; // terminated else if ((v = ws[i]) == null) break; // terminating else { int ns = sp & ~UNSIGNALLED; int vs = v.scanState; long nc = (v.stackPred & SP_MASK) | (UC_MASK & (c + AC_UNIT)); if (sp == vs && U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = ns; LockSupport.unpark(v.parker); break; } } } }
[ "final", "void", "signalWork", "(", ")", "{", "for", "(", ";", ";", ")", "{", "long", "c", ";", "int", "sp", ",", "i", ";", "WorkQueue", "v", ";", "WorkQueue", "[", "]", "ws", ";", "if", "(", "(", "c", "=", "ctl", ")", ">=", "0L", ")", "// ...
Tries to create or activate a worker if too few are active.
[ "Tries", "to", "create", "or", "activate", "a", "worker", "if", "too", "few", "are", "active", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1690-L1717
34,167
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.inactivate
private void inactivate(WorkQueue w, int ss) { int ns = (ss + SS_SEQ) | UNSIGNALLED; long lc = ns & SP_MASK, nc, c; if (w != null) { w.scanState = ns; do { nc = lc | (UC_MASK & ((c = ctl) - AC_UNIT)); w.stackPred = (int)c; } while (!U.compareAndSwapLong(this, CTL, c, nc)); } }
java
private void inactivate(WorkQueue w, int ss) { int ns = (ss + SS_SEQ) | UNSIGNALLED; long lc = ns & SP_MASK, nc, c; if (w != null) { w.scanState = ns; do { nc = lc | (UC_MASK & ((c = ctl) - AC_UNIT)); w.stackPred = (int)c; } while (!U.compareAndSwapLong(this, CTL, c, nc)); } }
[ "private", "void", "inactivate", "(", "WorkQueue", "w", ",", "int", "ss", ")", "{", "int", "ns", "=", "(", "ss", "+", "SS_SEQ", ")", "|", "UNSIGNALLED", ";", "long", "lc", "=", "ns", "&", "SP_MASK", ",", "nc", ",", "c", ";", "if", "(", "w", "!=...
If worker w exists and is active, enqueues and sets status to inactive. @param w the worker @param ss current (non-negative) scanState
[ "If", "worker", "w", "exists", "and", "is", "active", "enqueues", "and", "sets", "status", "to", "inactive", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1775-L1785
34,168
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryDropSpare
private boolean tryDropSpare(WorkQueue w) { if (w != null && w.isEmpty()) { // no local tasks long c; int sp, wl; WorkQueue[] ws; WorkQueue v; while ((short)((c = ctl) >> TC_SHIFT) > 0 && ((sp = (int)c) != 0 || (int)(c >> AC_SHIFT) > 0) && (ws = workQueues) != null && (wl = ws.length) > 0) { boolean dropped, canDrop; if (sp == 0) { // no queued workers long nc = ((AC_MASK & (c - AC_UNIT)) | (TC_MASK & (c - TC_UNIT)) | (SP_MASK & c)); dropped = U.compareAndSwapLong(this, CTL, c, nc); } else if ( (v = ws[(wl - 1) & sp]) == null || v.scanState != sp) dropped = false; // stale; retry else { long nc = v.stackPred & SP_MASK; if (w == v || w.scanState >= 0) { canDrop = true; // w unqueued or topmost nc |= ((AC_MASK & c) | // ensure replacement (TC_MASK & (c - TC_UNIT))); } else { // w may be queued canDrop = false; // help uncover nc |= ((AC_MASK & (c + AC_UNIT)) | (TC_MASK & c)); } if (U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = sp & ~UNSIGNALLED; LockSupport.unpark(v.parker); dropped = canDrop; } else dropped = false; } if (dropped) { // pre-deregister int cfg = w.config, idx = cfg & SMASK; if (idx >= 0 && idx < ws.length && ws[idx] == w) ws[idx] = null; w.config = cfg | UNREGISTERED; w.qlock = -1; return true; } } } return false; }
java
private boolean tryDropSpare(WorkQueue w) { if (w != null && w.isEmpty()) { // no local tasks long c; int sp, wl; WorkQueue[] ws; WorkQueue v; while ((short)((c = ctl) >> TC_SHIFT) > 0 && ((sp = (int)c) != 0 || (int)(c >> AC_SHIFT) > 0) && (ws = workQueues) != null && (wl = ws.length) > 0) { boolean dropped, canDrop; if (sp == 0) { // no queued workers long nc = ((AC_MASK & (c - AC_UNIT)) | (TC_MASK & (c - TC_UNIT)) | (SP_MASK & c)); dropped = U.compareAndSwapLong(this, CTL, c, nc); } else if ( (v = ws[(wl - 1) & sp]) == null || v.scanState != sp) dropped = false; // stale; retry else { long nc = v.stackPred & SP_MASK; if (w == v || w.scanState >= 0) { canDrop = true; // w unqueued or topmost nc |= ((AC_MASK & c) | // ensure replacement (TC_MASK & (c - TC_UNIT))); } else { // w may be queued canDrop = false; // help uncover nc |= ((AC_MASK & (c + AC_UNIT)) | (TC_MASK & c)); } if (U.compareAndSwapLong(this, CTL, c, nc)) { v.scanState = sp & ~UNSIGNALLED; LockSupport.unpark(v.parker); dropped = canDrop; } else dropped = false; } if (dropped) { // pre-deregister int cfg = w.config, idx = cfg & SMASK; if (idx >= 0 && idx < ws.length && ws[idx] == w) ws[idx] = null; w.config = cfg | UNREGISTERED; w.qlock = -1; return true; } } } return false; }
[ "private", "boolean", "tryDropSpare", "(", "WorkQueue", "w", ")", "{", "if", "(", "w", "!=", "null", "&&", "w", ".", "isEmpty", "(", ")", ")", "{", "// no local tasks", "long", "c", ";", "int", "sp", ",", "wl", ";", "WorkQueue", "[", "]", "ws", ";"...
If the given worker is a spare with no queued tasks, and there are enough existing workers, drops it from ctl counts and sets its state to terminated. @param w the calling worker -- must be a spare @return true if dropped (in which case it must not process more tasks)
[ "If", "the", "given", "worker", "is", "a", "spare", "with", "no", "queued", "tasks", "and", "there", "are", "enough", "existing", "workers", "drops", "it", "from", "ctl", "counts", "and", "sets", "its", "state", "to", "terminated", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L1875-L1921
34,169
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.nextTaskFor
final ForkJoinTask<?> nextTaskFor(WorkQueue w) { for (ForkJoinTask<?> t;;) { WorkQueue q; if ((t = w.nextLocalTask()) != null) return t; if ((q = findNonEmptyStealQueue()) == null) return null; if ((t = q.pollAt(q.base)) != null) return t; } }
java
final ForkJoinTask<?> nextTaskFor(WorkQueue w) { for (ForkJoinTask<?> t;;) { WorkQueue q; if ((t = w.nextLocalTask()) != null) return t; if ((q = findNonEmptyStealQueue()) == null) return null; if ((t = q.pollAt(q.base)) != null) return t; } }
[ "final", "ForkJoinTask", "<", "?", ">", "nextTaskFor", "(", "WorkQueue", "w", ")", "{", "for", "(", "ForkJoinTask", "<", "?", ">", "t", ";", ";", ")", "{", "WorkQueue", "q", ";", "if", "(", "(", "t", "=", "w", ".", "nextLocalTask", "(", ")", ")",...
Gets and removes a local or stolen task for the given worker. @return a task, if available
[ "Gets", "and", "removes", "a", "local", "or", "stolen", "task", "for", "the", "given", "worker", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2329-L2339
34,170
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryCreateExternalQueue
private void tryCreateExternalQueue(int index) { AuxState aux; if ((aux = auxState) != null && index >= 0) { WorkQueue q = new WorkQueue(this, null); q.config = index; q.scanState = ~UNSIGNALLED; q.qlock = 1; // lock queue boolean installed = false; aux.lock(); try { // lock pool to install WorkQueue[] ws; if ((ws = workQueues) != null && index < ws.length && ws[index] == null) { ws[index] = q; // else throw away installed = true; } } finally { aux.unlock(); } if (installed) { try { q.growArray(); } finally { q.qlock = 0; } } } }
java
private void tryCreateExternalQueue(int index) { AuxState aux; if ((aux = auxState) != null && index >= 0) { WorkQueue q = new WorkQueue(this, null); q.config = index; q.scanState = ~UNSIGNALLED; q.qlock = 1; // lock queue boolean installed = false; aux.lock(); try { // lock pool to install WorkQueue[] ws; if ((ws = workQueues) != null && index < ws.length && ws[index] == null) { ws[index] = q; // else throw away installed = true; } } finally { aux.unlock(); } if (installed) { try { q.growArray(); } finally { q.qlock = 0; } } } }
[ "private", "void", "tryCreateExternalQueue", "(", "int", "index", ")", "{", "AuxState", "aux", ";", "if", "(", "(", "aux", "=", "auxState", ")", "!=", "null", "&&", "index", ">=", "0", ")", "{", "WorkQueue", "q", "=", "new", "WorkQueue", "(", "this", ...
Constructs and tries to install a new external queue, failing if the workQueues array already has a queue at the given index. @param index the index of the new queue
[ "Constructs", "and", "tries", "to", "install", "a", "new", "external", "queue", "failing", "if", "the", "workQueues", "array", "already", "has", "a", "queue", "at", "the", "given", "index", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2487-L2514
34,171
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.externalPush
final void externalPush(ForkJoinTask<?> task) { int r; // initialize caller's probe if ((r = ThreadLocalRandom.getProbe()) == 0) { ThreadLocalRandom.localInit(); r = ThreadLocalRandom.getProbe(); } for (;;) { WorkQueue q; int wl, k, stat; int rs = runState; WorkQueue[] ws = workQueues; if (rs <= 0 || ws == null || (wl = ws.length) <= 0) tryInitialize(true); else if ((q = ws[k = (wl - 1) & r & SQMASK]) == null) tryCreateExternalQueue(k); else if ((stat = q.sharedPush(task)) < 0) break; else if (stat == 0) { signalWork(); break; } else // move if busy r = ThreadLocalRandom.advanceProbe(r); } }
java
final void externalPush(ForkJoinTask<?> task) { int r; // initialize caller's probe if ((r = ThreadLocalRandom.getProbe()) == 0) { ThreadLocalRandom.localInit(); r = ThreadLocalRandom.getProbe(); } for (;;) { WorkQueue q; int wl, k, stat; int rs = runState; WorkQueue[] ws = workQueues; if (rs <= 0 || ws == null || (wl = ws.length) <= 0) tryInitialize(true); else if ((q = ws[k = (wl - 1) & r & SQMASK]) == null) tryCreateExternalQueue(k); else if ((stat = q.sharedPush(task)) < 0) break; else if (stat == 0) { signalWork(); break; } else // move if busy r = ThreadLocalRandom.advanceProbe(r); } }
[ "final", "void", "externalPush", "(", "ForkJoinTask", "<", "?", ">", "task", ")", "{", "int", "r", ";", "// initialize caller's probe", "if", "(", "(", "r", "=", "ThreadLocalRandom", ".", "getProbe", "(", ")", ")", "==", "0", ")", "{", "ThreadLocalRandom",...
Adds the given task to a submission queue at submitter's current queue. Also performs secondary initialization upon the first submission of the first task to the pool, and detects first submission by an external thread and creates a new shared queue if the one at index if empty or contended. @param task the task. Caller must ensure non-null.
[ "Adds", "the", "given", "task", "to", "a", "submission", "queue", "at", "submitter", "s", "current", "queue", ".", "Also", "performs", "secondary", "initialization", "upon", "the", "first", "submission", "of", "the", "first", "task", "to", "the", "pool", "an...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2525-L2548
34,172
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.externalSubmit
private <T> ForkJoinTask<T> externalSubmit(ForkJoinTask<T> task) { Thread t; ForkJoinWorkerThread w; WorkQueue q; if (task == null) throw new NullPointerException(); if (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) && (w = (ForkJoinWorkerThread)t).pool == this && (q = w.workQueue) != null) q.push(task); else externalPush(task); return task; }
java
private <T> ForkJoinTask<T> externalSubmit(ForkJoinTask<T> task) { Thread t; ForkJoinWorkerThread w; WorkQueue q; if (task == null) throw new NullPointerException(); if (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) && (w = (ForkJoinWorkerThread)t).pool == this && (q = w.workQueue) != null) q.push(task); else externalPush(task); return task; }
[ "private", "<", "T", ">", "ForkJoinTask", "<", "T", ">", "externalSubmit", "(", "ForkJoinTask", "<", "T", ">", "task", ")", "{", "Thread", "t", ";", "ForkJoinWorkerThread", "w", ";", "WorkQueue", "q", ";", "if", "(", "task", "==", "null", ")", "throw",...
Pushes a possibly-external submission.
[ "Pushes", "a", "possibly", "-", "external", "submission", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2553-L2564
34,173
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.commonSubmitterQueue
static WorkQueue commonSubmitterQueue() { ForkJoinPool p = common; int r = ThreadLocalRandom.getProbe(); WorkQueue[] ws; int wl; return (p != null && (ws = p.workQueues) != null && (wl = ws.length) > 0) ? ws[(wl - 1) & r & SQMASK] : null; }
java
static WorkQueue commonSubmitterQueue() { ForkJoinPool p = common; int r = ThreadLocalRandom.getProbe(); WorkQueue[] ws; int wl; return (p != null && (ws = p.workQueues) != null && (wl = ws.length) > 0) ? ws[(wl - 1) & r & SQMASK] : null; }
[ "static", "WorkQueue", "commonSubmitterQueue", "(", ")", "{", "ForkJoinPool", "p", "=", "common", ";", "int", "r", "=", "ThreadLocalRandom", ".", "getProbe", "(", ")", ";", "WorkQueue", "[", "]", "ws", ";", "int", "wl", ";", "return", "(", "p", "!=", "...
Returns common pool queue for an external thread.
[ "Returns", "common", "pool", "queue", "for", "an", "external", "thread", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2569-L2576
34,174
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.tryExternalUnpush
final boolean tryExternalUnpush(ForkJoinTask<?> task) { int r = ThreadLocalRandom.getProbe(); WorkQueue[] ws; WorkQueue w; int wl; return ((ws = workQueues) != null && (wl = ws.length) > 0 && (w = ws[(wl - 1) & r & SQMASK]) != null && w.trySharedUnpush(task)); }
java
final boolean tryExternalUnpush(ForkJoinTask<?> task) { int r = ThreadLocalRandom.getProbe(); WorkQueue[] ws; WorkQueue w; int wl; return ((ws = workQueues) != null && (wl = ws.length) > 0 && (w = ws[(wl - 1) & r & SQMASK]) != null && w.trySharedUnpush(task)); }
[ "final", "boolean", "tryExternalUnpush", "(", "ForkJoinTask", "<", "?", ">", "task", ")", "{", "int", "r", "=", "ThreadLocalRandom", ".", "getProbe", "(", ")", ";", "WorkQueue", "[", "]", "ws", ";", "WorkQueue", "w", ";", "int", "wl", ";", "return", "(...
Performs tryUnpush for an external submitter.
[ "Performs", "tryUnpush", "for", "an", "external", "submitter", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2581-L2588
34,175
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java
ForkJoinPool.externalHelpComplete
final int externalHelpComplete(CountedCompleter<?> task, int maxTasks) { WorkQueue[] ws; int wl; int r = ThreadLocalRandom.getProbe(); return ((ws = workQueues) != null && (wl = ws.length) > 0) ? helpComplete(ws[(wl - 1) & r & SQMASK], task, maxTasks) : 0; }
java
final int externalHelpComplete(CountedCompleter<?> task, int maxTasks) { WorkQueue[] ws; int wl; int r = ThreadLocalRandom.getProbe(); return ((ws = workQueues) != null && (wl = ws.length) > 0) ? helpComplete(ws[(wl - 1) & r & SQMASK], task, maxTasks) : 0; }
[ "final", "int", "externalHelpComplete", "(", "CountedCompleter", "<", "?", ">", "task", ",", "int", "maxTasks", ")", "{", "WorkQueue", "[", "]", "ws", ";", "int", "wl", ";", "int", "r", "=", "ThreadLocalRandom", ".", "getProbe", "(", ")", ";", "return", ...
Performs helpComplete for an external submitter.
[ "Performs", "helpComplete", "for", "an", "external", "submitter", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2593-L2598
34,176
google/j2objc
jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
StandardBeanInfo.introspectEvents
@SuppressWarnings("unchecked") private EventSetDescriptor[] introspectEvents() throws IntrospectionException { // Get descriptors for the public methods // FIXME: performance MethodDescriptor[] theMethods = introspectMethods(); if (theMethods == null) return null; HashMap<String, HashMap> eventTable = new HashMap<String, HashMap>( theMethods.length); // Search for methods that add an Event Listener for (int i = 0; i < theMethods.length; i++) { introspectListenerMethods(PREFIX_ADD, theMethods[i].getMethod(), eventTable); introspectListenerMethods(PREFIX_REMOVE, theMethods[i].getMethod(), eventTable); introspectGetListenerMethods(theMethods[i].getMethod(), eventTable); } ArrayList<EventSetDescriptor> eventList = new ArrayList<EventSetDescriptor>(); for (Map.Entry<String, HashMap> entry : eventTable.entrySet()) { HashMap table = entry.getValue(); Method add = (Method) table.get(PREFIX_ADD); Method remove = (Method) table.get(PREFIX_REMOVE); if ((add == null) || (remove == null)) { continue; } Method get = (Method) table.get(PREFIX_GET); Class<?> listenerType = (Class) table.get("listenerType"); //$NON-NLS-1$ Method[] listenerMethods = (Method[]) table.get("listenerMethods"); //$NON-NLS-1$ EventSetDescriptor eventSetDescriptor = new EventSetDescriptor( decapitalize(entry.getKey()), listenerType, listenerMethods, add, remove, get); eventSetDescriptor.setUnicast(table.get("isUnicast") != null); //$NON-NLS-1$ eventList.add(eventSetDescriptor); } EventSetDescriptor[] theEvents = new EventSetDescriptor[eventList .size()]; eventList.toArray(theEvents); return theEvents; }
java
@SuppressWarnings("unchecked") private EventSetDescriptor[] introspectEvents() throws IntrospectionException { // Get descriptors for the public methods // FIXME: performance MethodDescriptor[] theMethods = introspectMethods(); if (theMethods == null) return null; HashMap<String, HashMap> eventTable = new HashMap<String, HashMap>( theMethods.length); // Search for methods that add an Event Listener for (int i = 0; i < theMethods.length; i++) { introspectListenerMethods(PREFIX_ADD, theMethods[i].getMethod(), eventTable); introspectListenerMethods(PREFIX_REMOVE, theMethods[i].getMethod(), eventTable); introspectGetListenerMethods(theMethods[i].getMethod(), eventTable); } ArrayList<EventSetDescriptor> eventList = new ArrayList<EventSetDescriptor>(); for (Map.Entry<String, HashMap> entry : eventTable.entrySet()) { HashMap table = entry.getValue(); Method add = (Method) table.get(PREFIX_ADD); Method remove = (Method) table.get(PREFIX_REMOVE); if ((add == null) || (remove == null)) { continue; } Method get = (Method) table.get(PREFIX_GET); Class<?> listenerType = (Class) table.get("listenerType"); //$NON-NLS-1$ Method[] listenerMethods = (Method[]) table.get("listenerMethods"); //$NON-NLS-1$ EventSetDescriptor eventSetDescriptor = new EventSetDescriptor( decapitalize(entry.getKey()), listenerType, listenerMethods, add, remove, get); eventSetDescriptor.setUnicast(table.get("isUnicast") != null); //$NON-NLS-1$ eventList.add(eventSetDescriptor); } EventSetDescriptor[] theEvents = new EventSetDescriptor[eventList .size()]; eventList.toArray(theEvents); return theEvents; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "EventSetDescriptor", "[", "]", "introspectEvents", "(", ")", "throws", "IntrospectionException", "{", "// Get descriptors for the public methods", "// FIXME: performance", "MethodDescriptor", "[", "]", "theMethod...
Introspects the supplied Bean class and returns a list of the Events of the class @return the events @throws IntrospectionException
[ "Introspects", "the", "supplied", "Bean", "class", "and", "returns", "a", "list", "of", "the", "Events", "of", "the", "class" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/StandardBeanInfo.java#L1294-L1341
34,177
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/JumboEnumSet.java
JumboEnumSet.remove
public boolean remove(Object e) { if (e == null) return false; Class<?> eClass = e.getClass(); if (eClass != elementType && eClass.getSuperclass() != elementType) return false; int eOrdinal = ((Enum<?>)e).ordinal(); int eWordNum = eOrdinal >>> 6; long oldElements = elements[eWordNum]; elements[eWordNum] &= ~(1L << eOrdinal); boolean result = (elements[eWordNum] != oldElements); if (result) size--; return result; }
java
public boolean remove(Object e) { if (e == null) return false; Class<?> eClass = e.getClass(); if (eClass != elementType && eClass.getSuperclass() != elementType) return false; int eOrdinal = ((Enum<?>)e).ordinal(); int eWordNum = eOrdinal >>> 6; long oldElements = elements[eWordNum]; elements[eWordNum] &= ~(1L << eOrdinal); boolean result = (elements[eWordNum] != oldElements); if (result) size--; return result; }
[ "public", "boolean", "remove", "(", "Object", "e", ")", "{", "if", "(", "e", "==", "null", ")", "return", "false", ";", "Class", "<", "?", ">", "eClass", "=", "e", ".", "getClass", "(", ")", ";", "if", "(", "eClass", "!=", "elementType", "&&", "e...
Removes the specified element from this set if it is present. @param e element to be removed from this set, if present @return <tt>true</tt> if the set contained the specified element
[ "Removes", "the", "specified", "element", "from", "this", "set", "if", "it", "is", "present", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/JumboEnumSet.java#L221-L236
34,178
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/JumboEnumSet.java
JumboEnumSet.recalculateSize
private boolean recalculateSize() { int oldSize = size; size = 0; for (long elt : elements) size += Long.bitCount(elt); return size != oldSize; }
java
private boolean recalculateSize() { int oldSize = size; size = 0; for (long elt : elements) size += Long.bitCount(elt); return size != oldSize; }
[ "private", "boolean", "recalculateSize", "(", ")", "{", "int", "oldSize", "=", "size", ";", "size", "=", "0", ";", "for", "(", "long", "elt", ":", "elements", ")", "size", "+=", "Long", ".", "bitCount", "(", "elt", ")", ";", "return", "size", "!=", ...
Recalculates the size of the set. Returns true if it's changed.
[ "Recalculates", "the", "size", "of", "the", "set", ".", "Returns", "true", "if", "it", "s", "changed", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/JumboEnumSet.java#L365-L372
34,179
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/DatagramPacket.java
DatagramPacket.setData
public synchronized void setData(byte[] buf, int offset, int length) { /* this will check to see if buf is null */ if (length < 0 || offset < 0 || (length + offset) < 0 || ((length + offset) > buf.length)) { throw new IllegalArgumentException("illegal length or offset"); } this.buf = buf; this.length = length; this.bufLength = length; this.offset = offset; }
java
public synchronized void setData(byte[] buf, int offset, int length) { /* this will check to see if buf is null */ if (length < 0 || offset < 0 || (length + offset) < 0 || ((length + offset) > buf.length)) { throw new IllegalArgumentException("illegal length or offset"); } this.buf = buf; this.length = length; this.bufLength = length; this.offset = offset; }
[ "public", "synchronized", "void", "setData", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "/* this will check to see if buf is null */", "if", "(", "length", "<", "0", "||", "offset", "<", "0", "||", "(", "length", "+...
Set the data buffer for this packet. This sets the data, length and offset of the packet. @param buf the buffer to set for this packet @param offset the offset into the data @param length the length of the data and/or the length of the buffer used to receive data @exception NullPointerException if the argument is null @see #getData @see #getOffset @see #getLength @since 1.2
[ "Set", "the", "data", "buffer", "for", "this", "packet", ".", "This", "sets", "the", "data", "length", "and", "offset", "of", "the", "packet", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/DatagramPacket.java#L261-L272
34,180
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/DatagramPacket.java
DatagramPacket.setLength
public synchronized void setLength(int length) { if ((length + offset) > buf.length || length < 0 || (length + offset) < 0) { throw new IllegalArgumentException("illegal length"); } this.length = length; this.bufLength = this.length; }
java
public synchronized void setLength(int length) { if ((length + offset) > buf.length || length < 0 || (length + offset) < 0) { throw new IllegalArgumentException("illegal length"); } this.length = length; this.bufLength = this.length; }
[ "public", "synchronized", "void", "setLength", "(", "int", "length", ")", "{", "if", "(", "(", "length", "+", "offset", ")", ">", "buf", ".", "length", "||", "length", "<", "0", "||", "(", "length", "+", "offset", ")", "<", "0", ")", "{", "throw", ...
Set the length for this packet. The length of the packet is the number of bytes from the packet's data buffer that will be sent, or the number of bytes of the packet's data buffer that will be used for receiving data. The length must be lesser or equal to the offset plus the length of the packet's buffer. @param length the length to set for this packet. @exception IllegalArgumentException if the length is negative of if the length is greater than the packet's data buffer length. @see #getLength @see #setData @since JDK1.1
[ "Set", "the", "length", "for", "this", "packet", ".", "The", "length", "of", "the", "packet", "is", "the", "number", "of", "bytes", "from", "the", "packet", "s", "data", "buffer", "that", "will", "be", "sent", "or", "the", "number", "of", "bytes", "of"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/DatagramPacket.java#L384-L391
34,181
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Node.casValue
boolean casValue(Object cmp, Object val) { return U.compareAndSwapObject(this, VALUE, cmp, val); }
java
boolean casValue(Object cmp, Object val) { return U.compareAndSwapObject(this, VALUE, cmp, val); }
[ "boolean", "casValue", "(", "Object", "cmp", ",", "Object", "val", ")", "{", "return", "U", ".", "compareAndSwapObject", "(", "this", ",", "VALUE", ",", "cmp", ",", "val", ")", ";", "}" ]
compareAndSet value field.
[ "compareAndSet", "value", "field", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L451-L453
34,182
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Node.casNext
boolean casNext(Node<K,V> cmp, Node<K,V> val) { return U.compareAndSwapObject(this, NEXT, cmp, val); }
java
boolean casNext(Node<K,V> cmp, Node<K,V> val) { return U.compareAndSwapObject(this, NEXT, cmp, val); }
[ "boolean", "casNext", "(", "Node", "<", "K", ",", "V", ">", "cmp", ",", "Node", "<", "K", ",", "V", ">", "val", ")", "{", "return", "U", ".", "compareAndSwapObject", "(", "this", ",", "NEXT", ",", "cmp", ",", "val", ")", ";", "}" ]
compareAndSet next field.
[ "compareAndSet", "next", "field", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L458-L460
34,183
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Node.appendMarker
boolean appendMarker(Node<K,V> f) { return casNext(f, new Node<K,V>(f)); }
java
boolean appendMarker(Node<K,V> f) { return casNext(f, new Node<K,V>(f)); }
[ "boolean", "appendMarker", "(", "Node", "<", "K", ",", "V", ">", "f", ")", "{", "return", "casNext", "(", "f", ",", "new", "Node", "<", "K", ",", "V", ">", "(", "f", ")", ")", ";", "}" ]
Tries to append a deletion marker to this node. @param f the assumed current successor of this node @return true if successful
[ "Tries", "to", "append", "a", "deletion", "marker", "to", "this", "node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L488-L490
34,184
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Node.getValidValue
V getValidValue() { Object v = value; if (v == sentinel() || v == BASE_HEADER) return null; @SuppressWarnings("unchecked") V vv = (V)v; return vv; }
java
V getValidValue() { Object v = value; if (v == sentinel() || v == BASE_HEADER) return null; @SuppressWarnings("unchecked") V vv = (V)v; return vv; }
[ "V", "getValidValue", "(", ")", "{", "Object", "v", "=", "value", ";", "if", "(", "v", "==", "sentinel", "(", ")", "||", "v", "==", "BASE_HEADER", ")", "return", "null", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "V", "vv", "=", "(", ...
Returns value if this node contains a valid key-value pair, else null. @return this node's value if it isn't a marker or header or is deleted, else null
[ "Returns", "value", "if", "this", "node", "contains", "a", "valid", "key", "-", "value", "pair", "else", "null", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L519-L525
34,185
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Node.createSnapshot
AbstractMap.SimpleImmutableEntry<K,V> createSnapshot() { Object v = value; if (v == null || v == sentinel() || v == BASE_HEADER) return null; @SuppressWarnings("unchecked") V vv = (V)v; return new AbstractMap.SimpleImmutableEntry<K,V>(key, vv); }
java
AbstractMap.SimpleImmutableEntry<K,V> createSnapshot() { Object v = value; if (v == null || v == sentinel() || v == BASE_HEADER) return null; @SuppressWarnings("unchecked") V vv = (V)v; return new AbstractMap.SimpleImmutableEntry<K,V>(key, vv); }
[ "AbstractMap", ".", "SimpleImmutableEntry", "<", "K", ",", "V", ">", "createSnapshot", "(", ")", "{", "Object", "v", "=", "value", ";", "if", "(", "v", "==", "null", "||", "v", "==", "sentinel", "(", ")", "||", "v", "==", "BASE_HEADER", ")", "return"...
Creates and returns a new SimpleImmutableEntry holding current mapping if this node holds a valid value, else null. @return new entry or null
[ "Creates", "and", "returns", "a", "new", "SimpleImmutableEntry", "holding", "current", "mapping", "if", "this", "node", "holds", "a", "valid", "value", "else", "null", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L532-L538
34,186
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Index.casRight
final boolean casRight(Index<K,V> cmp, Index<K,V> val) { return U.compareAndSwapObject(this, RIGHT, cmp, val); }
java
final boolean casRight(Index<K,V> cmp, Index<K,V> val) { return U.compareAndSwapObject(this, RIGHT, cmp, val); }
[ "final", "boolean", "casRight", "(", "Index", "<", "K", ",", "V", ">", "cmp", ",", "Index", "<", "K", ",", "V", ">", "val", ")", "{", "return", "U", ".", "compareAndSwapObject", "(", "this", ",", "RIGHT", ",", "cmp", ",", "val", ")", ";", "}" ]
compareAndSet right field.
[ "compareAndSet", "right", "field", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L584-L586
34,187
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java
Index.link
final boolean link(Index<K,V> succ, Index<K,V> newSucc) { Node<K,V> n = node; newSucc.right = succ; return n.value != null && casRight(succ, newSucc); }
java
final boolean link(Index<K,V> succ, Index<K,V> newSucc) { Node<K,V> n = node; newSucc.right = succ; return n.value != null && casRight(succ, newSucc); }
[ "final", "boolean", "link", "(", "Index", "<", "K", ",", "V", ">", "succ", ",", "Index", "<", "K", ",", "V", ">", "newSucc", ")", "{", "Node", "<", "K", ",", "V", ">", "n", "=", "node", ";", "newSucc", ".", "right", "=", "succ", ";", "return"...
Tries to CAS newSucc as successor. To minimize races with unlink that may lose this index node, if the node being indexed is known to be deleted, it doesn't try to link in. @param succ the expected current successor @param newSucc the new successor @return true if successful
[ "Tries", "to", "CAS", "newSucc", "as", "successor", ".", "To", "minimize", "races", "with", "unlink", "that", "may", "lose", "this", "index", "node", "if", "the", "node", "being", "indexed", "is", "known", "to", "be", "deleted", "it", "doesn", "t", "try"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L604-L608
34,188
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java
BitSet.checkInvariants
private void checkInvariants() { assert(wordsInUse == 0 || words[wordsInUse - 1] != 0); assert(wordsInUse >= 0 && wordsInUse <= words.length); assert(wordsInUse == words.length || words[wordsInUse] == 0); }
java
private void checkInvariants() { assert(wordsInUse == 0 || words[wordsInUse - 1] != 0); assert(wordsInUse >= 0 && wordsInUse <= words.length); assert(wordsInUse == words.length || words[wordsInUse] == 0); }
[ "private", "void", "checkInvariants", "(", ")", "{", "assert", "(", "wordsInUse", "==", "0", "||", "words", "[", "wordsInUse", "-", "1", "]", "!=", "0", ")", ";", "assert", "(", "wordsInUse", ">=", "0", "&&", "wordsInUse", "<=", "words", ".", "length",...
Every public method must preserve these invariants.
[ "Every", "public", "method", "must", "preserve", "these", "invariants", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java#L118-L122
34,189
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java
BitSet.valueOf
public static BitSet valueOf(long[] longs) { int n; for (n = longs.length; n > 0 && longs[n - 1] == 0; n--) ; return new BitSet(Arrays.copyOf(longs, n)); }
java
public static BitSet valueOf(long[] longs) { int n; for (n = longs.length; n > 0 && longs[n - 1] == 0; n--) ; return new BitSet(Arrays.copyOf(longs, n)); }
[ "public", "static", "BitSet", "valueOf", "(", "long", "[", "]", "longs", ")", "{", "int", "n", ";", "for", "(", "n", "=", "longs", ".", "length", ";", "n", ">", "0", "&&", "longs", "[", "n", "-", "1", "]", "==", "0", ";", "n", "--", ")", ";...
Returns a new bit set containing all the bits in the given long array. <p>More precisely, <br>{@code BitSet.valueOf(longs).get(n) == ((longs[n/64] & (1L<<(n%64))) != 0)} <br>for all {@code n < 64 * longs.length}. <p>This method is equivalent to {@code BitSet.valueOf(LongBuffer.wrap(longs))}. @param longs a long array containing a little-endian representation of a sequence of bits to be used as the initial bits of the new bit set @return a {@code BitSet} containing all the bits in the long array @since 1.7
[ "Returns", "a", "new", "bit", "set", "containing", "all", "the", "bits", "in", "the", "given", "long", "array", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java#L195-L200
34,190
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java
BitSet.valueOf
public static BitSet valueOf(LongBuffer lb) { lb = lb.slice(); int n; for (n = lb.remaining(); n > 0 && lb.get(n - 1) == 0; n--) ; long[] words = new long[n]; lb.get(words); return new BitSet(words); }
java
public static BitSet valueOf(LongBuffer lb) { lb = lb.slice(); int n; for (n = lb.remaining(); n > 0 && lb.get(n - 1) == 0; n--) ; long[] words = new long[n]; lb.get(words); return new BitSet(words); }
[ "public", "static", "BitSet", "valueOf", "(", "LongBuffer", "lb", ")", "{", "lb", "=", "lb", ".", "slice", "(", ")", ";", "int", "n", ";", "for", "(", "n", "=", "lb", ".", "remaining", "(", ")", ";", "n", ">", "0", "&&", "lb", ".", "get", "("...
Returns a new bit set containing all the bits in the given long buffer between its position and limit. <p>More precisely, <br>{@code BitSet.valueOf(lb).get(n) == ((lb.get(lb.position()+n/64) & (1L<<(n%64))) != 0)} <br>for all {@code n < 64 * lb.remaining()}. <p>The long buffer is not modified by this method, and no reference to the buffer is retained by the bit set. @param lb a long buffer containing a little-endian representation of a sequence of bits between its position and limit, to be used as the initial bits of the new bit set @return a {@code BitSet} containing all the bits in the buffer in the specified range @since 1.7
[ "Returns", "a", "new", "bit", "set", "containing", "all", "the", "bits", "in", "the", "given", "long", "buffer", "between", "its", "position", "and", "limit", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/BitSet.java#L220-L228
34,191
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AVT.java
AVT.getSimpleString
public String getSimpleString() { if (null != m_simpleString){ return m_simpleString; } else if (null != m_parts){ final FastStringBuffer buf = getBuffer(); String out = null; int n = m_parts.size(); try{ for (int i = 0; i < n; i++){ AVTPart part = (AVTPart) m_parts.elementAt(i); buf.append(part.getSimpleString()); } out = buf.toString(); }finally{ if(USE_OBJECT_POOL){ StringBufferPool.free(buf); }else{ buf.setLength(0); }; } return out; }else{ return ""; } }
java
public String getSimpleString() { if (null != m_simpleString){ return m_simpleString; } else if (null != m_parts){ final FastStringBuffer buf = getBuffer(); String out = null; int n = m_parts.size(); try{ for (int i = 0; i < n; i++){ AVTPart part = (AVTPart) m_parts.elementAt(i); buf.append(part.getSimpleString()); } out = buf.toString(); }finally{ if(USE_OBJECT_POOL){ StringBufferPool.free(buf); }else{ buf.setLength(0); }; } return out; }else{ return ""; } }
[ "public", "String", "getSimpleString", "(", ")", "{", "if", "(", "null", "!=", "m_simpleString", ")", "{", "return", "m_simpleString", ";", "}", "else", "if", "(", "null", "!=", "m_parts", ")", "{", "final", "FastStringBuffer", "buf", "=", "getBuffer", "("...
Get the AVT as the original string. @return The AVT as the original string
[ "Get", "the", "AVT", "as", "the", "original", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AVT.java#L445-L473
34,192
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AVT.java
AVT.evaluate
public String evaluate( XPathContext xctxt, int context, org.apache.xml.utils.PrefixResolver nsNode) throws javax.xml.transform.TransformerException { if (null != m_simpleString){ return m_simpleString; }else if (null != m_parts){ final FastStringBuffer buf =getBuffer(); String out = null; int n = m_parts.size(); try{ for (int i = 0; i < n; i++){ AVTPart part = (AVTPart) m_parts.elementAt(i); part.evaluate(xctxt, buf, context, nsNode); } out = buf.toString(); }finally{ if(USE_OBJECT_POOL){ StringBufferPool.free(buf); }else{ buf.setLength(0); } } return out; }else{ return ""; } }
java
public String evaluate( XPathContext xctxt, int context, org.apache.xml.utils.PrefixResolver nsNode) throws javax.xml.transform.TransformerException { if (null != m_simpleString){ return m_simpleString; }else if (null != m_parts){ final FastStringBuffer buf =getBuffer(); String out = null; int n = m_parts.size(); try{ for (int i = 0; i < n; i++){ AVTPart part = (AVTPart) m_parts.elementAt(i); part.evaluate(xctxt, buf, context, nsNode); } out = buf.toString(); }finally{ if(USE_OBJECT_POOL){ StringBufferPool.free(buf); }else{ buf.setLength(0); } } return out; }else{ return ""; } }
[ "public", "String", "evaluate", "(", "XPathContext", "xctxt", ",", "int", "context", ",", "org", ".", "apache", ".", "xml", ".", "utils", ".", "PrefixResolver", "nsNode", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{",...
Evaluate the AVT and return a String. @param xctxt Te XPathContext to use to evaluate this. @param context The current source tree context. @param nsNode The current namespace context (stylesheet tree context). @return The AVT evaluated as a string @throws javax.xml.transform.TransformerException
[ "Evaluate", "the", "AVT", "and", "return", "a", "String", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/AVT.java#L486-L513
34,193
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OtherName.java
OtherName.encode
public void encode(DerOutputStream out) throws IOException { if (gni != null) { // This OtherName has a supported class gni.encode(out); return; } else { // This OtherName has no supporting class DerOutputStream tmp = new DerOutputStream(); tmp.putOID(oid); tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_VALUE), nameValue); out.write(DerValue.tag_Sequence, tmp); } }
java
public void encode(DerOutputStream out) throws IOException { if (gni != null) { // This OtherName has a supported class gni.encode(out); return; } else { // This OtherName has no supporting class DerOutputStream tmp = new DerOutputStream(); tmp.putOID(oid); tmp.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_VALUE), nameValue); out.write(DerValue.tag_Sequence, tmp); } }
[ "public", "void", "encode", "(", "DerOutputStream", "out", ")", "throws", "IOException", "{", "if", "(", "gni", "!=", "null", ")", "{", "// This OtherName has a supported class", "gni", ".", "encode", "(", "out", ")", ";", "return", ";", "}", "else", "{", ...
Encode the Other name into the DerOutputStream. @param out the DER stream to encode the Other-Name to. @exception IOException on encoding errors.
[ "Encode", "the", "Other", "name", "into", "the", "DerOutputStream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OtherName.java#L152-L164
34,194
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/EDIPartyName.java
EDIPartyName.encode
public void encode(DerOutputStream out) throws IOException { DerOutputStream tagged = new DerOutputStream(); DerOutputStream tmp = new DerOutputStream(); if (assigner != null) { DerOutputStream tmp2 = new DerOutputStream(); // XXX - shd check is chars fit into PrintableString tmp2.putPrintableString(assigner); tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ASSIGNER), tmp2); } if (party == null) throw new IOException("Cannot have null partyName"); // XXX - shd check is chars fit into PrintableString tmp.putPrintableString(party); tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_PARTYNAME), tmp); out.write(DerValue.tag_Sequence, tagged); }
java
public void encode(DerOutputStream out) throws IOException { DerOutputStream tagged = new DerOutputStream(); DerOutputStream tmp = new DerOutputStream(); if (assigner != null) { DerOutputStream tmp2 = new DerOutputStream(); // XXX - shd check is chars fit into PrintableString tmp2.putPrintableString(assigner); tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ASSIGNER), tmp2); } if (party == null) throw new IOException("Cannot have null partyName"); // XXX - shd check is chars fit into PrintableString tmp.putPrintableString(party); tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_PARTYNAME), tmp); out.write(DerValue.tag_Sequence, tagged); }
[ "public", "void", "encode", "(", "DerOutputStream", "out", ")", "throws", "IOException", "{", "DerOutputStream", "tagged", "=", "new", "DerOutputStream", "(", ")", ";", "DerOutputStream", "tmp", "=", "new", "DerOutputStream", "(", ")", ";", "if", "(", "assigne...
Encode the EDI party name into the DerOutputStream. @param out the DER stream to encode the EDIPartyName to. @exception IOException on encoding errors.
[ "Encode", "the", "EDI", "party", "name", "into", "the", "DerOutputStream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/EDIPartyName.java#L124-L144
34,195
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/ParenthesizedExpression.java
ParenthesizedExpression.parenthesizeAndReplace
public static ParenthesizedExpression parenthesizeAndReplace(Expression expression) { ParenthesizedExpression newExpr = new ParenthesizedExpression(); expression.replaceWith(newExpr); newExpr.setExpression(expression); return newExpr; }
java
public static ParenthesizedExpression parenthesizeAndReplace(Expression expression) { ParenthesizedExpression newExpr = new ParenthesizedExpression(); expression.replaceWith(newExpr); newExpr.setExpression(expression); return newExpr; }
[ "public", "static", "ParenthesizedExpression", "parenthesizeAndReplace", "(", "Expression", "expression", ")", "{", "ParenthesizedExpression", "newExpr", "=", "new", "ParenthesizedExpression", "(", ")", ";", "expression", ".", "replaceWith", "(", "newExpr", ")", ";", ...
Wraps the given expression with a ParenthesizedExpression and replaces it in the tree.
[ "Wraps", "the", "given", "expression", "with", "a", "ParenthesizedExpression", "and", "replaces", "it", "in", "the", "tree", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/ParenthesizedExpression.java#L46-L51
34,196
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/HeaderMap.java
HeaderMap.inferSourceName
private String inferSourceName(TypeElement type) { if (!ElementUtil.isPublic(type)) { String srcFile = ElementUtil.getSourceFile(type); if (srcFile != null && srcFile.endsWith(".java")) { int lastSlash = Math.max(srcFile.lastIndexOf('/'), srcFile.lastIndexOf('\\')); String baseName = lastSlash > -1 ? srcFile.substring(lastSlash + 1) : srcFile; return baseName.substring(0, baseName.length() - 5); // Remove .java suffix. } } return ElementUtil.getName(type); }
java
private String inferSourceName(TypeElement type) { if (!ElementUtil.isPublic(type)) { String srcFile = ElementUtil.getSourceFile(type); if (srcFile != null && srcFile.endsWith(".java")) { int lastSlash = Math.max(srcFile.lastIndexOf('/'), srcFile.lastIndexOf('\\')); String baseName = lastSlash > -1 ? srcFile.substring(lastSlash + 1) : srcFile; return baseName.substring(0, baseName.length() - 5); // Remove .java suffix. } } return ElementUtil.getName(type); }
[ "private", "String", "inferSourceName", "(", "TypeElement", "type", ")", "{", "if", "(", "!", "ElementUtil", ".", "isPublic", "(", "type", ")", ")", "{", "String", "srcFile", "=", "ElementUtil", ".", "getSourceFile", "(", "type", ")", ";", "if", "(", "sr...
Returns what should be the name of the "main" type associated with this type. Normally an outer type's name matches from its source file name, but Java allows additional non-public outer types to be declared in the same source file.
[ "Returns", "what", "should", "be", "the", "name", "of", "the", "main", "type", "associated", "with", "this", "type", ".", "Normally", "an", "outer", "type", "s", "name", "matches", "from", "its", "source", "file", "name", "but", "Java", "allows", "addition...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/HeaderMap.java#L177-L187
34,197
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/OneStepIterator.java
OneStepIterator.countProximityPosition
protected void countProximityPosition(int i) { if(!isReverseAxes()) super.countProximityPosition(i); else if (i < m_proximityPositions.length) m_proximityPositions[i]--; }
java
protected void countProximityPosition(int i) { if(!isReverseAxes()) super.countProximityPosition(i); else if (i < m_proximityPositions.length) m_proximityPositions[i]--; }
[ "protected", "void", "countProximityPosition", "(", "int", "i", ")", "{", "if", "(", "!", "isReverseAxes", "(", ")", ")", "super", ".", "countProximityPosition", "(", "i", ")", ";", "else", "if", "(", "i", "<", "m_proximityPositions", ".", "length", ")", ...
Count backwards one proximity position. @param i The predicate index.
[ "Count", "backwards", "one", "proximity", "position", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/OneStepIterator.java#L300-L306
34,198
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java
DerInputBuffer.getBigInteger
BigInteger getBigInteger(int len, boolean makePositive) throws IOException { if (len > available()) throw new IOException("short read of integer"); if (len == 0) { throw new IOException("Invalid encoding: zero length Int value"); } byte[] bytes = new byte[len]; System.arraycopy(buf, pos, bytes, 0, len); skip(len); // check to make sure no extra leading 0s for DER if (len >= 2 && (bytes[0] == 0) && (bytes[1] >= 0)) { throw new IOException("Invalid encoding: redundant leading 0s"); } if (makePositive) { return new BigInteger(1, bytes); } else { return new BigInteger(bytes); } }
java
BigInteger getBigInteger(int len, boolean makePositive) throws IOException { if (len > available()) throw new IOException("short read of integer"); if (len == 0) { throw new IOException("Invalid encoding: zero length Int value"); } byte[] bytes = new byte[len]; System.arraycopy(buf, pos, bytes, 0, len); skip(len); // check to make sure no extra leading 0s for DER if (len >= 2 && (bytes[0] == 0) && (bytes[1] >= 0)) { throw new IOException("Invalid encoding: redundant leading 0s"); } if (makePositive) { return new BigInteger(1, bytes); } else { return new BigInteger(bytes); } }
[ "BigInteger", "getBigInteger", "(", "int", "len", ",", "boolean", "makePositive", ")", "throws", "IOException", "{", "if", "(", "len", ">", "available", "(", ")", ")", "throw", "new", "IOException", "(", "\"short read of integer\"", ")", ";", "if", "(", "len...
Returns the integer which takes up the specified number of bytes in this buffer as a BigInteger. @param len the number of bytes to use. @param makePositive whether to always return a positive value, irrespective of actual encoding @return the integer as a BigInteger.
[ "Returns", "the", "integer", "which", "takes", "up", "the", "specified", "number", "of", "bytes", "in", "this", "buffer", "as", "a", "BigInteger", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L149-L172
34,199
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java
DerInputBuffer.getInteger
public int getInteger(int len) throws IOException { BigInteger result = getBigInteger(len, false); if (result.compareTo(BigInteger.valueOf(Integer.MIN_VALUE)) < 0) { throw new IOException("Integer below minimum valid value"); } if (result.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) > 0) { throw new IOException("Integer exceeds maximum valid value"); } return result.intValue(); }
java
public int getInteger(int len) throws IOException { BigInteger result = getBigInteger(len, false); if (result.compareTo(BigInteger.valueOf(Integer.MIN_VALUE)) < 0) { throw new IOException("Integer below minimum valid value"); } if (result.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) > 0) { throw new IOException("Integer exceeds maximum valid value"); } return result.intValue(); }
[ "public", "int", "getInteger", "(", "int", "len", ")", "throws", "IOException", "{", "BigInteger", "result", "=", "getBigInteger", "(", "len", ",", "false", ")", ";", "if", "(", "result", ".", "compareTo", "(", "BigInteger", ".", "valueOf", "(", "Integer",...
Returns the integer which takes up the specified number of bytes in this buffer. @throws IOException if the result is not within the valid range for integer, i.e. between Integer.MIN_VALUE and Integer.MAX_VALUE. @param len the number of bytes to use. @return the integer.
[ "Returns", "the", "integer", "which", "takes", "up", "the", "specified", "number", "of", "bytes", "in", "this", "buffer", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputBuffer.java#L183-L193