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,000
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java
TransliteratorRegistry.remove
public void remove(String ID) { String[] stv = TransliteratorIDParser.IDtoSTV(ID); // Only need to do this if ID.indexOf('-') < 0 String id = TransliteratorIDParser.STVtoID(stv[0], stv[1], stv[2]); registry.remove(new CaseInsensitiveString(id)); removeSTV(stv[0], stv[1], stv[2]); availableIDs.remove(new CaseInsensitiveString(id)); }
java
public void remove(String ID) { String[] stv = TransliteratorIDParser.IDtoSTV(ID); // Only need to do this if ID.indexOf('-') < 0 String id = TransliteratorIDParser.STVtoID(stv[0], stv[1], stv[2]); registry.remove(new CaseInsensitiveString(id)); removeSTV(stv[0], stv[1], stv[2]); availableIDs.remove(new CaseInsensitiveString(id)); }
[ "public", "void", "remove", "(", "String", "ID", ")", "{", "String", "[", "]", "stv", "=", "TransliteratorIDParser", ".", "IDtoSTV", "(", "ID", ")", ";", "// Only need to do this if ID.indexOf('-') < 0", "String", "id", "=", "TransliteratorIDParser", ".", "STVtoID...
Unregister an ID. This removes an entry from the dynamic store if there is one. The static locale resource store is unaffected.
[ "Unregister", "an", "ID", ".", "This", "removes", "an", "entry", "from", "the", "dynamic", "store", "if", "there", "is", "one", ".", "The", "static", "locale", "resource", "store", "is", "unaffected", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L378-L385
34,001
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java
TransliteratorRegistry.getAvailableTargets
public Enumeration<String> getAvailableTargets(String source) { CaseInsensitiveString cisrc = new CaseInsensitiveString(source); Map<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc); if (targets == null) { return new IDEnumeration(null); } return new IDEnumeration(Collections.enumeration(targets.keySet())); }
java
public Enumeration<String> getAvailableTargets(String source) { CaseInsensitiveString cisrc = new CaseInsensitiveString(source); Map<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc); if (targets == null) { return new IDEnumeration(null); } return new IDEnumeration(Collections.enumeration(targets.keySet())); }
[ "public", "Enumeration", "<", "String", ">", "getAvailableTargets", "(", "String", "source", ")", "{", "CaseInsensitiveString", "cisrc", "=", "new", "CaseInsensitiveString", "(", "source", ")", ";", "Map", "<", "CaseInsensitiveString", ",", "List", "<", "CaseInsen...
Returns an enumeration over visible target names for the given source. @return An <code>Enumeration</code> over <code>String</code> objects
[ "Returns", "an", "enumeration", "over", "visible", "target", "names", "for", "the", "given", "source", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L440-L447
34,002
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java
TransliteratorRegistry.getAvailableVariants
public Enumeration<String> getAvailableVariants(String source, String target) { CaseInsensitiveString cisrc = new CaseInsensitiveString(source); CaseInsensitiveString citrg = new CaseInsensitiveString(target); Map<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc); if (targets == null) { return new IDEnumeration(null); } List<CaseInsensitiveString> variants = targets.get(citrg); if (variants == null) { return new IDEnumeration(null); } return new IDEnumeration(Collections.enumeration(variants)); }
java
public Enumeration<String> getAvailableVariants(String source, String target) { CaseInsensitiveString cisrc = new CaseInsensitiveString(source); CaseInsensitiveString citrg = new CaseInsensitiveString(target); Map<CaseInsensitiveString, List<CaseInsensitiveString>> targets = specDAG.get(cisrc); if (targets == null) { return new IDEnumeration(null); } List<CaseInsensitiveString> variants = targets.get(citrg); if (variants == null) { return new IDEnumeration(null); } return new IDEnumeration(Collections.enumeration(variants)); }
[ "public", "Enumeration", "<", "String", ">", "getAvailableVariants", "(", "String", "source", ",", "String", "target", ")", "{", "CaseInsensitiveString", "cisrc", "=", "new", "CaseInsensitiveString", "(", "source", ")", ";", "CaseInsensitiveString", "citrg", "=", ...
Returns an enumeration over visible variant names for the given source and target. @return An <code>Enumeration</code> over <code>String</code> objects
[ "Returns", "an", "enumeration", "over", "visible", "variant", "names", "for", "the", "given", "source", "and", "target", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L455-L467
34,003
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/NodeSequence.java
NodeSequence.getVector
protected NodeVector getVector() { NodeVector nv = (m_cache != null) ? m_cache.getVector() : null; return nv; }
java
protected NodeVector getVector() { NodeVector nv = (m_cache != null) ? m_cache.getVector() : null; return nv; }
[ "protected", "NodeVector", "getVector", "(", ")", "{", "NodeVector", "nv", "=", "(", "m_cache", "!=", "null", ")", "?", "m_cache", ".", "getVector", "(", ")", ":", "null", ";", "return", "nv", ";", "}" ]
If this iterator needs to cache nodes that are fetched, they are stored in the Vector in the generic object.
[ "If", "this", "iterator", "needs", "to", "cache", "nodes", "that", "are", "fetched", "they", "are", "stored", "in", "the", "Vector", "in", "the", "generic", "object", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/NodeSequence.java#L65-L68
34,004
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/NodeSequence.java
NodeSequence.cacheComplete
private boolean cacheComplete() { final boolean complete; if (m_cache != null) { complete = m_cache.isComplete(); } else { complete = false; } return complete; }
java
private boolean cacheComplete() { final boolean complete; if (m_cache != null) { complete = m_cache.isComplete(); } else { complete = false; } return complete; }
[ "private", "boolean", "cacheComplete", "(", ")", "{", "final", "boolean", "complete", ";", "if", "(", "m_cache", "!=", "null", ")", "{", "complete", "=", "m_cache", ".", "isComplete", "(", ")", ";", "}", "else", "{", "complete", "=", "false", ";", "}",...
If this NodeSequence has a cache, and that cache is fully populated then this method returns true, otherwise if there is no cache or it is not complete it returns false.
[ "If", "this", "NodeSequence", "has", "a", "cache", "and", "that", "cache", "is", "fully", "populated", "then", "this", "method", "returns", "true", "otherwise", "if", "there", "is", "no", "cache", "or", "it", "is", "not", "complete", "it", "returns", "fals...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/NodeSequence.java#L104-L112
34,005
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/NodeSequence.java
NodeSequence.allowDetachToRelease
public void allowDetachToRelease(boolean allowRelease) { if((false == allowRelease) && !hasCache()) { setShouldCacheNodes(true); } if(null != m_iter) m_iter.allowDetachToRelease(allowRelease); super.allowDetachToRelease(allowRelease); }
java
public void allowDetachToRelease(boolean allowRelease) { if((false == allowRelease) && !hasCache()) { setShouldCacheNodes(true); } if(null != m_iter) m_iter.allowDetachToRelease(allowRelease); super.allowDetachToRelease(allowRelease); }
[ "public", "void", "allowDetachToRelease", "(", "boolean", "allowRelease", ")", "{", "if", "(", "(", "false", "==", "allowRelease", ")", "&&", "!", "hasCache", "(", ")", ")", "{", "setShouldCacheNodes", "(", "true", ")", ";", "}", "if", "(", "null", "!=",...
Calling this with a value of false will cause the nodeset to be cached. @see DTMIterator#allowDetachToRelease(boolean)
[ "Calling", "this", "with", "a", "value", "of", "false", "will", "cause", "the", "nodeset", "to", "be", "cached", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/NodeSequence.java#L407-L417
34,006
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java
BidiTransform.resolve
private void resolve(byte level, int options) { bidi.setInverse((options & Bidi.REORDER_INVERSE_LIKE_DIRECT) != 0); bidi.setReorderingMode(options); bidi.setPara(text, level, null); }
java
private void resolve(byte level, int options) { bidi.setInverse((options & Bidi.REORDER_INVERSE_LIKE_DIRECT) != 0); bidi.setReorderingMode(options); bidi.setPara(text, level, null); }
[ "private", "void", "resolve", "(", "byte", "level", ",", "int", "options", ")", "{", "bidi", ".", "setInverse", "(", "(", "options", "&", "Bidi", ".", "REORDER_INVERSE_LIKE_DIRECT", ")", "!=", "0", ")", ";", "bidi", ".", "setReorderingMode", "(", "options"...
Performs bidi resolution of text. @param level Base embedding level @param options Reordering options
[ "Performs", "bidi", "resolution", "of", "text", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java#L298-L302
34,007
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateAlgorithmId.java
CertificateAlgorithmId.encode
public void encode(OutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); algId.encode(tmp); out.write(tmp.toByteArray()); }
java
public void encode(OutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); algId.encode(tmp); out.write(tmp.toByteArray()); }
[ "public", "void", "encode", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "DerOutputStream", "tmp", "=", "new", "DerOutputStream", "(", ")", ";", "algId", ".", "encode", "(", "tmp", ")", ";", "out", ".", "write", "(", "tmp", ".", "toByte...
Encode the algorithm identifier in DER form to the stream. @param out the DerOutputStream to marshal the contents to. @exception IOException on errors.
[ "Encode", "the", "algorithm", "identifier", "in", "DER", "form", "to", "the", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateAlgorithmId.java#L108-L113
34,008
google/j2objc
jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/LocaleData.java
LocaleData.get
public static LocaleData get(Locale locale) { if (locale == null) { throw new NullPointerException("locale == null"); } final String languageTag = locale.toLanguageTag(); synchronized (localeDataCache) { LocaleData localeData = localeDataCache.get(languageTag); if (localeData != null) { return localeData; } } LocaleData newLocaleData = initLocaleData(locale); synchronized (localeDataCache) { LocaleData localeData = localeDataCache.get(languageTag); if (localeData != null) { return localeData; } localeDataCache.put(languageTag, newLocaleData); return newLocaleData; } }
java
public static LocaleData get(Locale locale) { if (locale == null) { throw new NullPointerException("locale == null"); } final String languageTag = locale.toLanguageTag(); synchronized (localeDataCache) { LocaleData localeData = localeDataCache.get(languageTag); if (localeData != null) { return localeData; } } LocaleData newLocaleData = initLocaleData(locale); synchronized (localeDataCache) { LocaleData localeData = localeDataCache.get(languageTag); if (localeData != null) { return localeData; } localeDataCache.put(languageTag, newLocaleData); return newLocaleData; } }
[ "public", "static", "LocaleData", "get", "(", "Locale", "locale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"locale == null\"", ")", ";", "}", "final", "String", "languageTag", "=", "locale", ".", ...
Returns a shared LocaleData for the given locale.
[ "Returns", "a", "shared", "LocaleData", "for", "the", "given", "locale", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/LocaleData.java#L134-L155
34,009
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/PriorityQueue.java
PriorityQueue.offer
public boolean offer(E e) { if (e == null) throw new NullPointerException(); modCount++; int i = size; if (i >= queue.length) grow(i + 1); size = i + 1; if (i == 0) queue[0] = e; else siftUp(i, e); return true; }
java
public boolean offer(E e) { if (e == null) throw new NullPointerException(); modCount++; int i = size; if (i >= queue.length) grow(i + 1); size = i + 1; if (i == 0) queue[0] = e; else siftUp(i, e); return true; }
[ "public", "boolean", "offer", "(", "E", "e", ")", "{", "if", "(", "e", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "modCount", "++", ";", "int", "i", "=", "size", ";", "if", "(", "i", ">=", "queue", ".", "length", ")...
Inserts the specified element into this priority queue. @return {@code true} (as specified by {@link Queue#offer}) @throws ClassCastException if the specified element cannot be compared with elements currently in this priority queue according to the priority queue's ordering @throws NullPointerException if the specified element is null
[ "Inserts", "the", "specified", "element", "into", "this", "priority", "queue", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/PriorityQueue.java#L333-L346
34,010
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/PriorityQueue.java
PriorityQueue.removeEq
boolean removeEq(Object o) { for (int i = 0; i < size; i++) { if (o == queue[i]) { removeAt(i); return true; } } return false; }
java
boolean removeEq(Object o) { for (int i = 0; i < size; i++) { if (o == queue[i]) { removeAt(i); return true; } } return false; }
[ "boolean", "removeEq", "(", "Object", "o", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "o", "==", "queue", "[", "i", "]", ")", "{", "removeAt", "(", "i", ")", ";", "return", "true"...
Version of remove using reference equality, not equals. Needed by iterator.remove. @param o element to be removed from this queue, if present @return {@code true} if removed
[ "Version", "of", "remove", "using", "reference", "equality", "not", "equals", ".", "Needed", "by", "iterator", ".", "remove", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/PriorityQueue.java#L390-L398
34,011
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/KeyManagerFactory.java
KeyManagerFactory.getDefaultAlgorithm
public final static String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty( "ssl.KeyManagerFactory.algorithm"); } }); if (type == null) { type = "SunX509"; } return type; }
java
public final static String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return Security.getProperty( "ssl.KeyManagerFactory.algorithm"); } }); if (type == null) { type = "SunX509"; } return type; }
[ "public", "final", "static", "String", "getDefaultAlgorithm", "(", ")", "{", "String", "type", ";", "type", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", ...
Obtains the default KeyManagerFactory algorithm name. <p>The default algorithm can be changed at runtime by setting the value of the {@code ssl.KeyManagerFactory.algorithm} security property to the desired algorithm name. @see java.security.Security security properties @return the default algorithm name as specified by the {@code ssl.KeyManagerFactory.algorithm} security property, or an implementation-specific default if no such property exists.
[ "Obtains", "the", "default", "KeyManagerFactory", "algorithm", "name", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/KeyManagerFactory.java#L80-L93
34,012
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java
ObjectStreamClass.buildFieldDescriptors
void buildFieldDescriptors(Field[] declaredFields) { // We could find the field ourselves in the collection, but calling // reflect is easier. Optimize if needed. final Field f = ObjectStreamClass.fieldSerialPersistentFields(this.forClass()); // If we could not find the emulated fields, we'll have to compute // dumpable fields from reflect fields boolean useReflectFields = f == null; // Assume we will compute the // fields to dump based on the // reflect fields ObjectStreamField[] _fields = null; if (!useReflectFields) { // The user declared a collection of emulated fields. Use them. // We have to be able to fetch its value, even if it is private f.setAccessible(true); try { // static field, pass null _fields = (ObjectStreamField[]) f.get(null); } catch (IllegalAccessException ex) { throw new AssertionError(ex); } } else { // Compute collection of dumpable fields based on reflect fields List<ObjectStreamField> serializableFields = new ArrayList<ObjectStreamField>(declaredFields.length); // Filter, we are only interested in fields that are serializable for (Field declaredField : declaredFields) { int modifiers = declaredField.getModifiers(); if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) { ObjectStreamField field = new ObjectStreamField(declaredField.getName(), declaredField.getType()); serializableFields.add(field); } } if (serializableFields.size() == 0) { _fields = NO_FIELDS; // If no serializable fields, share the // special value so that users can test } else { _fields = serializableFields.toArray(new ObjectStreamField[serializableFields.size()]); } } Arrays.sort(_fields); // assign offsets int primOffset = 0, objectOffset = 0; for (int i = 0; i < _fields.length; i++) { Class<?> type = _fields[i].getType(); if (type.isPrimitive()) { _fields[i].offset = primOffset; primOffset += primitiveSize(type); } else { _fields[i].offset = objectOffset++; } } fields = _fields; }
java
void buildFieldDescriptors(Field[] declaredFields) { // We could find the field ourselves in the collection, but calling // reflect is easier. Optimize if needed. final Field f = ObjectStreamClass.fieldSerialPersistentFields(this.forClass()); // If we could not find the emulated fields, we'll have to compute // dumpable fields from reflect fields boolean useReflectFields = f == null; // Assume we will compute the // fields to dump based on the // reflect fields ObjectStreamField[] _fields = null; if (!useReflectFields) { // The user declared a collection of emulated fields. Use them. // We have to be able to fetch its value, even if it is private f.setAccessible(true); try { // static field, pass null _fields = (ObjectStreamField[]) f.get(null); } catch (IllegalAccessException ex) { throw new AssertionError(ex); } } else { // Compute collection of dumpable fields based on reflect fields List<ObjectStreamField> serializableFields = new ArrayList<ObjectStreamField>(declaredFields.length); // Filter, we are only interested in fields that are serializable for (Field declaredField : declaredFields) { int modifiers = declaredField.getModifiers(); if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) { ObjectStreamField field = new ObjectStreamField(declaredField.getName(), declaredField.getType()); serializableFields.add(field); } } if (serializableFields.size() == 0) { _fields = NO_FIELDS; // If no serializable fields, share the // special value so that users can test } else { _fields = serializableFields.toArray(new ObjectStreamField[serializableFields.size()]); } } Arrays.sort(_fields); // assign offsets int primOffset = 0, objectOffset = 0; for (int i = 0; i < _fields.length; i++) { Class<?> type = _fields[i].getType(); if (type.isPrimitive()) { _fields[i].offset = primOffset; primOffset += primitiveSize(type); } else { _fields[i].offset = objectOffset++; } } fields = _fields; }
[ "void", "buildFieldDescriptors", "(", "Field", "[", "]", "declaredFields", ")", "{", "// We could find the field ourselves in the collection, but calling", "// reflect is easier. Optimize if needed.", "final", "Field", "f", "=", "ObjectStreamClass", ".", "fieldSerialPersistentField...
Builds the collection of field descriptors for the receiver @param declaredFields collection of java.lang.reflect.Field for which to compute field descriptors
[ "Builds", "the", "collection", "of", "field", "descriptors", "for", "the", "receiver" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java#L320-L375
34,013
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java
ObjectStreamClass.inSamePackage
private boolean inSamePackage(Class<?> c1, Class<?> c2) { String nameC1 = c1.getName(); String nameC2 = c2.getName(); int indexDotC1 = nameC1.lastIndexOf('.'); int indexDotC2 = nameC2.lastIndexOf('.'); if (indexDotC1 != indexDotC2) { return false; // cannot be in the same package if indices are not the same } if (indexDotC1 == -1) { return true; // both of them are in default package } return nameC1.regionMatches(0, nameC2, 0, indexDotC1); }
java
private boolean inSamePackage(Class<?> c1, Class<?> c2) { String nameC1 = c1.getName(); String nameC2 = c2.getName(); int indexDotC1 = nameC1.lastIndexOf('.'); int indexDotC2 = nameC2.lastIndexOf('.'); if (indexDotC1 != indexDotC2) { return false; // cannot be in the same package if indices are not the same } if (indexDotC1 == -1) { return true; // both of them are in default package } return nameC1.regionMatches(0, nameC2, 0, indexDotC1); }
[ "private", "boolean", "inSamePackage", "(", "Class", "<", "?", ">", "c1", ",", "Class", "<", "?", ">", "c2", ")", "{", "String", "nameC1", "=", "c1", ".", "getName", "(", ")", ";", "String", "nameC2", "=", "c2", ".", "getName", "(", ")", ";", "in...
Checks if two classes belong to the same package. @param c1 one of the classes to test. @param c2 the other class to test. @return {@code true} if the two classes belong to the same package, {@code false} otherwise.
[ "Checks", "if", "two", "classes", "belong", "to", "the", "same", "package", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java#L750-L762
34,014
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java
ObjectStreamClass.getField
public ObjectStreamField getField(String name) { ObjectStreamField[] allFields = getFields(); for (int i = 0; i < allFields.length; i++) { ObjectStreamField f = allFields[i]; if (f.getName().equals(name)) { return f; } } return null; }
java
public ObjectStreamField getField(String name) { ObjectStreamField[] allFields = getFields(); for (int i = 0; i < allFields.length; i++) { ObjectStreamField f = allFields[i]; if (f.getName().equals(name)) { return f; } } return null; }
[ "public", "ObjectStreamField", "getField", "(", "String", "name", ")", "{", "ObjectStreamField", "[", "]", "allFields", "=", "getFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "allFields", ".", "length", ";", "i", "++", ")", ...
Gets a field descriptor of the class represented by this class descriptor. @param name the name of the desired field. @return the field identified by {@code name} or {@code null} if there is no such field.
[ "Gets", "a", "field", "descriptor", "of", "the", "class", "represented", "by", "this", "class", "descriptor", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java#L795-L804
34,015
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java
ObjectStreamClass.fields
ObjectStreamField[] fields() { if (fields == null) { Class<?> forCl = forClass(); if (forCl != null && isSerializable() && !forCl.isArray()) { buildFieldDescriptors(forCl.getDeclaredFields()); } else { // Externalizables or arrays do not need FieldDesc info setFields(NO_FIELDS); } } return fields; }
java
ObjectStreamField[] fields() { if (fields == null) { Class<?> forCl = forClass(); if (forCl != null && isSerializable() && !forCl.isArray()) { buildFieldDescriptors(forCl.getDeclaredFields()); } else { // Externalizables or arrays do not need FieldDesc info setFields(NO_FIELDS); } } return fields; }
[ "ObjectStreamField", "[", "]", "fields", "(", ")", "{", "if", "(", "fields", "==", "null", ")", "{", "Class", "<", "?", ">", "forCl", "=", "forClass", "(", ")", ";", "if", "(", "forCl", "!=", "null", "&&", "isSerializable", "(", ")", "&&", "!", "...
Returns the collection of field descriptors for the fields of the corresponding class @return the receiver's collection of declared fields for the class it represents
[ "Returns", "the", "collection", "of", "field", "descriptors", "for", "the", "fields", "of", "the", "corresponding", "class" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java#L813-L824
34,016
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java
ObjectStreamClass.copyFieldAttributes
private void copyFieldAttributes() { if ((loadFields == null) || fields == null) { return; } for (int i = 0; i < loadFields.length; i++) { ObjectStreamField loadField = loadFields[i]; String name = loadField.getName(); for (int j = 0; j < fields.length; j++) { ObjectStreamField field = fields[j]; if (name.equals(field.getName())) { loadField.setUnshared(field.isUnshared()); loadField.setOffset(field.getOffset()); break; } } } }
java
private void copyFieldAttributes() { if ((loadFields == null) || fields == null) { return; } for (int i = 0; i < loadFields.length; i++) { ObjectStreamField loadField = loadFields[i]; String name = loadField.getName(); for (int j = 0; j < fields.length; j++) { ObjectStreamField field = fields[j]; if (name.equals(field.getName())) { loadField.setUnshared(field.isUnshared()); loadField.setOffset(field.getOffset()); break; } } } }
[ "private", "void", "copyFieldAttributes", "(", ")", "{", "if", "(", "(", "loadFields", "==", "null", ")", "||", "fields", "==", "null", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "loadFields", ".", "length", ";",...
If a Class uses "serialPersistentFields" to define the serialized fields, this.loadFields cannot get the "unshared" information when deserializing fields using current implementation of ObjectInputStream. This method provides a way to copy the "unshared" attribute from this.fields.
[ "If", "a", "Class", "uses", "serialPersistentFields", "to", "define", "the", "serialized", "fields", "this", ".", "loadFields", "cannot", "get", "the", "unshared", "information", "when", "deserializing", "fields", "using", "current", "implementation", "of", "ObjectI...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java#L864-L881
34,017
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java
ObjectStreamClass.resolveProperties
private void resolveProperties() { if (arePropertiesResolved) { return; } Class<?> cl = forClass(); isProxy = Proxy.isProxyClass(cl); isEnum = Enum.class.isAssignableFrom(cl); isSerializable = isSerializable(cl); isExternalizable = isExternalizable(cl); arePropertiesResolved = true; }
java
private void resolveProperties() { if (arePropertiesResolved) { return; } Class<?> cl = forClass(); isProxy = Proxy.isProxyClass(cl); isEnum = Enum.class.isAssignableFrom(cl); isSerializable = isSerializable(cl); isExternalizable = isExternalizable(cl); arePropertiesResolved = true; }
[ "private", "void", "resolveProperties", "(", ")", "{", "if", "(", "arePropertiesResolved", ")", "{", "return", ";", "}", "Class", "<", "?", ">", "cl", "=", "forClass", "(", ")", ";", "isProxy", "=", "Proxy", ".", "isProxyClass", "(", "cl", ")", ";", ...
Resolves the class properties, if they weren't already
[ "Resolves", "the", "class", "properties", "if", "they", "weren", "t", "already" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectStreamClass.java#L1031-L1043
34,018
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.getCertificate
public final Certificate getCertificate(String alias) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } return keyStoreSpi.engineGetCertificate(alias); }
java
public final Certificate getCertificate(String alias) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } return keyStoreSpi.engineGetCertificate(alias); }
[ "public", "final", "Certificate", "getCertificate", "(", "String", "alias", ")", "throws", "KeyStoreException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", "KeyStoreException", "(", "\"Uninitialized keystore\"", ")", ";", "}", "return", "keyStore...
Returns the certificate associated with the given alias. <p> If the given alias name identifies an entry created by a call to <code>setCertificateEntry</code>, or created by a call to <code>setEntry</code> with a <code>TrustedCertificateEntry</code>, then the trusted certificate contained in that entry is returned. <p> If the given alias name identifies an entry created by a call to <code>setKeyEntry</code>, or created by a call to <code>setEntry</code> with a <code>PrivateKeyEntry</code>, then the first element of the certificate chain in that entry is returned. @param alias the alias name @return the certificate, or null if the given alias does not exist or does not contain a certificate. @exception KeyStoreException if the keystore has not been initialized (loaded).
[ "Returns", "the", "certificate", "associated", "with", "the", "given", "alias", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L886-L893
34,019
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.getCreationDate
public final Date getCreationDate(String alias) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } return keyStoreSpi.engineGetCreationDate(alias); }
java
public final Date getCreationDate(String alias) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } return keyStoreSpi.engineGetCreationDate(alias); }
[ "public", "final", "Date", "getCreationDate", "(", "String", "alias", ")", "throws", "KeyStoreException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", "KeyStoreException", "(", "\"Uninitialized keystore\"", ")", ";", "}", "return", "keyStoreSpi", ...
Returns the creation date of the entry identified by the given alias. @param alias the alias name @return the creation date of this entry, or null if the given alias does not exist @exception KeyStoreException if the keystore has not been initialized (loaded).
[ "Returns", "the", "creation", "date", "of", "the", "entry", "identified", "by", "the", "given", "alias", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L906-L913
34,020
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.setKeyEntry
public final void setKeyEntry(String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } if ((key instanceof PrivateKey) && (chain == null || chain.length == 0)) { throw new IllegalArgumentException("Private key must be " + "accompanied by certificate " + "chain"); } keyStoreSpi.engineSetKeyEntry(alias, key, password, chain); }
java
public final void setKeyEntry(String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } if ((key instanceof PrivateKey) && (chain == null || chain.length == 0)) { throw new IllegalArgumentException("Private key must be " + "accompanied by certificate " + "chain"); } keyStoreSpi.engineSetKeyEntry(alias, key, password, chain); }
[ "public", "final", "void", "setKeyEntry", "(", "String", "alias", ",", "Key", "key", ",", "char", "[", "]", "password", ",", "Certificate", "[", "]", "chain", ")", "throws", "KeyStoreException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new...
Assigns the given key to the given alias, protecting it with the given password. <p>If the given key is of type <code>java.security.PrivateKey</code>, it must be accompanied by a certificate chain certifying the corresponding public key. <p>If the given alias already exists, the keystore information associated with it is overridden by the given key (and possibly certificate chain). @param alias the alias name @param key the key to be associated with the alias @param password the password to protect the key @param chain the certificate chain for the corresponding public key (only required if the given key is of type <code>java.security.PrivateKey</code>). @exception KeyStoreException if the keystore has not been initialized (loaded), the given key cannot be protected, or this operation fails for some other reason
[ "Assigns", "the", "given", "key", "to", "the", "given", "alias", "protecting", "it", "with", "the", "given", "password", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L938-L952
34,021
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.setCertificateEntry
public final void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } keyStoreSpi.engineSetCertificateEntry(alias, cert); }
java
public final void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } keyStoreSpi.engineSetCertificateEntry(alias, cert); }
[ "public", "final", "void", "setCertificateEntry", "(", "String", "alias", ",", "Certificate", "cert", ")", "throws", "KeyStoreException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", "KeyStoreException", "(", "\"Uninitialized keystore\"", ")", ";"...
Assigns the given trusted certificate to the given alias. <p> If the given alias identifies an existing entry created by a call to <code>setCertificateEntry</code>, or created by a call to <code>setEntry</code> with a <code>TrustedCertificateEntry</code>, the trusted certificate in the existing entry is overridden by the given certificate. @param alias the alias name @param cert the certificate @exception KeyStoreException if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
[ "Assigns", "the", "given", "trusted", "certificate", "to", "the", "given", "alias", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L1006-L1013
34,022
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.store
public final void store(OutputStream stream, char[] password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } keyStoreSpi.engineStore(stream, password); }
java
public final void store(OutputStream stream, char[] password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } keyStoreSpi.engineStore(stream, password); }
[ "public", "final", "void", "store", "(", "OutputStream", "stream", ",", "char", "[", "]", "password", ")", "throws", "KeyStoreException", ",", "IOException", ",", "NoSuchAlgorithmException", ",", "CertificateException", "{", "if", "(", "!", "initialized", ")", "...
Stores this keystore to the given output stream, and protects its integrity with the given password. @param stream the output stream to which this keystore is written. @param password the password to generate the keystore integrity check @exception KeyStoreException if the keystore has not been initialized (loaded). @exception IOException if there was an I/O problem with data @exception NoSuchAlgorithmException if the appropriate data integrity algorithm could not be found @exception CertificateException if any of the certificates included in the keystore data could not be stored
[ "Stores", "this", "keystore", "to", "the", "given", "output", "stream", "and", "protects", "its", "integrity", "with", "the", "given", "password", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L1181-L1189
34,023
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.load
public final void load(InputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { keyStoreSpi.engineLoad(stream, password); initialized = true; }
java
public final void load(InputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { keyStoreSpi.engineLoad(stream, password); initialized = true; }
[ "public", "final", "void", "load", "(", "InputStream", "stream", ",", "char", "[", "]", "password", ")", "throws", "IOException", ",", "NoSuchAlgorithmException", ",", "CertificateException", "{", "keyStoreSpi", ".", "engineLoad", "(", "stream", ",", "password", ...
Loads this KeyStore from the given input stream. <p>A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), or to check the integrity of the keystore data. If a password is not given for integrity checking, then integrity checking is not performed. <p>In order to create an empty keystore, or if the keystore cannot be initialized from a stream, pass <code>null</code> as the <code>stream</code> argument. <p> Note that if this keystore has already been loaded, it is reinitialized and loaded again from the given input stream. @param stream the input stream from which the keystore is loaded, or <code>null</code> @param password the password used to check the integrity of the keystore, the password used to unlock the keystore, or <code>null</code> @exception IOException if there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the {@link Throwable#getCause cause} of the <code>IOException</code> should be an <code>UnrecoverableKeyException</code> @exception NoSuchAlgorithmException if the algorithm used to check the integrity of the keystore cannot be found @exception CertificateException if any of the certificates in the keystore could not be loaded
[ "Loads", "this", "KeyStore", "from", "the", "given", "input", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L1253-L1258
34,024
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedTransferQueue.java
LinkedTransferQueue.xfer
private E xfer(E e, boolean haveData, int how, long nanos) { if (haveData && (e == null)) throw new NullPointerException(); Node s = null; // the node to append, if needed retry: for (;;) { // restart on append race for (Node h = head, p = h; p != null;) { // find & match first node boolean isData = p.isData; Object item = p.item; if (item != FORGOTTEN && (item != null) == isData) { // unmatched if (isData == haveData) // can't match break; if (p.casItem(item, e)) { // match for (Node q = p; q != h;) { Node n = q.next; // update by 2 unless singleton if (head == h && casHead(h, n == null ? q : n)) { h.forgetNext(); break; } // advance and retry if ((h = head) == null || (q = h.next) == null || !q.isMatched()) break; // unless slack < 2 } LockSupport.unpark(p.waiter); @SuppressWarnings("unchecked") E itemE = (E) item; return itemE; } } Node n = p.next; p = (UNLINKED != n) ? n : (h = head); // Use head if p offlist } if (how != NOW) { // No matches available if (s == null) s = new Node(e, haveData); Node pred = tryAppend(s, haveData); if (pred == null) continue retry; // lost race vs opposite mode if (how != ASYNC) return awaitMatch(s, pred, e, (how == TIMED), nanos); } return e; // not waiting } }
java
private E xfer(E e, boolean haveData, int how, long nanos) { if (haveData && (e == null)) throw new NullPointerException(); Node s = null; // the node to append, if needed retry: for (;;) { // restart on append race for (Node h = head, p = h; p != null;) { // find & match first node boolean isData = p.isData; Object item = p.item; if (item != FORGOTTEN && (item != null) == isData) { // unmatched if (isData == haveData) // can't match break; if (p.casItem(item, e)) { // match for (Node q = p; q != h;) { Node n = q.next; // update by 2 unless singleton if (head == h && casHead(h, n == null ? q : n)) { h.forgetNext(); break; } // advance and retry if ((h = head) == null || (q = h.next) == null || !q.isMatched()) break; // unless slack < 2 } LockSupport.unpark(p.waiter); @SuppressWarnings("unchecked") E itemE = (E) item; return itemE; } } Node n = p.next; p = (UNLINKED != n) ? n : (h = head); // Use head if p offlist } if (how != NOW) { // No matches available if (s == null) s = new Node(e, haveData); Node pred = tryAppend(s, haveData); if (pred == null) continue retry; // lost race vs opposite mode if (how != ASYNC) return awaitMatch(s, pred, e, (how == TIMED), nanos); } return e; // not waiting } }
[ "private", "E", "xfer", "(", "E", "e", ",", "boolean", "haveData", ",", "int", "how", ",", "long", "nanos", ")", "{", "if", "(", "haveData", "&&", "(", "e", "==", "null", ")", ")", "throw", "new", "NullPointerException", "(", ")", ";", "Node", "s",...
Implements all queuing methods. See above for explanation. @param e the item or null for take @param haveData true if this is a put, else a take @param how NOW, ASYNC, SYNC, or TIMED @param nanos timeout in nanosecs, used only if mode is TIMED @return an item if matched, else e @throws NullPointerException if haveData mode but e is null
[ "Implements", "all", "queuing", "methods", ".", "See", "above", "for", "explanation", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedTransferQueue.java#L602-L647
34,025
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedTransferQueue.java
LinkedTransferQueue.tryAppend
private Node tryAppend(Node s, boolean haveData) { for (Node t = tail, p = t;;) { // move p to last node and append Node n, u; // temps for reads of next & tail if (p == null && (p = head) == null) { if (casHead(null, s)) return s; // initialize } else if (p.cannotPrecede(haveData)) return null; // lost race vs opposite mode else if ((n = p.next) != null) // not last; keep traversing p = p != t && t != (u = tail) ? (t = u) : // stale tail (UNLINKED != n) ? n : null; // restart if off list else if (!p.casNext(null, s)) p = p.next; // re-read on CAS failure else { if (p != t) { // update if slack now >= 2 while ((tail != t || !casTail(t, s)) && (t = tail) != null && (s = t.next) != null && // advance and retry (s = s.next) != null && s != UNLINKED); } return p; } } }
java
private Node tryAppend(Node s, boolean haveData) { for (Node t = tail, p = t;;) { // move p to last node and append Node n, u; // temps for reads of next & tail if (p == null && (p = head) == null) { if (casHead(null, s)) return s; // initialize } else if (p.cannotPrecede(haveData)) return null; // lost race vs opposite mode else if ((n = p.next) != null) // not last; keep traversing p = p != t && t != (u = tail) ? (t = u) : // stale tail (UNLINKED != n) ? n : null; // restart if off list else if (!p.casNext(null, s)) p = p.next; // re-read on CAS failure else { if (p != t) { // update if slack now >= 2 while ((tail != t || !casTail(t, s)) && (t = tail) != null && (s = t.next) != null && // advance and retry (s = s.next) != null && s != UNLINKED); } return p; } } }
[ "private", "Node", "tryAppend", "(", "Node", "s", ",", "boolean", "haveData", ")", "{", "for", "(", "Node", "t", "=", "tail", ",", "p", "=", "t", ";", ";", ")", "{", "// move p to last node and append", "Node", "n", ",", "u", ";", "// temps for reads of ...
Tries to append node s as tail. @param s the node to append @param haveData true if appending in data mode @return null on failure due to losing race with append in different mode, else s's predecessor, or s itself if no predecessor
[ "Tries", "to", "append", "node", "s", "as", "tail", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedTransferQueue.java#L658-L682
34,026
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedTransferQueue.java
LinkedTransferQueue.firstDataNode
final Node firstDataNode() { restartFromHead: for (;;) { for (Node p = head; p != null;) { Object item = p.item; if (p.isData) { if (item != null && item != FORGOTTEN) return p; } else if (item == null) break; if (UNLINKED == (p = p.next)) continue restartFromHead; } return null; } }
java
final Node firstDataNode() { restartFromHead: for (;;) { for (Node p = head; p != null;) { Object item = p.item; if (p.isData) { if (item != null && item != FORGOTTEN) return p; } else if (item == null) break; if (UNLINKED == (p = p.next)) continue restartFromHead; } return null; } }
[ "final", "Node", "firstDataNode", "(", ")", "{", "restartFromHead", ":", "for", "(", ";", ";", ")", "{", "for", "(", "Node", "p", "=", "head", ";", "p", "!=", "null", ";", ")", "{", "Object", "item", "=", "p", ".", "item", ";", "if", "(", "p", ...
Returns the first unmatched data node, or null if none. Callers must recheck if the returned node's item field is null or self-linked before using.
[ "Returns", "the", "first", "unmatched", "data", "node", "or", "null", "if", "none", ".", "Callers", "must", "recheck", "if", "the", "returned", "node", "s", "item", "field", "is", "null", "or", "self", "-", "linked", "before", "using", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedTransferQueue.java#L771-L786
34,027
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.dump
@Deprecated public void dump(java.io.PrintStream out) { if (out == null) { out = System.out; } this.fRData.dump(out); }
java
@Deprecated public void dump(java.io.PrintStream out) { if (out == null) { out = System.out; } this.fRData.dump(out); }
[ "@", "Deprecated", "public", "void", "dump", "(", "java", ".", "io", ".", "PrintStream", "out", ")", "{", "if", "(", "out", "==", "null", ")", "{", "out", "=", "System", ".", "out", ";", "}", "this", ".", "fRData", ".", "dump", "(", "out", ")", ...
Dump the contents of the state table and character classes for this break iterator. For debugging only. @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Dump", "the", "contents", "of", "the", "state", "table", "and", "character", "classes", "for", "this", "break", "iterator", ".", "For", "debugging", "only", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L295-L301
34,028
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.compileRules
public static void compileRules(String rules, OutputStream ruleBinary) throws IOException { RBBIRuleBuilder.compileRules(rules, ruleBinary); }
java
public static void compileRules(String rules, OutputStream ruleBinary) throws IOException { RBBIRuleBuilder.compileRules(rules, ruleBinary); }
[ "public", "static", "void", "compileRules", "(", "String", "rules", ",", "OutputStream", "ruleBinary", ")", "throws", "IOException", "{", "RBBIRuleBuilder", ".", "compileRules", "(", "rules", ",", "ruleBinary", ")", ";", "}" ]
Compile a set of source break rules into the binary state tables used by the break iterator engine. Creating a break iterator from precompiled rules is much faster than creating one from source rules. Binary break rules are not guaranteed to be compatible between different versions of ICU. @param rules The source form of the break rules @param ruleBinary An output stream to receive the compiled rules. @throws IOException If there is an error writing the output. @see #getInstanceFromCompiledRules(InputStream)
[ "Compile", "a", "set", "of", "source", "break", "rules", "into", "the", "binary", "state", "tables", "used", "by", "the", "break", "iterator", "engine", ".", "Creating", "a", "break", "iterator", "from", "precompiled", "rules", "is", "much", "faster", "than"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L317-L319
34,029
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.next
@Override public int next() { // if we have cached break positions and we're still in the range // covered by them, just move one step forward in the cache if (fCachedBreakPositions != null) { if (fPositionInCache < fCachedBreakPositions.length - 1) { ++fPositionInCache; int pos = fCachedBreakPositions[fPositionInCache]; fText.setIndex(pos); return pos; } else { reset(); } } int startPos = current(); fDictionaryCharCount = 0; int result = handleNext(fRData.fFTable); if (fDictionaryCharCount > 0) { result = checkDictionary(startPos, result, false); } return result; }
java
@Override public int next() { // if we have cached break positions and we're still in the range // covered by them, just move one step forward in the cache if (fCachedBreakPositions != null) { if (fPositionInCache < fCachedBreakPositions.length - 1) { ++fPositionInCache; int pos = fCachedBreakPositions[fPositionInCache]; fText.setIndex(pos); return pos; } else { reset(); } } int startPos = current(); fDictionaryCharCount = 0; int result = handleNext(fRData.fFTable); if (fDictionaryCharCount > 0) { result = checkDictionary(startPos, result, false); } return result; }
[ "@", "Override", "public", "int", "next", "(", ")", "{", "// if we have cached break positions and we're still in the range", "// covered by them, just move one step forward in the cache", "if", "(", "fCachedBreakPositions", "!=", "null", ")", "{", "if", "(", "fPositionInCache"...
Advances the iterator to the next boundary position. @return The position of the first boundary after this one.
[ "Advances", "the", "iterator", "to", "the", "next", "boundary", "position", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L398-L421
34,030
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.previous
@Override public int previous() { int result; int startPos; CharacterIterator text = getText(); fLastStatusIndexValid = false; // if we have cached break positions and we're still in the range // covered by them, just move one step backward in the cache if (fCachedBreakPositions != null) { if (fPositionInCache > 0) { --fPositionInCache; // If we're at the beginning of the cache, need to reevaluate the // rule status if (fPositionInCache <= 0) { fLastStatusIndexValid = false; } int pos = fCachedBreakPositions[fPositionInCache]; text.setIndex(pos); return pos; } else { reset(); } } // if we're already sitting at the beginning of the text, return DONE startPos = current(); if (fText == null || startPos == fText.getBeginIndex()) { fLastRuleStatusIndex = 0; fLastStatusIndexValid = true; return BreakIterator.DONE; } // Rules with an exact reverse table are handled here. if (fRData.fSRTable != null || fRData.fSFTable != null) { result = handlePrevious(fRData.fRTable); if (fDictionaryCharCount > 0) { result = checkDictionary(result, startPos, true); } return result; } // old rule syntax // set things up. handlePrevious() will back us up to some valid // break position before the current position (we back our internal // iterator up one step to prevent handlePrevious() from returning // the current position), but not necessarily the last one before // where we started int start = current(); previous32(fText); int lastResult = handlePrevious(fRData.fRTable); if (lastResult == BreakIterator.DONE) { lastResult = fText.getBeginIndex(); fText.setIndex(lastResult); } result = lastResult; int lastTag = 0; boolean breakTagValid = false; // iterate forward from the known break position until we pass our // starting point. The last break position before the starting // point is our return value for (;;) { result = next(); if (result == BreakIterator.DONE || result >= start) { break; } lastResult = result; lastTag = fLastRuleStatusIndex; breakTagValid = true; } // fLastBreakTag wants to have the value for section of text preceding // the result position that we are to return (in lastResult.) If // the backwards rules overshot and the above loop had to do two or more // handleNext()s to move up to the desired return position, we will have a valid // tag value. But, if handlePrevious() took us to exactly the correct result position, // we wont have a tag value for that position, which is only set by handleNext(). // Set the current iteration position to be the last break position // before where we started, and then return that value. fText.setIndex(lastResult); fLastRuleStatusIndex = lastTag; // for use by getRuleStatus() fLastStatusIndexValid = breakTagValid; return lastResult; }
java
@Override public int previous() { int result; int startPos; CharacterIterator text = getText(); fLastStatusIndexValid = false; // if we have cached break positions and we're still in the range // covered by them, just move one step backward in the cache if (fCachedBreakPositions != null) { if (fPositionInCache > 0) { --fPositionInCache; // If we're at the beginning of the cache, need to reevaluate the // rule status if (fPositionInCache <= 0) { fLastStatusIndexValid = false; } int pos = fCachedBreakPositions[fPositionInCache]; text.setIndex(pos); return pos; } else { reset(); } } // if we're already sitting at the beginning of the text, return DONE startPos = current(); if (fText == null || startPos == fText.getBeginIndex()) { fLastRuleStatusIndex = 0; fLastStatusIndexValid = true; return BreakIterator.DONE; } // Rules with an exact reverse table are handled here. if (fRData.fSRTable != null || fRData.fSFTable != null) { result = handlePrevious(fRData.fRTable); if (fDictionaryCharCount > 0) { result = checkDictionary(result, startPos, true); } return result; } // old rule syntax // set things up. handlePrevious() will back us up to some valid // break position before the current position (we back our internal // iterator up one step to prevent handlePrevious() from returning // the current position), but not necessarily the last one before // where we started int start = current(); previous32(fText); int lastResult = handlePrevious(fRData.fRTable); if (lastResult == BreakIterator.DONE) { lastResult = fText.getBeginIndex(); fText.setIndex(lastResult); } result = lastResult; int lastTag = 0; boolean breakTagValid = false; // iterate forward from the known break position until we pass our // starting point. The last break position before the starting // point is our return value for (;;) { result = next(); if (result == BreakIterator.DONE || result >= start) { break; } lastResult = result; lastTag = fLastRuleStatusIndex; breakTagValid = true; } // fLastBreakTag wants to have the value for section of text preceding // the result position that we are to return (in lastResult.) If // the backwards rules overshot and the above loop had to do two or more // handleNext()s to move up to the desired return position, we will have a valid // tag value. But, if handlePrevious() took us to exactly the correct result position, // we wont have a tag value for that position, which is only set by handleNext(). // Set the current iteration position to be the last break position // before where we started, and then return that value. fText.setIndex(lastResult); fLastRuleStatusIndex = lastTag; // for use by getRuleStatus() fLastStatusIndexValid = breakTagValid; return lastResult; }
[ "@", "Override", "public", "int", "previous", "(", ")", "{", "int", "result", ";", "int", "startPos", ";", "CharacterIterator", "text", "=", "getText", "(", ")", ";", "fLastStatusIndexValid", "=", "false", ";", "// if we have cached break positions and we're still i...
Moves the iterator backwards, to the last boundary preceding this one. @return The position of the last boundary position preceding this one.
[ "Moves", "the", "iterator", "backwards", "to", "the", "last", "boundary", "preceding", "this", "one", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L587-L677
34,031
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.following
@Override public int following(int offset) { CharacterIterator text = getText(); // if we have no cached break positions, or if "offset" is outside the // range covered by the cache, then dump the cache and call our // inherited following() method. This will call other methods in this // class that may refresh the cache. if (fCachedBreakPositions == null || offset < fCachedBreakPositions[0] || offset >= fCachedBreakPositions[fCachedBreakPositions.length - 1]) { fCachedBreakPositions = null; return rulesFollowing(offset); } // on the other hand, if "offset" is within the range covered by the // cache, then just search the cache for the first break position // after "offset" else { fPositionInCache = 0; while (fPositionInCache < fCachedBreakPositions.length && offset >= fCachedBreakPositions[fPositionInCache]) ++fPositionInCache; text.setIndex(fCachedBreakPositions[fPositionInCache]); return text.getIndex(); } }
java
@Override public int following(int offset) { CharacterIterator text = getText(); // if we have no cached break positions, or if "offset" is outside the // range covered by the cache, then dump the cache and call our // inherited following() method. This will call other methods in this // class that may refresh the cache. if (fCachedBreakPositions == null || offset < fCachedBreakPositions[0] || offset >= fCachedBreakPositions[fCachedBreakPositions.length - 1]) { fCachedBreakPositions = null; return rulesFollowing(offset); } // on the other hand, if "offset" is within the range covered by the // cache, then just search the cache for the first break position // after "offset" else { fPositionInCache = 0; while (fPositionInCache < fCachedBreakPositions.length && offset >= fCachedBreakPositions[fPositionInCache]) ++fPositionInCache; text.setIndex(fCachedBreakPositions[fPositionInCache]); return text.getIndex(); } }
[ "@", "Override", "public", "int", "following", "(", "int", "offset", ")", "{", "CharacterIterator", "text", "=", "getText", "(", ")", ";", "// if we have no cached break positions, or if \"offset\" is outside the", "// range covered by the cache, then dump the cache and call our"...
Sets the iterator to refer to the first boundary position following the specified position. @param offset The position from which to begin searching for a break position. @return The position of the first break after the current position.
[ "Sets", "the", "iterator", "to", "refer", "to", "the", "first", "boundary", "position", "following", "the", "specified", "position", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L685-L710
34,032
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.preceding
@Override public int preceding(int offset) { CharacterIterator text = getText(); // if we have no cached break positions, or "offset" is outside the // range covered by the cache, we can just call the inherited routine // (which will eventually call other routines in this class that may // refresh the cache) if (fCachedBreakPositions == null || offset <= fCachedBreakPositions[0] || offset > fCachedBreakPositions[fCachedBreakPositions.length - 1]) { fCachedBreakPositions = null; return rulesPreceding(offset); } // on the other hand, if "offset" is within the range covered by the cache, // then all we have to do is search the cache for the last break position // before "offset" else { fPositionInCache = 0; while (fPositionInCache < fCachedBreakPositions.length && offset > fCachedBreakPositions[fPositionInCache]) ++fPositionInCache; --fPositionInCache; text.setIndex(fCachedBreakPositions[fPositionInCache]); return text.getIndex(); } }
java
@Override public int preceding(int offset) { CharacterIterator text = getText(); // if we have no cached break positions, or "offset" is outside the // range covered by the cache, we can just call the inherited routine // (which will eventually call other routines in this class that may // refresh the cache) if (fCachedBreakPositions == null || offset <= fCachedBreakPositions[0] || offset > fCachedBreakPositions[fCachedBreakPositions.length - 1]) { fCachedBreakPositions = null; return rulesPreceding(offset); } // on the other hand, if "offset" is within the range covered by the cache, // then all we have to do is search the cache for the last break position // before "offset" else { fPositionInCache = 0; while (fPositionInCache < fCachedBreakPositions.length && offset > fCachedBreakPositions[fPositionInCache]) ++fPositionInCache; --fPositionInCache; text.setIndex(fCachedBreakPositions[fPositionInCache]); return text.getIndex(); } }
[ "@", "Override", "public", "int", "preceding", "(", "int", "offset", ")", "{", "CharacterIterator", "text", "=", "getText", "(", ")", ";", "// if we have no cached break positions, or \"offset\" is outside the", "// range covered by the cache, we can just call the inherited routi...
Sets the iterator to refer to the last boundary position before the specified position. @param offset The position to begin searching for a break from. @return The position of the last boundary before the starting position.
[ "Sets", "the", "iterator", "to", "refer", "to", "the", "last", "boundary", "position", "before", "the", "specified", "position", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L799-L825
34,033
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.checkOffset
protected static final void checkOffset(int offset, CharacterIterator text) { if (offset < text.getBeginIndex() || offset > text.getEndIndex()) { throw new IllegalArgumentException("offset out of bounds"); } }
java
protected static final void checkOffset(int offset, CharacterIterator text) { if (offset < text.getBeginIndex() || offset > text.getEndIndex()) { throw new IllegalArgumentException("offset out of bounds"); } }
[ "protected", "static", "final", "void", "checkOffset", "(", "int", "offset", ",", "CharacterIterator", "text", ")", "{", "if", "(", "offset", "<", "text", ".", "getBeginIndex", "(", ")", "||", "offset", ">", "text", ".", "getEndIndex", "(", ")", ")", "{"...
Throw IllegalArgumentException unless begin &lt;= offset &lt; end.
[ "Throw", "IllegalArgumentException", "unless", "begin", "&lt", ";", "=", "offset", "&lt", ";", "end", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L893-L897
34,034
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java
RuleBasedBreakIterator.isBoundary
@Override public boolean isBoundary(int offset) { checkOffset(offset, fText); // the beginning index of the iterator is always a boundary position by definition if (offset == fText.getBeginIndex()) { first(); // For side effects on current position, tag values. return true; } if (offset == fText.getEndIndex()) { last(); // For side effects on current position, tag values. return true; } // otherwise, we can use following() on the position before the specified // one and return true if the position we get back is the one the user // specified // return following(offset - 1) == offset; // TODO: check whether it is safe to revert to the simpler offset-1 code // The safe rules may take care of unpaired surrogates ok. fText.setIndex(offset); previous32(fText); int pos = fText.getIndex(); boolean result = following(pos) == offset; return result; }
java
@Override public boolean isBoundary(int offset) { checkOffset(offset, fText); // the beginning index of the iterator is always a boundary position by definition if (offset == fText.getBeginIndex()) { first(); // For side effects on current position, tag values. return true; } if (offset == fText.getEndIndex()) { last(); // For side effects on current position, tag values. return true; } // otherwise, we can use following() on the position before the specified // one and return true if the position we get back is the one the user // specified // return following(offset - 1) == offset; // TODO: check whether it is safe to revert to the simpler offset-1 code // The safe rules may take care of unpaired surrogates ok. fText.setIndex(offset); previous32(fText); int pos = fText.getIndex(); boolean result = following(pos) == offset; return result; }
[ "@", "Override", "public", "boolean", "isBoundary", "(", "int", "offset", ")", "{", "checkOffset", "(", "offset", ",", "fText", ")", ";", "// the beginning index of the iterator is always a boundary position by definition", "if", "(", "offset", "==", "fText", ".", "ge...
Returns true if the specified position is a boundary position. As a side effect, leaves the iterator pointing to the first boundary position at or after "offset". @param offset the offset to check. @return True if "offset" is a boundary position.
[ "Returns", "true", "if", "the", "specified", "position", "is", "a", "boundary", "position", ".", "As", "a", "side", "effect", "leaves", "the", "iterator", "pointing", "to", "the", "first", "boundary", "position", "at", "or", "after", "offset", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L907-L934
34,035
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/javac/JavacJ2ObjCIncompatibleStripper.java
JavacJ2ObjCIncompatibleStripper.visitCompilationUnit
@Override public Void visitCompilationUnit(CompilationUnitTree unit, Void unused) { scan(unit.getImports(), null); scan(unit.getPackageAnnotations(), null); scan(unit.getTypeDecls(), null); return null; }
java
@Override public Void visitCompilationUnit(CompilationUnitTree unit, Void unused) { scan(unit.getImports(), null); scan(unit.getPackageAnnotations(), null); scan(unit.getTypeDecls(), null); return null; }
[ "@", "Override", "public", "Void", "visitCompilationUnit", "(", "CompilationUnitTree", "unit", ",", "Void", "unused", ")", "{", "scan", "(", "unit", ".", "getImports", "(", ")", ",", "null", ")", ";", "scan", "(", "unit", ".", "getPackageAnnotations", "(", ...
TreeScanner methods.
[ "TreeScanner", "methods", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacJ2ObjCIncompatibleStripper.java#L64-L70
34,036
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/javac/JavacJ2ObjCIncompatibleStripper.java
JavacJ2ObjCIncompatibleStripper.checkAnnotations
private boolean checkAnnotations(List<? extends AnnotationTree> annotations, Tree node) { for (AnnotationTree annotation : annotations) { if (isJ2ObjCIncompatible(annotation)) { nodesToStrip.add(node); return false; } } return true; }
java
private boolean checkAnnotations(List<? extends AnnotationTree> annotations, Tree node) { for (AnnotationTree annotation : annotations) { if (isJ2ObjCIncompatible(annotation)) { nodesToStrip.add(node); return false; } } return true; }
[ "private", "boolean", "checkAnnotations", "(", "List", "<", "?", "extends", "AnnotationTree", ">", "annotations", ",", "Tree", "node", ")", "{", "for", "(", "AnnotationTree", "annotation", ":", "annotations", ")", "{", "if", "(", "isJ2ObjCIncompatible", "(", "...
Checks for any J2ObjCIncompatible annotations. Returns whether the caller should to continue scanning this node.
[ "Checks", "for", "any", "J2ObjCIncompatible", "annotations", ".", "Returns", "whether", "the", "caller", "should", "to", "continue", "scanning", "this", "node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacJ2ObjCIncompatibleStripper.java#L129-L137
34,037
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneNames.java
TimeZoneNames.getDisplayName
public final String getDisplayName(String tzID, NameType type, long date) { String name = getTimeZoneDisplayName(tzID, type); if (name == null) { String mzID = getMetaZoneID(tzID, date); name = getMetaZoneDisplayName(mzID, type); } return name; }
java
public final String getDisplayName(String tzID, NameType type, long date) { String name = getTimeZoneDisplayName(tzID, type); if (name == null) { String mzID = getMetaZoneID(tzID, date); name = getMetaZoneDisplayName(mzID, type); } return name; }
[ "public", "final", "String", "getDisplayName", "(", "String", "tzID", ",", "NameType", "type", ",", "long", "date", ")", "{", "String", "name", "=", "getTimeZoneDisplayName", "(", "tzID", ",", "type", ")", ";", "if", "(", "name", "==", "null", ")", "{", ...
Returns the display name of the time zone at the given date. <p> <b>Note:</b> This method calls the subclass's {@link #getTimeZoneDisplayName(String, NameType)} first. When the result is null, this method calls {@link #getMetaZoneID(String, long)} to get the meta zone ID mapped from the time zone, then calls {@link #getMetaZoneDisplayName(String, NameType)}. @param tzID The canonical time zone ID. @param type The display name type. See {@link TimeZoneNames.NameType}. @param date The date @return The display name for the time zone at the given date. When this object does not have a localized display name for the time zone with the specified type and date, null is returned.
[ "Returns", "the", "display", "name", "of", "the", "time", "zone", "at", "the", "given", "date", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneNames.java#L262-L269
34,038
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneNames.java
TimeZoneNames.find
public Collection<MatchInfo> find(CharSequence text, int start, EnumSet<NameType> types) { throw new UnsupportedOperationException("The method is not implemented in TimeZoneNames base class."); }
java
public Collection<MatchInfo> find(CharSequence text, int start, EnumSet<NameType> types) { throw new UnsupportedOperationException("The method is not implemented in TimeZoneNames base class."); }
[ "public", "Collection", "<", "MatchInfo", ">", "find", "(", "CharSequence", "text", ",", "int", "start", ",", "EnumSet", "<", "NameType", ">", "types", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"The method is not implemented in TimeZoneNames ba...
Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches. @param text the text. @param start the starting offset within the text. @param types the set of name types, or <code>null</code> for all name types. @return A collection of matches. @see NameType @see MatchInfo @hide draft / provisional / internal are hidden on Android
[ "Finds", "time", "zone", "name", "prefix", "matches", "for", "the", "input", "text", "at", "the", "given", "offset", "and", "returns", "a", "collection", "of", "the", "matches", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneNames.java#L318-L320
34,039
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java
ObjectFactory.newInstance
static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } }
java
static Object newInstance(String className, ClassLoader cl, boolean doFallback) throws ConfigurationError { // assert(className != null); try{ Class providerClass = findProviderClass(className, cl, doFallback); Object instance = providerClass.newInstance(); debugPrintln("created new instance of " + providerClass + " using ClassLoader: " + cl); return instance; } catch (ClassNotFoundException x) { throw new ConfigurationError( "Provider " + className + " not found", x); } catch (Exception x) { throw new ConfigurationError( "Provider " + className + " could not be instantiated: " + x, x); } }
[ "static", "Object", "newInstance", "(", "String", "className", ",", "ClassLoader", "cl", ",", "boolean", "doFallback", ")", "throws", "ConfigurationError", "{", "// assert(className != null);", "try", "{", "Class", "providerClass", "=", "findProviderClass", "(", "clas...
Create an instance of a class using the specified ClassLoader
[ "Create", "an", "instance", "of", "a", "class", "using", "the", "specified", "ClassLoader" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java#L451-L470
34,040
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java
ObjectFactory.findProviderClass
static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; }
java
static Class findProviderClass(String className, ClassLoader cl, boolean doFallback) throws ClassNotFoundException, ConfigurationError { //throw security exception if the calling thread is not allowed to access the //class. Restrict the access to the package classes as specified in java.security policy. SecurityManager security = System.getSecurityManager(); try{ if (security != null){ final int lastDot = className.lastIndexOf("."); String packageName = className; if (lastDot != -1) packageName = className.substring(0, lastDot); security.checkPackageAccess(packageName); } }catch(SecurityException e){ throw e; } Class providerClass; if (cl == null) { // XXX Use the bootstrap ClassLoader. There is no way to // load a class using the bootstrap ClassLoader that works // in both JDK 1.1 and Java 2. However, this should still // work b/c the following should be true: // // (cl == null) iff current ClassLoader == null // // Thus Class.forName(String) will use the current // ClassLoader which will be the bootstrap ClassLoader. providerClass = Class.forName(className); } else { try { providerClass = cl.loadClass(className); } catch (ClassNotFoundException x) { if (doFallback) { // Fall back to current classloader ClassLoader current = ObjectFactory.class.getClassLoader(); if (current == null) { providerClass = Class.forName(className); } else if (cl != current) { cl = current; providerClass = cl.loadClass(className); } else { throw x; } } else { throw x; } } } return providerClass; }
[ "static", "Class", "findProviderClass", "(", "String", "className", ",", "ClassLoader", "cl", ",", "boolean", "doFallback", ")", "throws", "ClassNotFoundException", ",", "ConfigurationError", "{", "//throw security exception if the calling thread is not allowed to access the", ...
Find a Class using the specified ClassLoader
[ "Find", "a", "Class", "using", "the", "specified", "ClassLoader" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java#L475-L527
34,041
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java
ObjectFactory.findJarServiceProviderName
private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; }
java
private static String findJarServiceProviderName(String factoryId) { SecuritySupport ss = SecuritySupport.getInstance(); String serviceId = SERVICES_PATH + factoryId; InputStream is = null; // First try the Context ClassLoader ClassLoader cl = findClassLoader(); is = ss.getResourceAsStream(cl, serviceId); // If no provider found then try the current ClassLoader if (is == null) { ClassLoader current = ObjectFactory.class.getClassLoader(); if (cl != current) { cl = current; is = ss.getResourceAsStream(cl, serviceId); } } if (is == null) { // No provider found return null; } debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl); // Read the service provider name in UTF-8 as specified in // the jar spec. Unfortunately this fails in Microsoft // VJ++, which does not implement the UTF-8 // encoding. Theoretically, we should simply let it fail in // that case, since the JVM is obviously broken if it // doesn't support such a basic standard. But since there // are still some users attempting to use VJ++ for // development, we have dropped in a fallback which makes a // second attempt using the platform's default encoding. In // VJ++ this is apparently ASCII, which is a subset of // UTF-8... and since the strings we'll be reading here are // also primarily limited to the 7-bit ASCII range (at // least, in English versions), this should work well // enough to keep us on the air until we're ready to // officially decommit from VJ++. [Edited comment from // jkesselm] BufferedReader rd; try { rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); } catch (java.io.UnsupportedEncodingException e) { rd = new BufferedReader(new InputStreamReader(is)); } String factoryClassName = null; try { // XXX Does not handle all possible input as specified by the // Jar Service Provider specification factoryClassName = rd.readLine(); } catch (IOException x) { // No provider found return null; } finally { try { // try to close the reader. rd.close(); } // Ignore the exception. catch (IOException exc) {} } if (factoryClassName != null && ! "".equals(factoryClassName)) { debugPrintln("found in resource, value=" + factoryClassName); // Note: here we do not want to fall back to the current // ClassLoader because we want to avoid the case where the // resource file was found using one ClassLoader and the // provider class was instantiated using a different one. return factoryClassName; } // No provider found return null; }
[ "private", "static", "String", "findJarServiceProviderName", "(", "String", "factoryId", ")", "{", "SecuritySupport", "ss", "=", "SecuritySupport", ".", "getInstance", "(", ")", ";", "String", "serviceId", "=", "SERVICES_PATH", "+", "factoryId", ";", "InputStream", ...
Find the name of service provider using Jar Service Provider Mechanism @return instance of provider class if found or null
[ "Find", "the", "name", "of", "service", "provider", "using", "Jar", "Service", "Provider", "Mechanism" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java#L534-L617
34,042
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SNIServerName.java
SNIServerName.toHexString
private static String toHexString(byte[] bytes) { if (bytes.length == 0) { return "(empty)"; } StringBuilder sb = new StringBuilder(bytes.length * 3 - 1); boolean isInitial = true; for (byte b : bytes) { if (isInitial) { isInitial = false; } else { sb.append(':'); } int k = b & 0xFF; sb.append(HEXES[k >>> 4]); sb.append(HEXES[k & 0xF]); } return sb.toString(); }
java
private static String toHexString(byte[] bytes) { if (bytes.length == 0) { return "(empty)"; } StringBuilder sb = new StringBuilder(bytes.length * 3 - 1); boolean isInitial = true; for (byte b : bytes) { if (isInitial) { isInitial = false; } else { sb.append(':'); } int k = b & 0xFF; sb.append(HEXES[k >>> 4]); sb.append(HEXES[k & 0xF]); } return sb.toString(); }
[ "private", "static", "String", "toHexString", "(", "byte", "[", "]", "bytes", ")", "{", "if", "(", "bytes", ".", "length", "==", "0", ")", "{", "return", "\"(empty)\"", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "bytes", ".", "l...
convert byte array to hex string
[ "convert", "byte", "array", "to", "hex", "string" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SNIServerName.java#L191-L211
34,043
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.setStartYear
public void setStartYear(int year) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } getSTZInfo().sy = year; this.startYear = year; transitionRulesInitialized = false; }
java
public void setStartYear(int year) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } getSTZInfo().sy = year; this.startYear = year; transitionRulesInitialized = false; }
[ "public", "void", "setStartYear", "(", "int", "year", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify a frozen SimpleTimeZone instance.\"", ")", ";", "}", "getSTZInfo", "(", ")", ".", ...
Sets the daylight savings starting year. @param year The daylight savings starting year.
[ "Sets", "the", "daylight", "savings", "starting", "year", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L276-L284
34,044
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.setStartRule
public void setStartRule(int month, int dayOfMonth, int time) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } getSTZInfo().setStart(month, -1, -1, time, dayOfMonth, false); setStartRule(month, dayOfMonth, 0, time, WALL_TIME); }
java
public void setStartRule(int month, int dayOfMonth, int time) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } getSTZInfo().setStart(month, -1, -1, time, dayOfMonth, false); setStartRule(month, dayOfMonth, 0, time, WALL_TIME); }
[ "public", "void", "setStartRule", "(", "int", "month", ",", "int", "dayOfMonth", ",", "int", "time", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify a frozen SimpleTimeZone instance.\"",...
Sets the DST start rule to a fixed date within a month. @param month The month in which this rule occurs (0-based). @param dayOfMonth The date in that month (1-based). @param time The time of that day (number of millis after midnight) when DST takes effect in local wall time, which is standard time in this case. @throws IllegalArgumentException the month, dayOfMonth, or time parameters are out of range
[ "Sets", "the", "DST", "start", "rule", "to", "a", "fixed", "date", "within", "a", "month", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L378-L385
34,045
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.setEndRule
public void setEndRule(int month, int dayOfMonth, int time) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } getSTZInfo().setEnd(month, -1, -1, time, dayOfMonth, false); setEndRule(month, dayOfMonth, WALL_TIME, time); }
java
public void setEndRule(int month, int dayOfMonth, int time) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } getSTZInfo().setEnd(month, -1, -1, time, dayOfMonth, false); setEndRule(month, dayOfMonth, WALL_TIME, time); }
[ "public", "void", "setEndRule", "(", "int", "month", ",", "int", "dayOfMonth", ",", "int", "time", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify a frozen SimpleTimeZone instance.\"", ...
Sets the DST end rule to a fixed date within a month. @param month The month in which this rule occurs (0-based). @param dayOfMonth The date in that month (1-based). @param time The time of that day (number of millis after midnight) when DST ends in local wall time, which is daylight time in this case. @throws IllegalArgumentException the month, dayOfMonth, or time parameters are out of range
[ "Sets", "the", "DST", "end", "rule", "to", "a", "fixed", "date", "within", "a", "month", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L452-L459
34,046
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.setDSTSavings
public void setDSTSavings(int millisSavedDuringDST) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } if (millisSavedDuringDST <= 0) { throw new IllegalArgumentException(); } dst = millisSavedDuringDST; transitionRulesInitialized = false; }
java
public void setDSTSavings(int millisSavedDuringDST) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen SimpleTimeZone instance."); } if (millisSavedDuringDST <= 0) { throw new IllegalArgumentException(); } dst = millisSavedDuringDST; transitionRulesInitialized = false; }
[ "public", "void", "setDSTSavings", "(", "int", "millisSavedDuringDST", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify a frozen SimpleTimeZone instance.\"", ")", ";", "}", "if", "(", "mi...
Sets the amount of time in ms that the clock is advanced during DST. @param millisSavedDuringDST the number of milliseconds the time is advanced with respect to standard time when the daylight savings rules are in effect. A positive number, typically one hour (3600000).
[ "Sets", "the", "amount", "of", "time", "in", "ms", "that", "the", "clock", "is", "advanced", "during", "DST", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L528-L539
34,047
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.readObject
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); /* String id = getID(); if (id!=null && !(zone instanceof java.util.SimpleTimeZone && zone.getID().equals(id))) { // System.out.println("*** readjust " + zone.getClass().getName() + // " " + zone.getID() + " ***"); java.util.SimpleTimeZone stz = new java.util.SimpleTimeZone(raw, id); if (dst != 0) { stz.setDSTSavings(dst); // if it is 0, then there shouldn't be start/end rules and the default // behavior should be no dst } if (xinfo != null) { xinfo.applyTo(stz); } zoneJDK = stz; } */ /* set all instance variables in this object * to the values in zone */ if (xinfo != null) { xinfo.applyTo(this); } }
java
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); /* String id = getID(); if (id!=null && !(zone instanceof java.util.SimpleTimeZone && zone.getID().equals(id))) { // System.out.println("*** readjust " + zone.getClass().getName() + // " " + zone.getID() + " ***"); java.util.SimpleTimeZone stz = new java.util.SimpleTimeZone(raw, id); if (dst != 0) { stz.setDSTSavings(dst); // if it is 0, then there shouldn't be start/end rules and the default // behavior should be no dst } if (xinfo != null) { xinfo.applyTo(stz); } zoneJDK = stz; } */ /* set all instance variables in this object * to the values in zone */ if (xinfo != null) { xinfo.applyTo(this); } }
[ "private", "void", "readObject", "(", "java", ".", "io", ".", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "in", ".", "defaultReadObject", "(", ")", ";", "/*\n String id = getID();\n if (id!=null && !(zone inst...
on JDK 1.4 and later, can't deserialize a SimpleTimeZone as a SimpleTimeZone...
[ "on", "JDK", "1", ".", "4", "and", "later", "can", "t", "deserialize", "a", "SimpleTimeZone", "as", "a", "SimpleTimeZone", "..." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L561-L589
34,048
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.compareToRule
private int compareToRule(int month, int monthLen, int prevMonthLen, int dayOfMonth, int dayOfWeek, int millis, int millisDelta, int ruleMode, int ruleMonth, int ruleDayOfWeek, int ruleDay, int ruleMillis) { // Make adjustments for startTimeMode and endTimeMode millis += millisDelta; while (millis >= Grego.MILLIS_PER_DAY) { millis -= Grego.MILLIS_PER_DAY; ++dayOfMonth; dayOfWeek = 1 + (dayOfWeek % 7); // dayOfWeek is one-based if (dayOfMonth > monthLen) { dayOfMonth = 1; /* When incrementing the month, it is desirable to overflow * from DECEMBER to DECEMBER+1, since we use the result to * compare against a real month. Wraparound of the value * leads to bug 4173604. */ ++month; } } /* * For some reasons, Sun Java 6 on Solaris/Linux has a problem with * the while loop below (at least Java 6 up to build 1.6.0_02-b08). * It looks the JRE messes up the variable 'millis' while executing * the code in the while block. The problem is not reproduced with * JVM option -Xint, that is, it is likely a bug of the HotSpot * adaptive compiler. Moving 'millis += Grego.MILLIS_PER_DAY' * to the end of this while block seems to resolve the problem. * See ticket#5887 about the problem in detail. */ while (millis < 0) { //millis += Grego.MILLIS_PER_DAY; --dayOfMonth; dayOfWeek = 1 + ((dayOfWeek+5) % 7); // dayOfWeek is one-based if (dayOfMonth < 1) { dayOfMonth = prevMonthLen; --month; } millis += Grego.MILLIS_PER_DAY; } if (month < ruleMonth) return -1; else if (month > ruleMonth) return 1; int ruleDayOfMonth = 0; // Adjust the ruleDay to the monthLen, for non-leap year February 29 rule days. if (ruleDay > monthLen) { ruleDay = monthLen; } switch (ruleMode) { case DOM_MODE: ruleDayOfMonth = ruleDay; break; case DOW_IN_MONTH_MODE: // In this case ruleDay is the day-of-week-in-month if (ruleDay > 0) ruleDayOfMonth = 1 + (ruleDay - 1) * 7 + (7 + ruleDayOfWeek - (dayOfWeek - dayOfMonth + 1)) % 7; else // Assume ruleDay < 0 here { ruleDayOfMonth = monthLen + (ruleDay + 1) * 7 - (7 + (dayOfWeek + monthLen - dayOfMonth) - ruleDayOfWeek) % 7; } break; case DOW_GE_DOM_MODE: ruleDayOfMonth = ruleDay + (49 + ruleDayOfWeek - ruleDay - dayOfWeek + dayOfMonth) % 7; break; case DOW_LE_DOM_MODE: ruleDayOfMonth = ruleDay - (49 - ruleDayOfWeek + ruleDay + dayOfWeek - dayOfMonth) % 7; // Note at this point ruleDayOfMonth may be <1, although it will // be >=1 for well-formed rules. break; } if (dayOfMonth < ruleDayOfMonth) return -1; else if (dayOfMonth > ruleDayOfMonth) return 1; if (millis < ruleMillis){ return -1; }else if (millis > ruleMillis){ return 1; }else{ return 0; } }
java
private int compareToRule(int month, int monthLen, int prevMonthLen, int dayOfMonth, int dayOfWeek, int millis, int millisDelta, int ruleMode, int ruleMonth, int ruleDayOfWeek, int ruleDay, int ruleMillis) { // Make adjustments for startTimeMode and endTimeMode millis += millisDelta; while (millis >= Grego.MILLIS_PER_DAY) { millis -= Grego.MILLIS_PER_DAY; ++dayOfMonth; dayOfWeek = 1 + (dayOfWeek % 7); // dayOfWeek is one-based if (dayOfMonth > monthLen) { dayOfMonth = 1; /* When incrementing the month, it is desirable to overflow * from DECEMBER to DECEMBER+1, since we use the result to * compare against a real month. Wraparound of the value * leads to bug 4173604. */ ++month; } } /* * For some reasons, Sun Java 6 on Solaris/Linux has a problem with * the while loop below (at least Java 6 up to build 1.6.0_02-b08). * It looks the JRE messes up the variable 'millis' while executing * the code in the while block. The problem is not reproduced with * JVM option -Xint, that is, it is likely a bug of the HotSpot * adaptive compiler. Moving 'millis += Grego.MILLIS_PER_DAY' * to the end of this while block seems to resolve the problem. * See ticket#5887 about the problem in detail. */ while (millis < 0) { //millis += Grego.MILLIS_PER_DAY; --dayOfMonth; dayOfWeek = 1 + ((dayOfWeek+5) % 7); // dayOfWeek is one-based if (dayOfMonth < 1) { dayOfMonth = prevMonthLen; --month; } millis += Grego.MILLIS_PER_DAY; } if (month < ruleMonth) return -1; else if (month > ruleMonth) return 1; int ruleDayOfMonth = 0; // Adjust the ruleDay to the monthLen, for non-leap year February 29 rule days. if (ruleDay > monthLen) { ruleDay = monthLen; } switch (ruleMode) { case DOM_MODE: ruleDayOfMonth = ruleDay; break; case DOW_IN_MONTH_MODE: // In this case ruleDay is the day-of-week-in-month if (ruleDay > 0) ruleDayOfMonth = 1 + (ruleDay - 1) * 7 + (7 + ruleDayOfWeek - (dayOfWeek - dayOfMonth + 1)) % 7; else // Assume ruleDay < 0 here { ruleDayOfMonth = monthLen + (ruleDay + 1) * 7 - (7 + (dayOfWeek + monthLen - dayOfMonth) - ruleDayOfWeek) % 7; } break; case DOW_GE_DOM_MODE: ruleDayOfMonth = ruleDay + (49 + ruleDayOfWeek - ruleDay - dayOfWeek + dayOfMonth) % 7; break; case DOW_LE_DOM_MODE: ruleDayOfMonth = ruleDay - (49 - ruleDayOfWeek + ruleDay + dayOfWeek - dayOfMonth) % 7; // Note at this point ruleDayOfMonth may be <1, although it will // be >=1 for well-formed rules. break; } if (dayOfMonth < ruleDayOfMonth) return -1; else if (dayOfMonth > ruleDayOfMonth) return 1; if (millis < ruleMillis){ return -1; }else if (millis > ruleMillis){ return 1; }else{ return 0; } }
[ "private", "int", "compareToRule", "(", "int", "month", ",", "int", "monthLen", ",", "int", "prevMonthLen", ",", "int", "dayOfMonth", ",", "int", "dayOfWeek", ",", "int", "millis", ",", "int", "millisDelta", ",", "int", "ruleMode", ",", "int", "ruleMonth", ...
Compare a given date in the year to a rule. Return 1, 0, or -1, depending on whether the date is after, equal to, or before the rule date. The millis are compared directly against the ruleMillis, so any standard-daylight adjustments must be handled by the caller. @return 1 if the date is after the rule date, -1 if the date is before the rule date, or 0 if the date is equal to the rule date.
[ "Compare", "a", "given", "date", "in", "the", "year", "to", "a", "rule", ".", "Return", "1", "0", "or", "-", "1", "depending", "on", "whether", "the", "date", "is", "after", "equal", "to", "or", "before", "the", "rule", "date", ".", "The", "millis", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L826-L918
34,049
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.inDaylightTime
@Override public boolean inDaylightTime(Date date){ GregorianCalendar gc = new GregorianCalendar(this); gc.setTime(date); return gc.inDaylightTime(); }
java
@Override public boolean inDaylightTime(Date date){ GregorianCalendar gc = new GregorianCalendar(this); gc.setTime(date); return gc.inDaylightTime(); }
[ "@", "Override", "public", "boolean", "inDaylightTime", "(", "Date", "date", ")", "{", "GregorianCalendar", "gc", "=", "new", "GregorianCalendar", "(", "this", ")", ";", "gc", ".", "setTime", "(", "date", ")", ";", "return", "gc", ".", "inDaylightTime", "(...
Overrides TimeZone Queries if the give date is in Daylight Saving Time.
[ "Overrides", "TimeZone", "Queries", "if", "the", "give", "date", "is", "in", "Daylight", "Saving", "Time", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L954-L959
34,050
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.construct
private void construct(int _raw, int _startMonth, int _startDay, int _startDayOfWeek, int _startTime, int _startTimeMode, int _endMonth, int _endDay, int _endDayOfWeek, int _endTime, int _endTimeMode, int _dst) { raw = _raw; startMonth = _startMonth; startDay = _startDay; startDayOfWeek = _startDayOfWeek; startTime = _startTime; startTimeMode = _startTimeMode; endMonth = _endMonth; endDay = _endDay; endDayOfWeek = _endDayOfWeek; endTime = _endTime; endTimeMode = _endTimeMode; dst = _dst; startYear = 0; startMode = DOM_MODE; endMode = DOM_MODE; decodeRules(); if (_dst <= 0) { throw new IllegalArgumentException(); } }
java
private void construct(int _raw, int _startMonth, int _startDay, int _startDayOfWeek, int _startTime, int _startTimeMode, int _endMonth, int _endDay, int _endDayOfWeek, int _endTime, int _endTimeMode, int _dst) { raw = _raw; startMonth = _startMonth; startDay = _startDay; startDayOfWeek = _startDayOfWeek; startTime = _startTime; startTimeMode = _startTimeMode; endMonth = _endMonth; endDay = _endDay; endDayOfWeek = _endDayOfWeek; endTime = _endTime; endTimeMode = _endTimeMode; dst = _dst; startYear = 0; startMode = DOM_MODE; endMode = DOM_MODE; decodeRules(); if (_dst <= 0) { throw new IllegalArgumentException(); } }
[ "private", "void", "construct", "(", "int", "_raw", ",", "int", "_startMonth", ",", "int", "_startDay", ",", "int", "_startDayOfWeek", ",", "int", "_startTime", ",", "int", "_startTimeMode", ",", "int", "_endMonth", ",", "int", "_endDay", ",", "int", "_endDa...
Internal construction method.
[ "Internal", "construction", "method", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L964-L997
34,051
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.hasSameRules
@Override public boolean hasSameRules(TimeZone othr) { if (this == othr) { return true; } if(!(othr instanceof SimpleTimeZone)){ return false; } SimpleTimeZone other = (SimpleTimeZone)othr; return other != null && raw == other.raw && useDaylight == other.useDaylight && (!useDaylight // Only check rules if using DST || (dst == other.dst && startMode == other.startMode && startMonth == other.startMonth && startDay == other.startDay && startDayOfWeek == other.startDayOfWeek && startTime == other.startTime && startTimeMode == other.startTimeMode && endMode == other.endMode && endMonth == other.endMonth && endDay == other.endDay && endDayOfWeek == other.endDayOfWeek && endTime == other.endTime && endTimeMode == other.endTimeMode && startYear == other.startYear)); }
java
@Override public boolean hasSameRules(TimeZone othr) { if (this == othr) { return true; } if(!(othr instanceof SimpleTimeZone)){ return false; } SimpleTimeZone other = (SimpleTimeZone)othr; return other != null && raw == other.raw && useDaylight == other.useDaylight && (!useDaylight // Only check rules if using DST || (dst == other.dst && startMode == other.startMode && startMonth == other.startMonth && startDay == other.startDay && startDayOfWeek == other.startDayOfWeek && startTime == other.startTime && startTimeMode == other.startTimeMode && endMode == other.endMode && endMonth == other.endMonth && endDay == other.endDay && endDayOfWeek == other.endDayOfWeek && endTime == other.endTime && endTimeMode == other.endTimeMode && startYear == other.startYear)); }
[ "@", "Override", "public", "boolean", "hasSameRules", "(", "TimeZone", "othr", ")", "{", "if", "(", "this", "==", "othr", ")", "{", "return", "true", ";", "}", "if", "(", "!", "(", "othr", "instanceof", "SimpleTimeZone", ")", ")", "{", "return", "false...
Returns true if this zone has the same rules and offset as another zone. @param othr the TimeZone object to be compared with @return true if the given zone has the same rules and offset as this one
[ "Returns", "true", "if", "this", "zone", "has", "the", "same", "rules", "and", "offset", "as", "another", "zone", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L1197-L1225
34,052
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java
X509Factory.readFully
private static int readFully(InputStream in, ByteArrayOutputStream bout, int length) throws IOException { int read = 0; byte[] buffer = new byte[2048]; while (length > 0) { int n = in.read(buffer, 0, length<2048?length:2048); if (n <= 0) { break; } bout.write(buffer, 0, n); read += n; length -= n; } return read; }
java
private static int readFully(InputStream in, ByteArrayOutputStream bout, int length) throws IOException { int read = 0; byte[] buffer = new byte[2048]; while (length > 0) { int n = in.read(buffer, 0, length<2048?length:2048); if (n <= 0) { break; } bout.write(buffer, 0, n); read += n; length -= n; } return read; }
[ "private", "static", "int", "readFully", "(", "InputStream", "in", ",", "ByteArrayOutputStream", "bout", ",", "int", "length", ")", "throws", "IOException", "{", "int", "read", "=", "0", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "2048", "...
Read from the stream until length bytes have been read or EOF has been reached. Return the number of bytes actually read.
[ "Read", "from", "the", "stream", "until", "length", "bytes", "have", "been", "read", "or", "EOF", "has", "been", "reached", ".", "Return", "the", "number", "of", "bytes", "actually", "read", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java#L126-L140
34,053
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java
X509Factory.intern
public static synchronized X509CertImpl intern(X509Certificate c) throws CertificateException { if (c == null) { return null; } boolean isImpl = c instanceof X509CertImpl; byte[] encoding; if (isImpl) { encoding = ((X509CertImpl)c).getEncodedInternal(); } else { encoding = c.getEncoded(); } X509CertImpl newC = (X509CertImpl)getFromCache(certCache, encoding); if (newC != null) { return newC; } if (isImpl) { newC = (X509CertImpl)c; } else { newC = new X509CertImpl(encoding); encoding = newC.getEncodedInternal(); } addToCache(certCache, encoding, newC); return newC; }
java
public static synchronized X509CertImpl intern(X509Certificate c) throws CertificateException { if (c == null) { return null; } boolean isImpl = c instanceof X509CertImpl; byte[] encoding; if (isImpl) { encoding = ((X509CertImpl)c).getEncodedInternal(); } else { encoding = c.getEncoded(); } X509CertImpl newC = (X509CertImpl)getFromCache(certCache, encoding); if (newC != null) { return newC; } if (isImpl) { newC = (X509CertImpl)c; } else { newC = new X509CertImpl(encoding); encoding = newC.getEncodedInternal(); } addToCache(certCache, encoding, newC); return newC; }
[ "public", "static", "synchronized", "X509CertImpl", "intern", "(", "X509Certificate", "c", ")", "throws", "CertificateException", "{", "if", "(", "c", "==", "null", ")", "{", "return", "null", ";", "}", "boolean", "isImpl", "=", "c", "instanceof", "X509CertImp...
Return an interned X509CertImpl for the given certificate. If the given X509Certificate or X509CertImpl is already present in the cert cache, the cached object is returned. Otherwise, if it is a X509Certificate, it is first converted to a X509CertImpl. Then the X509CertImpl is added to the cache and returned. Note that all certificates created via generateCertificate(InputStream) are already interned and this method does not need to be called. It is useful for certificates that cannot be created via generateCertificate() and for converting other X509Certificate implementations to an X509CertImpl.
[ "Return", "an", "interned", "X509CertImpl", "for", "the", "given", "certificate", ".", "If", "the", "given", "X509Certificate", "or", "X509CertImpl", "is", "already", "present", "in", "the", "cert", "cache", "the", "cached", "object", "is", "returned", ".", "O...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java#L155-L179
34,054
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java
X509Factory.getFromCache
private static synchronized Object getFromCache(Cache cache, byte[] encoding) { Object key = new Cache.EqualByteArray(encoding); Object value = cache.get(key); return value; }
java
private static synchronized Object getFromCache(Cache cache, byte[] encoding) { Object key = new Cache.EqualByteArray(encoding); Object value = cache.get(key); return value; }
[ "private", "static", "synchronized", "Object", "getFromCache", "(", "Cache", "cache", ",", "byte", "[", "]", "encoding", ")", "{", "Object", "key", "=", "new", "Cache", ".", "EqualByteArray", "(", "encoding", ")", ";", "Object", "value", "=", "cache", ".",...
Get the X509CertImpl or X509CRLImpl from the cache.
[ "Get", "the", "X509CertImpl", "or", "X509CRLImpl", "from", "the", "cache", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java#L214-L219
34,055
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java
X509Factory.addToCache
private static synchronized void addToCache(Cache cache, byte[] encoding, Object value) { if (encoding.length > ENC_MAX_LENGTH) { return; } Object key = new Cache.EqualByteArray(encoding); cache.put(key, value); }
java
private static synchronized void addToCache(Cache cache, byte[] encoding, Object value) { if (encoding.length > ENC_MAX_LENGTH) { return; } Object key = new Cache.EqualByteArray(encoding); cache.put(key, value); }
[ "private", "static", "synchronized", "void", "addToCache", "(", "Cache", "cache", ",", "byte", "[", "]", "encoding", ",", "Object", "value", ")", "{", "if", "(", "encoding", ".", "length", ">", "ENC_MAX_LENGTH", ")", "{", "return", ";", "}", "Object", "k...
Add the X509CertImpl or X509CRLImpl to the cache.
[ "Add", "the", "X509CertImpl", "or", "X509CRLImpl", "to", "the", "cache", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java#L224-L231
34,056
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java
X509Factory.readOneBlock
private static byte[] readOneBlock(InputStream is) throws IOException { // The first character of a BLOCK. int c = is.read(); if (c == -1) { return null; } if (c == DerValue.tag_Sequence) { ByteArrayOutputStream bout = new ByteArrayOutputStream(2048); bout.write(c); readBERInternal(is, bout, c); return bout.toByteArray(); } else { // Read BASE64 encoded data, might skip info at the beginning char[] data = new char[2048]; int pos = 0; // Step 1: Read until header is found int hyphen = (c=='-') ? 1: 0; // count of consequent hyphens int last = (c=='-') ? -1: c; // the char before hyphen while (true) { int next = is.read(); if (next == -1) { // We accept useless data after the last block, // say, empty lines. return null; } if (next == '-') { hyphen++; } else { hyphen = 0; last = next; } if (hyphen == 5 && (last==-1 || last=='\r' || last=='\n')) { break; } } // Step 2: Read the rest of header, determine the line end int end; StringBuffer header = new StringBuffer("-----"); while (true) { int next = is.read(); if (next == -1) { throw new IOException("Incomplete data"); } if (next == '\n') { end = '\n'; break; } if (next == '\r') { next = is.read(); if (next == -1) { throw new IOException("Incomplete data"); } if (next == '\n') { end = '\n'; } else { end = '\r'; data[pos++] = (char)next; } break; } header.append((char)next); } // Step 3: Read the data while (true) { int next = is.read(); if (next == -1) { throw new IOException("Incomplete data"); } if (next != '-') { data[pos++] = (char)next; if (pos >= data.length) { data = Arrays.copyOf(data, data.length+1024); } } else { break; } } // Step 4: Consume the footer StringBuffer footer = new StringBuffer("-"); while (true) { int next = is.read(); // Add next == '\n' for maximum safety, in case endline // is not consistent. if (next == -1 || next == end || next == '\n') { break; } if (next != '\r') footer.append((char)next); } checkHeaderFooter(header.toString(), footer.toString()); BASE64Decoder decoder = new BASE64Decoder(); return decoder.decodeBuffer(new String(data, 0, pos)); } }
java
private static byte[] readOneBlock(InputStream is) throws IOException { // The first character of a BLOCK. int c = is.read(); if (c == -1) { return null; } if (c == DerValue.tag_Sequence) { ByteArrayOutputStream bout = new ByteArrayOutputStream(2048); bout.write(c); readBERInternal(is, bout, c); return bout.toByteArray(); } else { // Read BASE64 encoded data, might skip info at the beginning char[] data = new char[2048]; int pos = 0; // Step 1: Read until header is found int hyphen = (c=='-') ? 1: 0; // count of consequent hyphens int last = (c=='-') ? -1: c; // the char before hyphen while (true) { int next = is.read(); if (next == -1) { // We accept useless data after the last block, // say, empty lines. return null; } if (next == '-') { hyphen++; } else { hyphen = 0; last = next; } if (hyphen == 5 && (last==-1 || last=='\r' || last=='\n')) { break; } } // Step 2: Read the rest of header, determine the line end int end; StringBuffer header = new StringBuffer("-----"); while (true) { int next = is.read(); if (next == -1) { throw new IOException("Incomplete data"); } if (next == '\n') { end = '\n'; break; } if (next == '\r') { next = is.read(); if (next == -1) { throw new IOException("Incomplete data"); } if (next == '\n') { end = '\n'; } else { end = '\r'; data[pos++] = (char)next; } break; } header.append((char)next); } // Step 3: Read the data while (true) { int next = is.read(); if (next == -1) { throw new IOException("Incomplete data"); } if (next != '-') { data[pos++] = (char)next; if (pos >= data.length) { data = Arrays.copyOf(data, data.length+1024); } } else { break; } } // Step 4: Consume the footer StringBuffer footer = new StringBuffer("-"); while (true) { int next = is.read(); // Add next == '\n' for maximum safety, in case endline // is not consistent. if (next == -1 || next == end || next == '\n') { break; } if (next != '\r') footer.append((char)next); } checkHeaderFooter(header.toString(), footer.toString()); BASE64Decoder decoder = new BASE64Decoder(); return decoder.decodeBuffer(new String(data, 0, pos)); } }
[ "private", "static", "byte", "[", "]", "readOneBlock", "(", "InputStream", "is", ")", "throws", "IOException", "{", "// The first character of a BLOCK.", "int", "c", "=", "is", ".", "read", "(", ")", ";", "if", "(", "c", "==", "-", "1", ")", "{", "return...
Returns an ASN.1 SEQUENCE from a stream, which might be a BER-encoded binary block or a PEM-style BASE64-encoded ASCII data. In the latter case, it's de-BASE64'ed before return. After the reading, the input stream pointer is after the BER block, or after the newline character after the -----END SOMETHING----- line. @param is the InputStream @returns byte block or null if end of stream @throws IOException If any parsing error
[ "Returns", "an", "ASN", ".", "1", "SEQUENCE", "from", "a", "stream", "which", "might", "be", "a", "BER", "-", "encoded", "binary", "block", "or", "a", "PEM", "-", "style", "BASE64", "-", "encoded", "ASCII", "data", ".", "In", "the", "latter", "case", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/X509Factory.java#L494-L593
34,057
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Level.java
Level.readResolve
private Object readResolve() { KnownLevel o = KnownLevel.matches(this); if (o != null) { return o.levelObject; } // Woops. Whoever sent us this object knows // about a new log level. Add it to our list. Level level = new Level(this.name, this.value, this.resourceBundleName); return level; }
java
private Object readResolve() { KnownLevel o = KnownLevel.matches(this); if (o != null) { return o.levelObject; } // Woops. Whoever sent us this object knows // about a new log level. Add it to our list. Level level = new Level(this.name, this.value, this.resourceBundleName); return level; }
[ "private", "Object", "readResolve", "(", ")", "{", "KnownLevel", "o", "=", "KnownLevel", ".", "matches", "(", "this", ")", ";", "if", "(", "o", "!=", "null", ")", "{", "return", "o", ".", "levelObject", ";", "}", "// Woops. Whoever sent us this object knows...
This is a performance optimization.
[ "This", "is", "a", "performance", "optimization", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Level.java#L362-L372
34,058
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java
UnicodeCompressor.reset
public void reset() { int i; // reset dynamic windows fOffsets[0] = 0x0080; // Latin-1 fOffsets[1] = 0x00C0; // Latin-1 Supplement + Latin Extended-A fOffsets[2] = 0x0400; // Cyrillic fOffsets[3] = 0x0600; // Arabic fOffsets[4] = 0x0900; // Devanagari fOffsets[5] = 0x3040; // Hiragana fOffsets[6] = 0x30A0; // Katakana fOffsets[7] = 0xFF00; // Fullwidth ASCII // reset time stamps for(i = 0; i < NUMWINDOWS; i++) { fTimeStamps[i] = 0; } // reset count of seen indices for(i = 0; i <= MAXINDEX; i++ ) { fIndexCount[i] = 0; } fTimeStamp = 0; // Reset current time stamp fCurrentWindow = 0; // Make current window Latin-1 fMode = SINGLEBYTEMODE; // Always start in single-byte mode }
java
public void reset() { int i; // reset dynamic windows fOffsets[0] = 0x0080; // Latin-1 fOffsets[1] = 0x00C0; // Latin-1 Supplement + Latin Extended-A fOffsets[2] = 0x0400; // Cyrillic fOffsets[3] = 0x0600; // Arabic fOffsets[4] = 0x0900; // Devanagari fOffsets[5] = 0x3040; // Hiragana fOffsets[6] = 0x30A0; // Katakana fOffsets[7] = 0xFF00; // Fullwidth ASCII // reset time stamps for(i = 0; i < NUMWINDOWS; i++) { fTimeStamps[i] = 0; } // reset count of seen indices for(i = 0; i <= MAXINDEX; i++ ) { fIndexCount[i] = 0; } fTimeStamp = 0; // Reset current time stamp fCurrentWindow = 0; // Make current window Latin-1 fMode = SINGLEBYTEMODE; // Always start in single-byte mode }
[ "public", "void", "reset", "(", ")", "{", "int", "i", ";", "// reset dynamic windows", "fOffsets", "[", "0", "]", "=", "0x0080", ";", "// Latin-1", "fOffsets", "[", "1", "]", "=", "0x00C0", ";", "// Latin-1 Supplement + Latin Extended-A", "fOffsets", "[", "2",...
Reset the compressor to its initial state.
[ "Reset", "the", "compressor", "to", "its", "initial", "state", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java#L821-L849
34,059
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java
UnicodeCompressor.findDynamicWindow
private int findDynamicWindow(int c) { // supposedly faster to count down //for(int i = 0; i < NUMWINDOWS; i++) { for(int i = NUMWINDOWS - 1; i >= 0; --i) { if(inDynamicWindow(c, i)) { ++fTimeStamps[i]; return i; } } return INVALIDWINDOW; }
java
private int findDynamicWindow(int c) { // supposedly faster to count down //for(int i = 0; i < NUMWINDOWS; i++) { for(int i = NUMWINDOWS - 1; i >= 0; --i) { if(inDynamicWindow(c, i)) { ++fTimeStamps[i]; return i; } } return INVALIDWINDOW; }
[ "private", "int", "findDynamicWindow", "(", "int", "c", ")", "{", "// supposedly faster to count down", "//for(int i = 0; i < NUMWINDOWS; i++) {", "for", "(", "int", "i", "=", "NUMWINDOWS", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "if", "(", ...
Determine if a dynamic window for a certain character is defined @param c The character in question @return The dynamic window containing <TT>c</TT>, or INVALIDWINDOW if not defined.
[ "Determine", "if", "a", "dynamic", "window", "for", "a", "certain", "character", "is", "defined" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java#L948-L960
34,060
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java
UnicodeCompressor.findStaticWindow
private static int findStaticWindow(int c) { // supposedly faster to count down //for(int i = 0; i < NUMSTATICWINDOWS; i++) { for(int i = NUMSTATICWINDOWS - 1; i >= 0; --i) { if(inStaticWindow(c, i)) { return i; } } return INVALIDWINDOW; }
java
private static int findStaticWindow(int c) { // supposedly faster to count down //for(int i = 0; i < NUMSTATICWINDOWS; i++) { for(int i = NUMSTATICWINDOWS - 1; i >= 0; --i) { if(inStaticWindow(c, i)) { return i; } } return INVALIDWINDOW; }
[ "private", "static", "int", "findStaticWindow", "(", "int", "c", ")", "{", "// supposedly faster to count down", "//for(int i = 0; i < NUMSTATICWINDOWS; i++) {", "for", "(", "int", "i", "=", "NUMSTATICWINDOWS", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", ...
Determine if a static window for a certain character is defined @param c The character in question @return The static window containing <TT>c</TT>, or INVALIDWINDOW if not defined.
[ "Determine", "if", "a", "static", "window", "for", "a", "certain", "character", "is", "defined" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java#L968-L979
34,061
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java
UnicodeCompressor.getLRDefinedWindow
private int getLRDefinedWindow() { int leastRU = Integer.MAX_VALUE; int whichWindow = INVALIDWINDOW; // find least recently used window // supposedly faster to count down //for( int i = 0; i < NUMWINDOWS; i++ ) { for(int i = NUMWINDOWS - 1; i >= 0; --i ) { if( fTimeStamps[i] < leastRU ) { leastRU = fTimeStamps[i]; whichWindow = i; } } return whichWindow; }
java
private int getLRDefinedWindow() { int leastRU = Integer.MAX_VALUE; int whichWindow = INVALIDWINDOW; // find least recently used window // supposedly faster to count down //for( int i = 0; i < NUMWINDOWS; i++ ) { for(int i = NUMWINDOWS - 1; i >= 0; --i ) { if( fTimeStamps[i] < leastRU ) { leastRU = fTimeStamps[i]; whichWindow = i; } } return whichWindow; }
[ "private", "int", "getLRDefinedWindow", "(", ")", "{", "int", "leastRU", "=", "Integer", ".", "MAX_VALUE", ";", "int", "whichWindow", "=", "INVALIDWINDOW", ";", "// find least recently used window", "// supposedly faster to count down", "//for( int i = 0; i < NUMWINDOWS; i++ ...
Find the least-recently defined window
[ "Find", "the", "least", "-", "recently", "defined", "window" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeCompressor.java#L986-L1002
34,062
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/StringCharacterIterator.java
StringCharacterIterator.setIndex
public char setIndex(int location) { if (location < start || location > end) { throw new IllegalArgumentException(); } offset = location; if (offset == end) { return DONE; } return string.charAt(offset); }
java
public char setIndex(int location) { if (location < start || location > end) { throw new IllegalArgumentException(); } offset = location; if (offset == end) { return DONE; } return string.charAt(offset); }
[ "public", "char", "setIndex", "(", "int", "location", ")", "{", "if", "(", "location", "<", "start", "||", "location", ">", "end", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "offset", "=", "location", ";", "if", "(", "off...
Sets the current index in the source string. @param location the index the current position is set to. @return the character at the new index, or {@code DONE} if {@code location} is set to the end index. @throws IllegalArgumentException if {@code location} is smaller than the begin index or greater than the end index.
[ "Sets", "the", "current", "index", "in", "the", "source", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/StringCharacterIterator.java#L246-L255
34,063
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/StringCharacterIterator.java
StringCharacterIterator.setText
public void setText(String value) { string = value; start = offset = 0; end = value.length(); }
java
public void setText(String value) { string = value; start = offset = 0; end = value.length(); }
[ "public", "void", "setText", "(", "String", "value", ")", "{", "string", "=", "value", ";", "start", "=", "offset", "=", "0", ";", "end", "=", "value", ".", "length", "(", ")", ";", "}" ]
Sets the source string to iterate over. The begin and end positions are set to the start and end of this string. @param value the new source string.
[ "Sets", "the", "source", "string", "to", "iterate", "over", ".", "The", "begin", "and", "end", "positions", "are", "set", "to", "the", "start", "and", "end", "of", "this", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/StringCharacterIterator.java#L264-L268
34,064
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java
UniversalTimeScale.getTimeScaleValue
public static long getTimeScaleValue(int scale, int value) { TimeScaleData data = getTimeScaleData(scale); switch (value) { case UNITS_VALUE: return data.units; case EPOCH_OFFSET_VALUE: return data.epochOffset; case FROM_MIN_VALUE: return data.fromMin; case FROM_MAX_VALUE: return data.fromMax; case TO_MIN_VALUE: return data.toMin; case TO_MAX_VALUE: return data.toMax; case EPOCH_OFFSET_PLUS_1_VALUE: return data.epochOffsetP1; case EPOCH_OFFSET_MINUS_1_VALUE: return data.epochOffsetM1; case UNITS_ROUND_VALUE: return data.unitsRound; case MIN_ROUND_VALUE: return data.minRound; case MAX_ROUND_VALUE: return data.maxRound; default: throw new IllegalArgumentException("value out of range: " + value); } }
java
public static long getTimeScaleValue(int scale, int value) { TimeScaleData data = getTimeScaleData(scale); switch (value) { case UNITS_VALUE: return data.units; case EPOCH_OFFSET_VALUE: return data.epochOffset; case FROM_MIN_VALUE: return data.fromMin; case FROM_MAX_VALUE: return data.fromMax; case TO_MIN_VALUE: return data.toMin; case TO_MAX_VALUE: return data.toMax; case EPOCH_OFFSET_PLUS_1_VALUE: return data.epochOffsetP1; case EPOCH_OFFSET_MINUS_1_VALUE: return data.epochOffsetM1; case UNITS_ROUND_VALUE: return data.unitsRound; case MIN_ROUND_VALUE: return data.minRound; case MAX_ROUND_VALUE: return data.maxRound; default: throw new IllegalArgumentException("value out of range: " + value); } }
[ "public", "static", "long", "getTimeScaleValue", "(", "int", "scale", ",", "int", "value", ")", "{", "TimeScaleData", "data", "=", "getTimeScaleData", "(", "scale", ")", ";", "switch", "(", "value", ")", "{", "case", "UNITS_VALUE", ":", "return", "data", "...
Get a value associated with a particular time scale. @param scale - the time scale @param value - a constant representing the value to get @return - the value.
[ "Get", "a", "value", "associated", "with", "a", "particular", "time", "scale", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java#L518-L560
34,065
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java
UniversalTimeScale.toBigDecimalTrunc
@Deprecated public static BigDecimal toBigDecimalTrunc(BigDecimal universalTime, int timeScale) { TimeScaleData data = getTimeScaleData(timeScale); BigDecimal units = new BigDecimal(data.units); BigDecimal epochOffset = new BigDecimal(data.epochOffset); return universalTime.divide(units, BigDecimal.ROUND_DOWN).subtract(epochOffset); }
java
@Deprecated public static BigDecimal toBigDecimalTrunc(BigDecimal universalTime, int timeScale) { TimeScaleData data = getTimeScaleData(timeScale); BigDecimal units = new BigDecimal(data.units); BigDecimal epochOffset = new BigDecimal(data.epochOffset); return universalTime.divide(units, BigDecimal.ROUND_DOWN).subtract(epochOffset); }
[ "@", "Deprecated", "public", "static", "BigDecimal", "toBigDecimalTrunc", "(", "BigDecimal", "universalTime", ",", "int", "timeScale", ")", "{", "TimeScaleData", "data", "=", "getTimeScaleData", "(", "timeScale", ")", ";", "BigDecimal", "units", "=", "new", "BigDe...
Convert a time in the Universal Time Scale into another time scale. The division used to do the conversion rounds down. NOTE: This is an internal routine used by the tool that generates the to and from limits. Use it at your own risk. @param universalTime the time in the Universal Time scale @param timeScale the time scale to convert to @return the time in the given time scale @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Convert", "a", "time", "in", "the", "Universal", "Time", "Scale", "into", "another", "time", "scale", ".", "The", "division", "used", "to", "do", "the", "conversion", "rounds", "down", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java#L598-L606
34,066
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/And.java
And.execute
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject expr1 = m_left.execute(xctxt); if (expr1.bool()) { XObject expr2 = m_right.execute(xctxt); return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } else return XBoolean.S_FALSE; }
java
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject expr1 = m_left.execute(xctxt); if (expr1.bool()) { XObject expr2 = m_right.execute(xctxt); return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } else return XBoolean.S_FALSE; }
[ "public", "XObject", "execute", "(", "XPathContext", "xctxt", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "XObject", "expr1", "=", "m_left", ".", "execute", "(", "xctxt", ")", ";", "if", "(", "expr1", ".", "bool"...
AND two expressions and return the boolean result. Override superclass method for optimization purposes. @param xctxt The runtime execution context. @return {@link org.apache.xpath.objects.XBoolean#S_TRUE} or {@link org.apache.xpath.objects.XBoolean#S_FALSE}. @throws javax.xml.transform.TransformerException
[ "AND", "two", "expressions", "and", "return", "the", "boolean", "result", ".", "Override", "superclass", "method", "for", "optimization", "purposes", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/And.java#L45-L58
34,067
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/IoUtils.java
IoUtils.setBlocking
public static void setBlocking(FileDescriptor fd, boolean blocking) throws IOException { try { int flags = Libcore.os.fcntlVoid(fd, F_GETFL); if (!blocking) { flags |= O_NONBLOCK; } else { flags &= ~O_NONBLOCK; } Libcore.os.fcntlLong(fd, F_SETFL, flags); } catch (ErrnoException errnoException) { throw errnoException.rethrowAsIOException(); } }
java
public static void setBlocking(FileDescriptor fd, boolean blocking) throws IOException { try { int flags = Libcore.os.fcntlVoid(fd, F_GETFL); if (!blocking) { flags |= O_NONBLOCK; } else { flags &= ~O_NONBLOCK; } Libcore.os.fcntlLong(fd, F_SETFL, flags); } catch (ErrnoException errnoException) { throw errnoException.rethrowAsIOException(); } }
[ "public", "static", "void", "setBlocking", "(", "FileDescriptor", "fd", ",", "boolean", "blocking", ")", "throws", "IOException", "{", "try", "{", "int", "flags", "=", "Libcore", ".", "os", ".", "fcntlVoid", "(", "fd", ",", "F_GETFL", ")", ";", "if", "("...
Sets 'fd' to be blocking or non-blocking, according to the state of 'blocking'.
[ "Sets", "fd", "to", "be", "blocking", "or", "non", "-", "blocking", "according", "to", "the", "state", "of", "blocking", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/io/IoUtils.java#L87-L99
34,068
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.initSign
public final void initSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException { engineInitSign(privateKey, random); state = SIGN; // BEGIN Android-removed: this debugging mechanism is not supported in Android. /* if (!skipDebug && pdebug != null) { pdebug.println("Signature." + algorithm + " signing algorithm from: " + this.provider.getName()); } */ // END Android-removed: this debugging mechanism is not supported in Android. }
java
public final void initSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException { engineInitSign(privateKey, random); state = SIGN; // BEGIN Android-removed: this debugging mechanism is not supported in Android. /* if (!skipDebug && pdebug != null) { pdebug.println("Signature." + algorithm + " signing algorithm from: " + this.provider.getName()); } */ // END Android-removed: this debugging mechanism is not supported in Android. }
[ "public", "final", "void", "initSign", "(", "PrivateKey", "privateKey", ",", "SecureRandom", "random", ")", "throws", "InvalidKeyException", "{", "engineInitSign", "(", "privateKey", ",", "random", ")", ";", "state", "=", "SIGN", ";", "// BEGIN Android-removed: this...
Initialize this object for signing. If this method is called again with a different argument, it negates the effect of this call. @param privateKey the private key of the identity whose signature is going to be generated. @param random the source of randomness for this signature. @exception InvalidKeyException if the key is invalid.
[ "Initialize", "this", "object", "for", "signing", ".", "If", "this", "method", "is", "called", "again", "with", "a", "different", "argument", "it", "negates", "the", "effect", "of", "this", "call", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L699-L712
34,069
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.update
public final void update(byte b) throws SignatureException { if (state == VERIFY || state == SIGN) { engineUpdate(b); } else { throw new SignatureException("object not initialized for " + "signature or verification"); } }
java
public final void update(byte b) throws SignatureException { if (state == VERIFY || state == SIGN) { engineUpdate(b); } else { throw new SignatureException("object not initialized for " + "signature or verification"); } }
[ "public", "final", "void", "update", "(", "byte", "b", ")", "throws", "SignatureException", "{", "if", "(", "state", "==", "VERIFY", "||", "state", "==", "SIGN", ")", "{", "engineUpdate", "(", "b", ")", ";", "}", "else", "{", "throw", "new", "Signature...
Updates the data to be signed or verified by a byte. @param b the byte to use for the update. @exception SignatureException if this signature object is not initialized properly.
[ "Updates", "the", "data", "to", "be", "signed", "or", "verified", "by", "a", "byte", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L870-L877
34,070
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.update
public final void update(byte[] data, int off, int len) throws SignatureException { if (state == SIGN || state == VERIFY) { if (data == null) { throw new IllegalArgumentException("data is null"); } if (off < 0 || len < 0) { throw new IllegalArgumentException("off or len is less than 0"); } if (data.length - off < len) { throw new IllegalArgumentException ("data too small for specified offset and length"); } engineUpdate(data, off, len); } else { throw new SignatureException("object not initialized for " + "signature or verification"); } }
java
public final void update(byte[] data, int off, int len) throws SignatureException { if (state == SIGN || state == VERIFY) { if (data == null) { throw new IllegalArgumentException("data is null"); } if (off < 0 || len < 0) { throw new IllegalArgumentException("off or len is less than 0"); } if (data.length - off < len) { throw new IllegalArgumentException ("data too small for specified offset and length"); } engineUpdate(data, off, len); } else { throw new SignatureException("object not initialized for " + "signature or verification"); } }
[ "public", "final", "void", "update", "(", "byte", "[", "]", "data", ",", "int", "off", ",", "int", "len", ")", "throws", "SignatureException", "{", "if", "(", "state", "==", "SIGN", "||", "state", "==", "VERIFY", ")", "{", "if", "(", "data", "==", ...
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset. @param data the array of bytes. @param off the offset to start from in the array of bytes. @param len the number of bytes to use, starting at offset. @exception SignatureException if this signature object is not initialized properly.
[ "Updates", "the", "data", "to", "be", "signed", "or", "verified", "using", "the", "specified", "array", "of", "bytes", "starting", "at", "the", "specified", "offset", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L903-L921
34,071
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java
Counter.getPreviouslyCounted
int getPreviouslyCounted(XPathContext support, int node) { int n = m_countNodes.size(); m_countResult = 0; for (int i = n - 1; i >= 0; i--) { int countedNode = m_countNodes.elementAt(i); if (node == countedNode) { // Since the list is in backwards order, the count is // how many are in the rest of the list. m_countResult = i + 1 + m_countNodesStartCount; break; } DTM dtm = support.getDTM(countedNode); // Try to see if the given node falls after the counted node... // if it does, don't keep searching backwards. if (dtm.isNodeAfter(countedNode, node)) break; } return m_countResult; }
java
int getPreviouslyCounted(XPathContext support, int node) { int n = m_countNodes.size(); m_countResult = 0; for (int i = n - 1; i >= 0; i--) { int countedNode = m_countNodes.elementAt(i); if (node == countedNode) { // Since the list is in backwards order, the count is // how many are in the rest of the list. m_countResult = i + 1 + m_countNodesStartCount; break; } DTM dtm = support.getDTM(countedNode); // Try to see if the given node falls after the counted node... // if it does, don't keep searching backwards. if (dtm.isNodeAfter(countedNode, node)) break; } return m_countResult; }
[ "int", "getPreviouslyCounted", "(", "XPathContext", "support", ",", "int", "node", ")", "{", "int", "n", "=", "m_countNodes", ".", "size", "(", ")", ";", "m_countResult", "=", "0", ";", "for", "(", "int", "i", "=", "n", "-", "1", ";", "i", ">=", "0...
Try and find a node that was previously counted. If found, return a positive integer that corresponds to the count. @param support The XPath context to use @param node The node to be counted. @return The count of the node, or -1 if not found.
[ "Try", "and", "find", "a", "node", "that", "was", "previously", "counted", ".", "If", "found", "return", "a", "positive", "integer", "that", "corresponds", "to", "the", "count", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java#L113-L143
34,072
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java
Counter.getLast
int getLast() { int size = m_countNodes.size(); return (size > 0) ? m_countNodes.elementAt(size - 1) : DTM.NULL; }
java
int getLast() { int size = m_countNodes.size(); return (size > 0) ? m_countNodes.elementAt(size - 1) : DTM.NULL; }
[ "int", "getLast", "(", ")", "{", "int", "size", "=", "m_countNodes", ".", "size", "(", ")", ";", "return", "(", "size", ">", "0", ")", "?", "m_countNodes", ".", "elementAt", "(", "size", "-", "1", ")", ":", "DTM", ".", "NULL", ";", "}" ]
Get the last node in the list. @return the last node in the list.
[ "Get", "the", "last", "node", "in", "the", "list", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java#L150-L156
34,073
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java
ComparableTimSort.pushRun
private void pushRun(int runBase, int runLen) { this.runBase[stackSize] = runBase; this.runLen[stackSize] = runLen; stackSize++; }
java
private void pushRun(int runBase, int runLen) { this.runBase[stackSize] = runBase; this.runLen[stackSize] = runLen; stackSize++; }
[ "private", "void", "pushRun", "(", "int", "runBase", ",", "int", "runLen", ")", "{", "this", ".", "runBase", "[", "stackSize", "]", "=", "runBase", ";", "this", ".", "runLen", "[", "stackSize", "]", "=", "runLen", ";", "stackSize", "++", ";", "}" ]
Pushes the specified run onto the pending-run stack. @param runBase index of the first element in the run @param runLen the number of elements in the run
[ "Pushes", "the", "specified", "run", "onto", "the", "pending", "-", "run", "stack", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java#L381-L385
34,074
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java
ComparableTimSort.mergeForceCollapse
private void mergeForceCollapse() { while (stackSize > 1) { int n = stackSize - 2; if (n > 0 && runLen[n - 1] < runLen[n + 1]) n--; mergeAt(n); } }
java
private void mergeForceCollapse() { while (stackSize > 1) { int n = stackSize - 2; if (n > 0 && runLen[n - 1] < runLen[n + 1]) n--; mergeAt(n); } }
[ "private", "void", "mergeForceCollapse", "(", ")", "{", "while", "(", "stackSize", ">", "1", ")", "{", "int", "n", "=", "stackSize", "-", "2", ";", "if", "(", "n", ">", "0", "&&", "runLen", "[", "n", "-", "1", "]", "<", "runLen", "[", "n", "+",...
Merges all runs on the stack until only one remains. This method is called once, to complete the sort.
[ "Merges", "all", "runs", "on", "the", "stack", "until", "only", "one", "remains", ".", "This", "method", "is", "called", "once", "to", "complete", "the", "sort", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java#L417-L424
34,075
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java
ChoiceFormat.setChoices
public void setChoices(double[] limits, String formats[]) { if (limits.length != formats.length) { throw new IllegalArgumentException( "Array and limit arrays must be of the same length."); } choiceLimits = limits; choiceFormats = formats; }
java
public void setChoices(double[] limits, String formats[]) { if (limits.length != formats.length) { throw new IllegalArgumentException( "Array and limit arrays must be of the same length."); } choiceLimits = limits; choiceFormats = formats; }
[ "public", "void", "setChoices", "(", "double", "[", "]", "limits", ",", "String", "formats", "[", "]", ")", "{", "if", "(", "limits", ".", "length", "!=", "formats", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Array and lim...
Set the choices to be used in formatting. @param limits contains the top value that you want parsed with that format,and should be in ascending sorted order. When formatting X, the choice will be the i, where limit[i] &lt;= X &lt; limit[i+1]. If the limit array is not in ascending order, the results of formatting will be incorrect. @param formats are the formats you want to use for each limit. They can be either Format objects or Strings. When formatting with object Y, if the object is a NumberFormat, then ((NumberFormat) Y).format(X) is called. Otherwise Y.toString() is called.
[ "Set", "the", "choices", "to", "be", "used", "in", "formatting", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java#L336-L343
34,076
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java
ChoiceFormat.format
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition status) { // find the number int i; for (i = 0; i < choiceLimits.length; ++i) { if (!(number >= choiceLimits[i])) { // same as number < choiceLimits, except catchs NaN break; } } --i; if (i < 0) i = 0; // return either a formatted number, or a string return toAppendTo.append(choiceFormats[i]); }
java
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition status) { // find the number int i; for (i = 0; i < choiceLimits.length; ++i) { if (!(number >= choiceLimits[i])) { // same as number < choiceLimits, except catchs NaN break; } } --i; if (i < 0) i = 0; // return either a formatted number, or a string return toAppendTo.append(choiceFormats[i]); }
[ "public", "StringBuffer", "format", "(", "double", "number", ",", "StringBuffer", "toAppendTo", ",", "FieldPosition", "status", ")", "{", "// find the number", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "choiceLimits", ".", "length", ";", "...
Returns pattern with formatted double. @param number number to be formatted & substituted. @param toAppendTo where text is appended. @param status ignore no useful status is returned.
[ "Returns", "pattern", "with", "formatted", "double", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java#L381-L395
34,077
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java
ChoiceFormat.parse
public Number parse(String text, ParsePosition status) { // find the best number (defined as the one with the longest parse) int start = status.index; int furthest = start; double bestNumber = Double.NaN; double tempNumber = 0.0; for (int i = 0; i < choiceFormats.length; ++i) { String tempString = choiceFormats[i]; if (text.regionMatches(start, tempString, 0, tempString.length())) { status.index = start + tempString.length(); tempNumber = choiceLimits[i]; if (status.index > furthest) { furthest = status.index; bestNumber = tempNumber; if (furthest == text.length()) break; } } } status.index = furthest; if (status.index == start) { status.errorIndex = furthest; } return new Double(bestNumber); }
java
public Number parse(String text, ParsePosition status) { // find the best number (defined as the one with the longest parse) int start = status.index; int furthest = start; double bestNumber = Double.NaN; double tempNumber = 0.0; for (int i = 0; i < choiceFormats.length; ++i) { String tempString = choiceFormats[i]; if (text.regionMatches(start, tempString, 0, tempString.length())) { status.index = start + tempString.length(); tempNumber = choiceLimits[i]; if (status.index > furthest) { furthest = status.index; bestNumber = tempNumber; if (furthest == text.length()) break; } } } status.index = furthest; if (status.index == start) { status.errorIndex = furthest; } return new Double(bestNumber); }
[ "public", "Number", "parse", "(", "String", "text", ",", "ParsePosition", "status", ")", "{", "// find the best number (defined as the one with the longest parse)", "int", "start", "=", "status", ".", "index", ";", "int", "furthest", "=", "start", ";", "double", "be...
Parses a Number from the input text. @param text the source text. @param status an input-output parameter. On input, the status.index field indicates the first character of the source text that should be parsed. On exit, if no error occured, status.index is set to the first unparsed character in the source text. On exit, if an error did occur, status.index is unchanged and status.errorIndex is set to the first index of the character that caused the parse to fail. @return A Number representing the value of the number parsed.
[ "Parses", "a", "Number", "from", "the", "input", "text", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java#L409-L432
34,078
google/j2objc
jre_emul/android/platform/external/mockwebserver/src/main/java/com/google/mockwebserver/MockWebServer.java
MockWebServer.play
public void play(int port) throws IOException { if (acceptExecutor != null) { throw new IllegalStateException("play() already called"); } // The acceptExecutor handles the Socket.accept() and hands each request off to the // requestExecutor. It also handles shutdown. acceptExecutor = Executors.newSingleThreadExecutor(); // The requestExecutor has a fixed number of worker threads. In order to get strict // guarantees that requests are handled in the order in which they are accepted // workerThreads should be set to 1. requestExecutor = Executors.newFixedThreadPool(workerThreads); serverSocket = new ServerSocket(port); serverSocket.setReuseAddress(true); this.port = serverSocket.getLocalPort(); acceptExecutor.execute(namedRunnable("MockWebServer-accept-" + port, new Runnable() { public void run() { try { acceptConnections(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer connection failed", e); } /* * This gnarly block of code will release all sockets and * all thread, even if any close fails. */ try { serverSocket.close(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer server socket close failed", e); } for (Iterator<Socket> s = openClientSockets.keySet().iterator(); s.hasNext(); ) { try { s.next().close(); s.remove(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer socket close failed", e); } } try { acceptExecutor.shutdown(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer acceptExecutor shutdown failed", e); } try { requestExecutor.shutdown(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer requestExecutor shutdown failed", e); } } private void acceptConnections() throws Exception { while (true) { Socket socket; try { socket = serverSocket.accept(); } catch (SocketException e) { return; } SocketPolicy socketPolicy = dispatcher.peek().getSocketPolicy(); if (socketPolicy == DISCONNECT_AT_START) { dispatchBookkeepingRequest(0, socket); socket.close(); } else { openClientSockets.put(socket, true); serveConnection(socket); } } } })); }
java
public void play(int port) throws IOException { if (acceptExecutor != null) { throw new IllegalStateException("play() already called"); } // The acceptExecutor handles the Socket.accept() and hands each request off to the // requestExecutor. It also handles shutdown. acceptExecutor = Executors.newSingleThreadExecutor(); // The requestExecutor has a fixed number of worker threads. In order to get strict // guarantees that requests are handled in the order in which they are accepted // workerThreads should be set to 1. requestExecutor = Executors.newFixedThreadPool(workerThreads); serverSocket = new ServerSocket(port); serverSocket.setReuseAddress(true); this.port = serverSocket.getLocalPort(); acceptExecutor.execute(namedRunnable("MockWebServer-accept-" + port, new Runnable() { public void run() { try { acceptConnections(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer connection failed", e); } /* * This gnarly block of code will release all sockets and * all thread, even if any close fails. */ try { serverSocket.close(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer server socket close failed", e); } for (Iterator<Socket> s = openClientSockets.keySet().iterator(); s.hasNext(); ) { try { s.next().close(); s.remove(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer socket close failed", e); } } try { acceptExecutor.shutdown(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer acceptExecutor shutdown failed", e); } try { requestExecutor.shutdown(); } catch (Throwable e) { logger.log(Level.WARNING, "MockWebServer requestExecutor shutdown failed", e); } } private void acceptConnections() throws Exception { while (true) { Socket socket; try { socket = serverSocket.accept(); } catch (SocketException e) { return; } SocketPolicy socketPolicy = dispatcher.peek().getSocketPolicy(); if (socketPolicy == DISCONNECT_AT_START) { dispatchBookkeepingRequest(0, socket); socket.close(); } else { openClientSockets.put(socket, true); serveConnection(socket); } } } })); }
[ "public", "void", "play", "(", "int", "port", ")", "throws", "IOException", "{", "if", "(", "acceptExecutor", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"play() already called\"", ")", ";", "}", "// The acceptExecutor handles the Socket....
Starts the server, serves all enqueued requests, and shuts the server down. @param port the port to listen to, or 0 for any available port. Automated tests should always use port 0 to avoid flakiness when a specific port is unavailable.
[ "Starts", "the", "server", "serves", "all", "enqueued", "requests", "and", "shuts", "the", "server", "down", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/mockwebserver/src/main/java/com/google/mockwebserver/MockWebServer.java#L209-L280
34,079
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Attributes.java
Attributes.putAll
public void putAll(Map<?,?> attr) { // ## javac bug? if (!Attributes.class.isInstance(attr)) throw new ClassCastException(); for (Map.Entry<?,?> me : (attr).entrySet()) put(me.getKey(), me.getValue()); } /** * Removes all attributes from this Map. */ public void clear() { map.clear(); } /** * Returns the number of attributes in this Map. */ public int size() { return map.size(); } /** * Returns true if this Map contains no attributes. */ public boolean isEmpty() { return map.isEmpty(); } /** * Returns a Set view of the attribute names (keys) contained in this Map. */ public Set<Object> keySet() { return map.keySet(); } /** * Returns a Collection view of the attribute values contained in this Map. */ public Collection<Object> values() { return map.values(); } /** * Returns a Collection view of the attribute name-value mappings * contained in this Map. */ public Set<Map.Entry<Object,Object>> entrySet() { return map.entrySet(); } /** * Compares the specified Attributes object with this Map for equality. * Returns true if the given object is also an instance of Attributes * and the two Attributes objects represent the same mappings. * * @param o the Object to be compared * @return true if the specified Object is equal to this Map */ public boolean equals(Object o) { return map.equals(o); } /** * Returns the hash code value for this Map. */ public int hashCode() { return map.hashCode(); } /** * Returns a copy of the Attributes, implemented as follows: * <pre> * public Object clone() { return new Attributes(this); } * </pre> * Since the attribute names and values are themselves immutable, * the Attributes returned can be safely modified without affecting * the original. */ public Object clone() { return new Attributes(this); } /* * Writes the current attributes to the specified data output stream. * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ void write(DataOutputStream os) throws IOException { Iterator<Map.Entry<Object, Object>> it = entrySet().iterator(); while (it.hasNext()) { Map.Entry<Object, Object> e = it.next(); StringBuffer buffer = new StringBuffer( ((Name)e.getKey()).toString()); buffer.append(": "); String value = (String)e.getValue(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append("\r\n"); Manifest.make72Safe(buffer); os.writeBytes(buffer.toString()); } os.writeBytes("\r\n"); } /* * Writes the current attributes to the specified data output stream, * make sure to write out the MANIFEST_VERSION or SIGNATURE_VERSION * attributes first. * * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ void writeMain(DataOutputStream out) throws IOException { // write out the *-Version header first, if it exists String vername = Name.MANIFEST_VERSION.toString(); String version = getValue(vername); if (version == null) { vername = Name.SIGNATURE_VERSION.toString(); version = getValue(vername); } if (version != null) { out.writeBytes(vername+": "+version+"\r\n"); } // write out all attributes except for the version // we wrote out earlier Iterator<Map.Entry<Object, Object>> it = entrySet().iterator(); while (it.hasNext()) { Map.Entry<Object, Object> e = it.next(); String name = ((Name)e.getKey()).toString(); if ((version != null) && ! (name.equalsIgnoreCase(vername))) { StringBuffer buffer = new StringBuffer(name); buffer.append(": "); String value = (String)e.getValue(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append("\r\n"); Manifest.make72Safe(buffer); out.writeBytes(buffer.toString()); } } out.writeBytes("\r\n"); }
java
public void putAll(Map<?,?> attr) { // ## javac bug? if (!Attributes.class.isInstance(attr)) throw new ClassCastException(); for (Map.Entry<?,?> me : (attr).entrySet()) put(me.getKey(), me.getValue()); } /** * Removes all attributes from this Map. */ public void clear() { map.clear(); } /** * Returns the number of attributes in this Map. */ public int size() { return map.size(); } /** * Returns true if this Map contains no attributes. */ public boolean isEmpty() { return map.isEmpty(); } /** * Returns a Set view of the attribute names (keys) contained in this Map. */ public Set<Object> keySet() { return map.keySet(); } /** * Returns a Collection view of the attribute values contained in this Map. */ public Collection<Object> values() { return map.values(); } /** * Returns a Collection view of the attribute name-value mappings * contained in this Map. */ public Set<Map.Entry<Object,Object>> entrySet() { return map.entrySet(); } /** * Compares the specified Attributes object with this Map for equality. * Returns true if the given object is also an instance of Attributes * and the two Attributes objects represent the same mappings. * * @param o the Object to be compared * @return true if the specified Object is equal to this Map */ public boolean equals(Object o) { return map.equals(o); } /** * Returns the hash code value for this Map. */ public int hashCode() { return map.hashCode(); } /** * Returns a copy of the Attributes, implemented as follows: * <pre> * public Object clone() { return new Attributes(this); } * </pre> * Since the attribute names and values are themselves immutable, * the Attributes returned can be safely modified without affecting * the original. */ public Object clone() { return new Attributes(this); } /* * Writes the current attributes to the specified data output stream. * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ void write(DataOutputStream os) throws IOException { Iterator<Map.Entry<Object, Object>> it = entrySet().iterator(); while (it.hasNext()) { Map.Entry<Object, Object> e = it.next(); StringBuffer buffer = new StringBuffer( ((Name)e.getKey()).toString()); buffer.append(": "); String value = (String)e.getValue(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append("\r\n"); Manifest.make72Safe(buffer); os.writeBytes(buffer.toString()); } os.writeBytes("\r\n"); } /* * Writes the current attributes to the specified data output stream, * make sure to write out the MANIFEST_VERSION or SIGNATURE_VERSION * attributes first. * * XXX Need to handle UTF8 values and break up lines longer than 72 bytes */ void writeMain(DataOutputStream out) throws IOException { // write out the *-Version header first, if it exists String vername = Name.MANIFEST_VERSION.toString(); String version = getValue(vername); if (version == null) { vername = Name.SIGNATURE_VERSION.toString(); version = getValue(vername); } if (version != null) { out.writeBytes(vername+": "+version+"\r\n"); } // write out all attributes except for the version // we wrote out earlier Iterator<Map.Entry<Object, Object>> it = entrySet().iterator(); while (it.hasNext()) { Map.Entry<Object, Object> e = it.next(); String name = ((Name)e.getKey()).toString(); if ((version != null) && ! (name.equalsIgnoreCase(vername))) { StringBuffer buffer = new StringBuffer(name); buffer.append(": "); String value = (String)e.getValue(); if (value != null) { byte[] vb = value.getBytes("UTF8"); value = new String(vb, 0, 0, vb.length); } buffer.append(value); buffer.append("\r\n"); Manifest.make72Safe(buffer); out.writeBytes(buffer.toString()); } } out.writeBytes("\r\n"); }
[ "public", "void", "putAll", "(", "Map", "<", "?", ",", "?", ">", "attr", ")", "{", "// ## javac bug?", "if", "(", "!", "Attributes", ".", "class", ".", "isInstance", "(", "attr", ")", ")", "throw", "new", "ClassCastException", "(", ")", ";", "for", "...
Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced. @param attr the Attributes to be stored in this map @exception ClassCastException if attr is not an Attributes
[ "Copies", "all", "of", "the", "attribute", "name", "-", "value", "mappings", "from", "the", "specified", "Attributes", "to", "this", "Map", ".", "Duplicate", "mappings", "will", "be", "replaced", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Attributes.java#L212-L366
34,080
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/ErrorUtil.java
ErrorUtil.fatalError
public static void fatalError(Throwable error, String path) { StringWriter msg = new StringWriter(); PrintWriter writer = new PrintWriter(msg); writer.println(String.format("internal error translating \"%s\"", path)); error.printStackTrace(writer); writer.flush(); error(msg.toString()); }
java
public static void fatalError(Throwable error, String path) { StringWriter msg = new StringWriter(); PrintWriter writer = new PrintWriter(msg); writer.println(String.format("internal error translating \"%s\"", path)); error.printStackTrace(writer); writer.flush(); error(msg.toString()); }
[ "public", "static", "void", "fatalError", "(", "Throwable", "error", ",", "String", "path", ")", "{", "StringWriter", "msg", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "msg", ")", ";", "writer", ".",...
Report that an internal error happened when translating a specific source.
[ "Report", "that", "an", "internal", "error", "happened", "when", "translating", "a", "specific", "source", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/ErrorUtil.java#L161-L168
34,081
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogRecord.java
LogRecord.defaultThreadID
private int defaultThreadID() { long tid = Thread.currentThread().getId(); if (tid < MIN_SEQUENTIAL_THREAD_ID) { return (int) tid; } else { Integer id = threadIds.get(); if (id == null) { id = nextThreadId.getAndIncrement(); threadIds.set(id); } return id; } }
java
private int defaultThreadID() { long tid = Thread.currentThread().getId(); if (tid < MIN_SEQUENTIAL_THREAD_ID) { return (int) tid; } else { Integer id = threadIds.get(); if (id == null) { id = nextThreadId.getAndIncrement(); threadIds.set(id); } return id; } }
[ "private", "int", "defaultThreadID", "(", ")", "{", "long", "tid", "=", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ";", "if", "(", "tid", "<", "MIN_SEQUENTIAL_THREAD_ID", ")", "{", "return", "(", "int", ")", "tid", ";", "}", "e...
Returns the default value for a new LogRecord's threadID.
[ "Returns", "the", "default", "value", "for", "a", "new", "LogRecord", "s", "threadID", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogRecord.java#L148-L160
34,082
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SearchIterator.java
SearchIterator.setBreakIterator
public void setBreakIterator(BreakIterator breakiter) { search_.setBreakIter(breakiter); if (search_.breakIter() != null) { // Create a clone of CharacterItearator, so it won't // affect the position currently held by search_.text() if (search_.text() != null) { search_.breakIter().setText((CharacterIterator)search_.text().clone()); } } }
java
public void setBreakIterator(BreakIterator breakiter) { search_.setBreakIter(breakiter); if (search_.breakIter() != null) { // Create a clone of CharacterItearator, so it won't // affect the position currently held by search_.text() if (search_.text() != null) { search_.breakIter().setText((CharacterIterator)search_.text().clone()); } } }
[ "public", "void", "setBreakIterator", "(", "BreakIterator", "breakiter", ")", "{", "search_", ".", "setBreakIter", "(", "breakiter", ")", ";", "if", "(", "search_", ".", "breakIter", "(", ")", "!=", "null", ")", "{", "// Create a clone of CharacterItearator, so it...
Set the BreakIterator that will be used to restrict the points at which matches are detected. @param breakiter A BreakIterator that will be used to restrict the points at which matches are detected. If a match is found, but the match's start or end index is not a boundary as determined by the {@link BreakIterator}, the match will be rejected and another will be searched for. If this parameter is <tt>null</tt>, no break detection is attempted. @see BreakIterator
[ "Set", "the", "BreakIterator", "that", "will", "be", "used", "to", "restrict", "the", "points", "at", "which", "matches", "are", "detected", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SearchIterator.java#L221-L230
34,083
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SearchIterator.java
SearchIterator.setTarget
public void setTarget(CharacterIterator text) { if (text == null || text.getEndIndex() == text.getIndex()) { throw new IllegalArgumentException("Illegal null or empty text"); } text.setIndex(text.getBeginIndex()); search_.setTarget(text); search_.matchedIndex_ = DONE; search_.setMatchedLength(0); search_.reset_ = true; search_.isForwardSearching_ = true; if (search_.breakIter() != null) { // Create a clone of CharacterItearator, so it won't // affect the position currently held by search_.text() search_.breakIter().setText((CharacterIterator)text.clone()); } if (search_.internalBreakIter_ != null) { search_.internalBreakIter_.setText((CharacterIterator)text.clone()); } }
java
public void setTarget(CharacterIterator text) { if (text == null || text.getEndIndex() == text.getIndex()) { throw new IllegalArgumentException("Illegal null or empty text"); } text.setIndex(text.getBeginIndex()); search_.setTarget(text); search_.matchedIndex_ = DONE; search_.setMatchedLength(0); search_.reset_ = true; search_.isForwardSearching_ = true; if (search_.breakIter() != null) { // Create a clone of CharacterItearator, so it won't // affect the position currently held by search_.text() search_.breakIter().setText((CharacterIterator)text.clone()); } if (search_.internalBreakIter_ != null) { search_.internalBreakIter_.setText((CharacterIterator)text.clone()); } }
[ "public", "void", "setTarget", "(", "CharacterIterator", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "getEndIndex", "(", ")", "==", "text", ".", "getIndex", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\...
Set the target text to be searched. Text iteration will then begin at the start of the text string. This method is useful if you want to reuse an iterator to search within a different body of text. @param text new text iterator to look for match, @exception IllegalArgumentException thrown when text is null or has 0 length @see #getTarget
[ "Set", "the", "target", "text", "to", "be", "searched", ".", "Text", "iteration", "will", "then", "begin", "at", "the", "start", "of", "the", "text", "string", ".", "This", "method", "is", "useful", "if", "you", "want", "to", "reuse", "an", "iterator", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SearchIterator.java#L242-L262
34,084
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SearchIterator.java
SearchIterator.reset
public void reset() { setMatchNotFound(); setIndex(search_.beginIndex()); search_.isOverlap_ = false; search_.isCanonicalMatch_ = false; search_.elementComparisonType_ = ElementComparisonType.STANDARD_ELEMENT_COMPARISON; search_.isForwardSearching_ = true; search_.reset_ = true; }
java
public void reset() { setMatchNotFound(); setIndex(search_.beginIndex()); search_.isOverlap_ = false; search_.isCanonicalMatch_ = false; search_.elementComparisonType_ = ElementComparisonType.STANDARD_ELEMENT_COMPARISON; search_.isForwardSearching_ = true; search_.reset_ = true; }
[ "public", "void", "reset", "(", ")", "{", "setMatchNotFound", "(", ")", ";", "setIndex", "(", "search_", ".", "beginIndex", "(", ")", ")", ";", "search_", ".", "isOverlap_", "=", "false", ";", "search_", ".", "isCanonicalMatch_", "=", "false", ";", "sear...
Resets the iteration. Search will begin at the start of the text string if a forward iteration is initiated before a backwards iteration. Otherwise if a backwards iteration is initiated before a forwards iteration, the search will begin at the end of the text string.
[ "Resets", "the", "iteration", ".", "Search", "will", "begin", "at", "the", "start", "of", "the", "text", "string", "if", "a", "forward", "iteration", "is", "initiated", "before", "a", "backwards", "iteration", ".", "Otherwise", "if", "a", "backwards", "itera...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SearchIterator.java#L499-L507
34,085
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateValidity.java
CertificateValidity.encode
public void encode(OutputStream out) throws IOException { // in cases where default constructor is used check for // null values if (notBefore == null || notAfter == null) { throw new IOException("CertAttrSet:CertificateValidity:" + " null values to encode.\n"); } DerOutputStream pair = new DerOutputStream(); if (notBefore.getTime() < YR_2050) { pair.putUTCTime(notBefore); } else pair.putGeneralizedTime(notBefore); if (notAfter.getTime() < YR_2050) { pair.putUTCTime(notAfter); } else { pair.putGeneralizedTime(notAfter); } DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.tag_Sequence, pair); out.write(seq.toByteArray()); }
java
public void encode(OutputStream out) throws IOException { // in cases where default constructor is used check for // null values if (notBefore == null || notAfter == null) { throw new IOException("CertAttrSet:CertificateValidity:" + " null values to encode.\n"); } DerOutputStream pair = new DerOutputStream(); if (notBefore.getTime() < YR_2050) { pair.putUTCTime(notBefore); } else pair.putGeneralizedTime(notBefore); if (notAfter.getTime() < YR_2050) { pair.putUTCTime(notAfter); } else { pair.putGeneralizedTime(notAfter); } DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.tag_Sequence, pair); out.write(seq.toByteArray()); }
[ "public", "void", "encode", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "// in cases where default constructor is used check for", "// null values", "if", "(", "notBefore", "==", "null", "||", "notAfter", "==", "null", ")", "{", "throw", "new", "I...
Encode the CertificateValidity period in DER form to the stream. @param out the OutputStream to marshal the contents to. @exception IOException on errors.
[ "Encode", "the", "CertificateValidity", "period", "in", "DER", "form", "to", "the", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateValidity.java#L147-L171
34,086
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetIterator.java
UnicodeSetIterator.reset
public void reset() { endRange = set.getRangeCount() - 1; range = 0; endElement = -1; nextElement = 0; if (endRange >= 0) { loadRange(range); } stringIterator = null; if (set.strings != null) { stringIterator = set.strings.iterator(); if (!stringIterator.hasNext()) { stringIterator = null; } } }
java
public void reset() { endRange = set.getRangeCount() - 1; range = 0; endElement = -1; nextElement = 0; if (endRange >= 0) { loadRange(range); } stringIterator = null; if (set.strings != null) { stringIterator = set.strings.iterator(); if (!stringIterator.hasNext()) { stringIterator = null; } } }
[ "public", "void", "reset", "(", ")", "{", "endRange", "=", "set", ".", "getRangeCount", "(", ")", "-", "1", ";", "range", "=", "0", ";", "endElement", "=", "-", "1", ";", "nextElement", "=", "0", ";", "if", "(", "endRange", ">=", "0", ")", "{", ...
Resets this iterator to the start of the set.
[ "Resets", "this", "iterator", "to", "the", "start", "of", "the", "set", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetIterator.java#L195-L210
34,087
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/JAXPExtensionsProvider.java
JAXPExtensionsProvider.functionAvailable
public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
java
public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
[ "public", "boolean", "functionAvailable", "(", "String", "ns", ",", "String", "funcName", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "try", "{", "if", "(", "funcName", "==", "null", ")", "{", "String", "fmsg", "...
Is the extension function available?
[ "Is", "the", "extension", "function", "available?" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/JAXPExtensionsProvider.java#L64-L86
34,088
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/JAXPExtensionsProvider.java
JAXPExtensionsProvider.elementAvailable
public boolean elementAvailable(String ns, String elemName) throws javax.xml.transform.TransformerException { return false; }
java
public boolean elementAvailable(String ns, String elemName) throws javax.xml.transform.TransformerException { return false; }
[ "public", "boolean", "elementAvailable", "(", "String", "ns", ",", "String", "elemName", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "false", ";", "}" ]
Is the extension element available?
[ "Is", "the", "extension", "element", "available?" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/JAXPExtensionsProvider.java#L92-L95
34,089
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarInputStream.java
JarInputStream.getNextEntry
public ZipEntry getNextEntry() throws IOException { JarEntry e; if (first == null) { e = (JarEntry)super.getNextEntry(); if (tryManifest) { e = checkManifest(e); tryManifest = false; } } else { e = first; if (first.getName().equalsIgnoreCase(INDEX_NAME)) tryManifest = true; first = null; } if (jv != null && e != null) { // At this point, we might have parsed all the meta-inf // entries and have nothing to verify. If we have // nothing to verify, get rid of the JarVerifier object. if (jv.nothingToVerify() == true) { jv = null; mev = null; } else { jv.beginEntry(e, mev); } } return e; }
java
public ZipEntry getNextEntry() throws IOException { JarEntry e; if (first == null) { e = (JarEntry)super.getNextEntry(); if (tryManifest) { e = checkManifest(e); tryManifest = false; } } else { e = first; if (first.getName().equalsIgnoreCase(INDEX_NAME)) tryManifest = true; first = null; } if (jv != null && e != null) { // At this point, we might have parsed all the meta-inf // entries and have nothing to verify. If we have // nothing to verify, get rid of the JarVerifier object. if (jv.nothingToVerify() == true) { jv = null; mev = null; } else { jv.beginEntry(e, mev); } } return e; }
[ "public", "ZipEntry", "getNextEntry", "(", ")", "throws", "IOException", "{", "JarEntry", "e", ";", "if", "(", "first", "==", "null", ")", "{", "e", "=", "(", "JarEntry", ")", "super", ".", "getNextEntry", "(", ")", ";", "if", "(", "tryManifest", ")", ...
Reads the next ZIP file entry and positions the stream at the beginning of the entry data. If verification has been enabled, any invalid signature detected while positioning the stream for the next entry will result in an exception. @exception ZipException if a ZIP file error has occurred @exception IOException if an I/O error has occurred @exception SecurityException if any of the jar file entries are incorrectly signed.
[ "Reads", "the", "next", "ZIP", "file", "entry", "and", "positions", "the", "stream", "at", "the", "beginning", "of", "the", "entry", "data", ".", "If", "verification", "has", "been", "enabled", "any", "invalid", "signature", "detected", "while", "positioning",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarInputStream.java#L144-L170
34,090
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CoderResult.java
CoderResult.throwException
public void throwException() throws BufferUnderflowException, BufferOverflowException, UnmappableCharacterException, MalformedInputException, CharacterCodingException { switch (this.type) { case TYPE_UNDERFLOW: throw new BufferUnderflowException(); case TYPE_OVERFLOW: throw new BufferOverflowException(); case TYPE_UNMAPPABLE_CHAR: throw new UnmappableCharacterException(this.length); case TYPE_MALFORMED_INPUT: throw new MalformedInputException(this.length); default: throw new CharacterCodingException(); } }
java
public void throwException() throws BufferUnderflowException, BufferOverflowException, UnmappableCharacterException, MalformedInputException, CharacterCodingException { switch (this.type) { case TYPE_UNDERFLOW: throw new BufferUnderflowException(); case TYPE_OVERFLOW: throw new BufferOverflowException(); case TYPE_UNMAPPABLE_CHAR: throw new UnmappableCharacterException(this.length); case TYPE_MALFORMED_INPUT: throw new MalformedInputException(this.length); default: throw new CharacterCodingException(); } }
[ "public", "void", "throwException", "(", ")", "throws", "BufferUnderflowException", ",", "BufferOverflowException", ",", "UnmappableCharacterException", ",", "MalformedInputException", ",", "CharacterCodingException", "{", "switch", "(", "this", ".", "type", ")", "{", "...
Throws an exception corresponding to this coder result. @throws BufferUnderflowException in case this is an underflow. @throws BufferOverflowException in case this is an overflow. @throws UnmappableCharacterException in case this is an unmappable-character error. @throws MalformedInputException in case this is a malformed-input error. @throws CharacterCodingException the default exception.
[ "Throws", "an", "exception", "corresponding", "to", "this", "coder", "result", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CoderResult.java#L233-L248
34,091
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/SparseBooleanArray.java
SparseBooleanArray.get
public boolean get(int key, boolean valueIfKeyNotFound) { int i = ContainerHelpers.binarySearch(mKeys, mSize, key); if (i < 0) { return valueIfKeyNotFound; } else { return mValues[i]; } }
java
public boolean get(int key, boolean valueIfKeyNotFound) { int i = ContainerHelpers.binarySearch(mKeys, mSize, key); if (i < 0) { return valueIfKeyNotFound; } else { return mValues[i]; } }
[ "public", "boolean", "get", "(", "int", "key", ",", "boolean", "valueIfKeyNotFound", ")", "{", "int", "i", "=", "ContainerHelpers", ".", "binarySearch", "(", "mKeys", ",", "mSize", ",", "key", ")", ";", "if", "(", "i", "<", "0", ")", "{", "return", "...
Gets the boolean mapped from the specified key, or the specified value if no such mapping has been made.
[ "Gets", "the", "boolean", "mapped", "from", "the", "specified", "key", "or", "the", "specified", "value", "if", "no", "such", "mapping", "has", "been", "made", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/SparseBooleanArray.java#L95-L103
34,092
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/InnerNodeImpl.java
InnerNodeImpl.normalize
@Override public final void normalize() { Node next; for (Node node = getFirstChild(); node != null; node = next) { next = node.getNextSibling(); node.normalize(); if (node.getNodeType() == Node.TEXT_NODE) { ((TextImpl) node).minimize(); } } }
java
@Override public final void normalize() { Node next; for (Node node = getFirstChild(); node != null; node = next) { next = node.getNextSibling(); node.normalize(); if (node.getNodeType() == Node.TEXT_NODE) { ((TextImpl) node).minimize(); } } }
[ "@", "Override", "public", "final", "void", "normalize", "(", ")", "{", "Node", "next", ";", "for", "(", "Node", "node", "=", "getFirstChild", "(", ")", ";", "node", "!=", "null", ";", "node", "=", "next", ")", "{", "next", "=", "node", ".", "getNe...
Normalize the text nodes within this subtree. Although named similarly, this method is unrelated to Document.normalize.
[ "Normalize", "the", "text", "nodes", "within", "this", "subtree", ".", "Although", "named", "similarly", "this", "method", "is", "unrelated", "to", "Document", ".", "normalize", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/InnerNodeImpl.java#L155-L166
34,093
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/BasicConstraintsExtension.java
BasicConstraintsExtension.encode
public void encode(OutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); if (extensionValue == null) { this.extensionId = PKIXExtensions.BasicConstraints_Id; if (ca) { critical = true; } else { critical = false; } encodeThis(); } super.encode(tmp); out.write(tmp.toByteArray()); }
java
public void encode(OutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); if (extensionValue == null) { this.extensionId = PKIXExtensions.BasicConstraints_Id; if (ca) { critical = true; } else { critical = false; } encodeThis(); } super.encode(tmp); out.write(tmp.toByteArray()); }
[ "public", "void", "encode", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "DerOutputStream", "tmp", "=", "new", "DerOutputStream", "(", ")", ";", "if", "(", "extensionValue", "==", "null", ")", "{", "this", ".", "extensionId", "=", "PKIXExte...
Encode this extension value to the output stream. @param out the DerOutputStream to encode the extension to.
[ "Encode", "this", "extension", "value", "to", "the", "output", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/BasicConstraintsExtension.java#L193-L207
34,094
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.addAttribute
public void addAttribute(Attribute attribute, Object value) { if (attribute == null) { throw new NullPointerException(); } int len = length(); if (len == 0) { throw new IllegalArgumentException("Can't add attribute to 0-length text"); } addAttributeImpl(attribute, value, 0, len); }
java
public void addAttribute(Attribute attribute, Object value) { if (attribute == null) { throw new NullPointerException(); } int len = length(); if (len == 0) { throw new IllegalArgumentException("Can't add attribute to 0-length text"); } addAttributeImpl(attribute, value, 0, len); }
[ "public", "void", "addAttribute", "(", "Attribute", "attribute", ",", "Object", "value", ")", "{", "if", "(", "attribute", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "int", "len", "=", "length", "(", ")", ";", "...
Adds an attribute to the entire string. @param attribute the attribute key @param value the value of the attribute; may be null @exception NullPointerException if <code>attribute</code> is null. @exception IllegalArgumentException if the AttributedString has length 0 (attributes cannot be applied to a 0-length range).
[ "Adds", "an", "attribute", "to", "the", "entire", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L316-L328
34,095
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.addAttribute
public void addAttribute(Attribute attribute, Object value, int beginIndex, int endIndex) { if (attribute == null) { throw new NullPointerException(); } if (beginIndex < 0 || endIndex > length() || beginIndex >= endIndex) { throw new IllegalArgumentException("Invalid substring range"); } addAttributeImpl(attribute, value, beginIndex, endIndex); }
java
public void addAttribute(Attribute attribute, Object value, int beginIndex, int endIndex) { if (attribute == null) { throw new NullPointerException(); } if (beginIndex < 0 || endIndex > length() || beginIndex >= endIndex) { throw new IllegalArgumentException("Invalid substring range"); } addAttributeImpl(attribute, value, beginIndex, endIndex); }
[ "public", "void", "addAttribute", "(", "Attribute", "attribute", ",", "Object", "value", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "if", "(", "attribute", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}",...
Adds an attribute to a subrange of the string. @param attribute the attribute key @param value The value of the attribute. May be null. @param beginIndex Index of the first character of the range. @param endIndex Index of the character following the last character of the range. @exception NullPointerException if <code>attribute</code> is null. @exception IllegalArgumentException if beginIndex is less then 0, endIndex is greater than the length of the string, or beginIndex and endIndex together don't define a non-empty subrange of the string.
[ "Adds", "an", "attribute", "to", "a", "subrange", "of", "the", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L341-L353
34,096
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.addAttributes
public void addAttributes(Map<? extends Attribute, ?> attributes, int beginIndex, int endIndex) { if (attributes == null) { throw new NullPointerException(); } if (beginIndex < 0 || endIndex > length() || beginIndex > endIndex) { throw new IllegalArgumentException("Invalid substring range"); } if (beginIndex == endIndex) { if (attributes.isEmpty()) return; throw new IllegalArgumentException("Can't add attribute to 0-length text"); } // make sure we have run attribute data vectors if (runCount == 0) { createRunAttributeDataVectors(); } // break up runs if necessary int beginRunIndex = ensureRunBreak(beginIndex); int endRunIndex = ensureRunBreak(endIndex); Iterator iterator = attributes.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); addAttributeRunData((Attribute) entry.getKey(), entry.getValue(), beginRunIndex, endRunIndex); } }
java
public void addAttributes(Map<? extends Attribute, ?> attributes, int beginIndex, int endIndex) { if (attributes == null) { throw new NullPointerException(); } if (beginIndex < 0 || endIndex > length() || beginIndex > endIndex) { throw new IllegalArgumentException("Invalid substring range"); } if (beginIndex == endIndex) { if (attributes.isEmpty()) return; throw new IllegalArgumentException("Can't add attribute to 0-length text"); } // make sure we have run attribute data vectors if (runCount == 0) { createRunAttributeDataVectors(); } // break up runs if necessary int beginRunIndex = ensureRunBreak(beginIndex); int endRunIndex = ensureRunBreak(endIndex); Iterator iterator = attributes.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); addAttributeRunData((Attribute) entry.getKey(), entry.getValue(), beginRunIndex, endRunIndex); } }
[ "public", "void", "addAttributes", "(", "Map", "<", "?", "extends", "Attribute", ",", "?", ">", "attributes", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "if", "(", "attributes", "==", "null", ")", "{", "throw", "new", "NullPointerException...
Adds a set of attributes to a subrange of the string. @param attributes The attributes to be added to the string. @param beginIndex Index of the first character of the range. @param endIndex Index of the character following the last character of the range. @exception NullPointerException if <code>attributes</code> is null. @exception IllegalArgumentException if beginIndex is less then 0, endIndex is greater than the length of the string, or beginIndex and endIndex together don't define a non-empty subrange of the string and the attributes parameter is not an empty Map.
[ "Adds", "a", "set", "of", "attributes", "to", "a", "subrange", "of", "the", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L368-L398
34,097
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.getIterator
public AttributedCharacterIterator getIterator(Attribute[] attributes, int beginIndex, int endIndex) { return new AttributedStringIterator(attributes, beginIndex, endIndex); }
java
public AttributedCharacterIterator getIterator(Attribute[] attributes, int beginIndex, int endIndex) { return new AttributedStringIterator(attributes, beginIndex, endIndex); }
[ "public", "AttributedCharacterIterator", "getIterator", "(", "Attribute", "[", "]", "attributes", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "return", "new", "AttributedStringIterator", "(", "attributes", ",", "beginIndex", ",", "endIndex", ")", "...
Creates an AttributedCharacterIterator instance that provides access to selected contents of this string. Information about attributes not listed in attributes that the implementor may have need not be made accessible through the iterator. If the list is null, all available attribute information should be made accessible. @param attributes a list of attributes that the client is interested in @param beginIndex the index of the first character @param endIndex the index of the character following the last character @return an iterator providing access to the text and its attributes @exception IllegalArgumentException if beginIndex is less then 0, endIndex is greater than the length of the string, or beginIndex is greater than endIndex.
[ "Creates", "an", "AttributedCharacterIterator", "instance", "that", "provides", "access", "to", "selected", "contents", "of", "this", "string", ".", "Information", "about", "attributes", "not", "listed", "in", "attributes", "that", "the", "implementor", "may", "have...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L582-L584
34,098
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.getAttributeCheckRange
private Object getAttributeCheckRange(Attribute attribute, int runIndex, int beginIndex, int endIndex) { Object value = getAttribute(attribute, runIndex); if (value instanceof Annotation) { // need to check whether the annotation's range extends outside the iterator's range if (beginIndex > 0) { int currIndex = runIndex; int runStart = runStarts[currIndex]; while (runStart >= beginIndex && valuesMatch(value, getAttribute(attribute, currIndex - 1))) { currIndex--; runStart = runStarts[currIndex]; } if (runStart < beginIndex) { // annotation's range starts before iterator's range return null; } } int textLength = length(); if (endIndex < textLength) { int currIndex = runIndex; int runLimit = (currIndex < runCount - 1) ? runStarts[currIndex + 1] : textLength; while (runLimit <= endIndex && valuesMatch(value, getAttribute(attribute, currIndex + 1))) { currIndex++; runLimit = (currIndex < runCount - 1) ? runStarts[currIndex + 1] : textLength; } if (runLimit > endIndex) { // annotation's range ends after iterator's range return null; } } // annotation's range is subrange of iterator's range, // so we can return the value } return value; }
java
private Object getAttributeCheckRange(Attribute attribute, int runIndex, int beginIndex, int endIndex) { Object value = getAttribute(attribute, runIndex); if (value instanceof Annotation) { // need to check whether the annotation's range extends outside the iterator's range if (beginIndex > 0) { int currIndex = runIndex; int runStart = runStarts[currIndex]; while (runStart >= beginIndex && valuesMatch(value, getAttribute(attribute, currIndex - 1))) { currIndex--; runStart = runStarts[currIndex]; } if (runStart < beginIndex) { // annotation's range starts before iterator's range return null; } } int textLength = length(); if (endIndex < textLength) { int currIndex = runIndex; int runLimit = (currIndex < runCount - 1) ? runStarts[currIndex + 1] : textLength; while (runLimit <= endIndex && valuesMatch(value, getAttribute(attribute, currIndex + 1))) { currIndex++; runLimit = (currIndex < runCount - 1) ? runStarts[currIndex + 1] : textLength; } if (runLimit > endIndex) { // annotation's range ends after iterator's range return null; } } // annotation's range is subrange of iterator's range, // so we can return the value } return value; }
[ "private", "Object", "getAttributeCheckRange", "(", "Attribute", "attribute", ",", "int", "runIndex", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "Object", "value", "=", "getAttribute", "(", "attribute", ",", "runIndex", ")", ";", "if", "(", ...
gets an attribute value, but returns an annotation only if it's range does not extend outside the range beginIndex..endIndex
[ "gets", "an", "attribute", "value", "but", "returns", "an", "annotation", "only", "if", "it", "s", "range", "does", "not", "extend", "outside", "the", "range", "beginIndex", "..", "endIndex" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L615-L650
34,099
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.attributeValuesMatch
private boolean attributeValuesMatch(Set attributes, int runIndex1, int runIndex2) { Iterator iterator = attributes.iterator(); while (iterator.hasNext()) { Attribute key = (Attribute) iterator.next(); if (!valuesMatch(getAttribute(key, runIndex1), getAttribute(key, runIndex2))) { return false; } } return true; }
java
private boolean attributeValuesMatch(Set attributes, int runIndex1, int runIndex2) { Iterator iterator = attributes.iterator(); while (iterator.hasNext()) { Attribute key = (Attribute) iterator.next(); if (!valuesMatch(getAttribute(key, runIndex1), getAttribute(key, runIndex2))) { return false; } } return true; }
[ "private", "boolean", "attributeValuesMatch", "(", "Set", "attributes", ",", "int", "runIndex1", ",", "int", "runIndex2", ")", "{", "Iterator", "iterator", "=", "attributes", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")",...
returns whether all specified attributes have equal values in the runs with the given indices
[ "returns", "whether", "all", "specified", "attributes", "have", "equal", "values", "in", "the", "runs", "with", "the", "given", "indices" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L653-L662