code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public static @NonNull <K, V> Map<K, V> emptyIfNull(@Nullable Map<K, V> cur) {
return cur == null ? Collections.emptyMap() : cur;
} |
Returns the given map, or an immutable empty map if the provided map is null
This can be used to guarantee null-safety without paying the price of extra allocations
@see Collections#emptyMap
| CollectionUtils::emptyIfNull | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static int size(@Nullable Collection<?> cur) {
return cur != null ? cur.size() : 0;
} |
Returns the size of the given collection, or 0 if null
| CollectionUtils::size | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static int size(@Nullable Map<?, ?> cur) {
return cur != null ? cur.size() : 0;
} |
Returns the size of the given map, or 0 if null
| CollectionUtils::size | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static boolean isEmpty(@Nullable Collection<?> cur) {
return size(cur) == 0;
} |
Returns whether the given collection {@link Collection#isEmpty is empty} or {@code null}
| CollectionUtils::isEmpty | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static boolean isEmpty(@Nullable Map<?, ?> cur) {
return size(cur) == 0;
} |
Returns whether the given map {@link Map#isEmpty is empty} or {@code null}
| CollectionUtils::isEmpty | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> filter(@Nullable List<?> list, Class<T> c) {
if (isEmpty(list)) return Collections.emptyList();
ArrayList<T> result = null;
for (int i = 0; i < list.size(); i++) {
final Object item = list.get(i);
if (c.isInstance(item)) {
result = ArrayUtils.add(result, (T) item);
}
}
return emptyIfNull(result);
} |
Returns the elements of the given list that are of type {@code c}
| CollectionUtils::filter | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> boolean any(@Nullable List<T> items,
java.util.function.Predicate<T> predicate) {
return find(items, predicate) != null;
} |
Returns whether there exists at least one element in the list for which
condition {@code predicate} is true
| CollectionUtils::any | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> boolean any(@Nullable Set<T> items,
java.util.function.Predicate<T> predicate) {
return find(items, predicate) != null;
} |
Returns whether there exists at least one element in the set for which
condition {@code predicate} is true
| CollectionUtils::any | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T find(@Nullable List<T> items,
java.util.function.Predicate<T> predicate) {
if (isEmpty(items)) return null;
for (int i = 0; i < items.size(); i++) {
final T item = items.get(i);
if (predicate.test(item)) return item;
}
return null;
} |
Returns the first element from the list for which
condition {@code predicate} is true, or null if there is no such element
| CollectionUtils::find | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T find(@Nullable Set<T> cur,
java.util.function.Predicate<T> predicate) {
if (cur == null || predicate == null) return null;
int size = cur.size();
if (size == 0) return null;
try {
if (cur instanceof ArraySet) {
ArraySet<T> arraySet = (ArraySet<T>) cur;
for (int i = 0; i < size; i++) {
T item = arraySet.valueAt(i);
if (predicate.test(item)) {
return item;
}
}
} else {
for (T t : cur) {
if (predicate.test(t)) {
return t;
}
}
}
} catch (Exception e) {
throw ExceptionUtils.propagate(e);
}
return null;
} |
Returns the first element from the set for which
condition {@code predicate} is true, or null if there is no such element
| CollectionUtils::find | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> add(@Nullable List<T> cur, T val) {
if (cur == null || cur == Collections.emptyList()) {
cur = new ArrayList<>();
}
cur.add(val);
return cur;
} |
Similar to {@link List#add}, but with support for list values of {@code null} and
{@link Collections#emptyList}
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> add(@Nullable List<T> cur, int index, T val) {
if (cur == null || cur == Collections.emptyList()) {
cur = new ArrayList<>();
}
cur.add(index, val);
return cur;
} |
Similar to {@link List#add(int, Object)}, but with support for list values of {@code null}
and {@link Collections#emptyList}
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> addAll(@Nullable Set<T> cur, @Nullable Collection<T> val) {
if (isEmpty(val)) {
return cur != null ? cur : emptySet();
}
if (cur == null || cur == emptySet()) {
cur = new ArraySet<>();
}
cur.addAll(val);
return cur;
} |
Similar to {@link Set#addAll(Collection)}}, but with support for list values of {@code null}
and {@link Collections#emptySet}
| CollectionUtils::addAll | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> add(@Nullable Set<T> cur, T val) {
if (cur == null || cur == emptySet()) {
cur = new ArraySet<>();
}
cur.add(val);
return cur;
} |
@see #add(List, Object)
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <K, V> Map<K, V> add(@Nullable Map<K, V> map, K key, V value) {
if (map == null || map == Collections.emptyMap()) {
map = new ArrayMap<>();
}
map.put(key, value);
return map;
} |
@see #add(List, Object)
| CollectionUtils::add | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> remove(@Nullable List<T> cur, T val) {
if (isEmpty(cur)) {
return emptyIfNull(cur);
}
cur.remove(val);
return cur;
} |
Similar to {@link List#remove}, but with support for list values of {@code null} and
{@link Collections#emptyList}
| CollectionUtils::remove | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> remove(@Nullable Set<T> cur, T val) {
if (isEmpty(cur)) {
return emptyIfNull(cur);
}
cur.remove(val);
return cur;
} |
@see #remove(List, Object)
| CollectionUtils::remove | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> copyOf(@Nullable List<T> cur) {
return isEmpty(cur) ? Collections.emptyList() : new ArrayList<>(cur);
} |
@return a list that will not be affected by mutations to the given original list.
| CollectionUtils::copyOf | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> copyOf(@Nullable Set<T> cur) {
return isEmpty(cur) ? emptySet() : new ArraySet<>(cur);
} |
@return a list that will not be affected by mutations to the given original list.
| CollectionUtils::copyOf | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> Set<T> toSet(@Nullable Collection<T> cur) {
return isEmpty(cur) ? emptySet() : new ArraySet<>(cur);
} |
@return a {@link Set} representing the given collection.
| CollectionUtils::toSet | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <T> void forEach(@Nullable Set<T> cur, @Nullable ThrowingConsumer<T> action) {
if (cur == null || action == null) return;
int size = cur.size();
if (size == 0) return;
try {
if (cur instanceof ArraySet) {
ArraySet<T> arraySet = (ArraySet<T>) cur;
for (int i = 0; i < size; i++) {
action.acceptOrThrow(arraySet.valueAt(i));
}
} else {
for (T t : cur) {
action.acceptOrThrow(t);
}
}
} catch (Exception e) {
throw ExceptionUtils.propagate(e);
}
} |
Applies {@code action} to each element in {@code cur}
This avoids creating an iterator if the given set is an {@link ArraySet}
| CollectionUtils::forEach | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static <K, V> void forEach(@Nullable Map<K, V> cur, @Nullable BiConsumer<K, V> action) {
if (cur == null || action == null) {
return;
}
int size = cur.size();
if (size == 0) {
return;
}
if (cur instanceof ArrayMap) {
ArrayMap<K, V> arrayMap = (ArrayMap<K, V>) cur;
for (int i = 0; i < size; i++) {
action.accept(arrayMap.keyAt(i), arrayMap.valueAt(i));
}
} else {
for (K key : cur.keySet()) {
action.accept(key, cur.get(key));
}
}
} |
Applies {@code action} to each element in {@code cur}
This avoids creating an iterator if the given map is an {@link ArrayMap}
For non-{@link ArrayMap}s it avoids creating {@link Map.Entry} instances
| CollectionUtils::forEach | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T firstOrNull(@Nullable List<T> cur) {
return isEmpty(cur) ? null : cur.get(0);
} |
@return the first element if not empty/null, null otherwise
| CollectionUtils::firstOrNull | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @Nullable <T> T firstOrNull(@Nullable Collection<T> cur) {
return isEmpty(cur) ? null : cur.iterator().next();
} |
@return the first element if not empty/null, null otherwise
| CollectionUtils::firstOrNull | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public static @NonNull <T> List<T> singletonOrEmpty(@Nullable T item) {
return item == null ? Collections.emptyList() : Collections.singletonList(item);
} |
@return list of single given element if it's not null, empty list otherwise
| CollectionUtils::singletonOrEmpty | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/util/CollectionUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/util/CollectionUtils.java | MIT |
public BackupStreamEncrypter(
InputStream data,
int minChunkSizeBytes,
int maxChunkSizeBytes,
int averageChunkSizeBytes) {
this.mData = data;
this.mMinChunkSizeBytes = minChunkSizeBytes;
this.mMaxChunkSizeBytes = maxChunkSizeBytes;
this.mAverageChunkSizeBytes = averageChunkSizeBytes;
} |
A new instance over the given distribution of chunk sizes.
@param data The data to be backed up.
@param minChunkSizeBytes The minimum chunk size. No chunk will be smaller than this.
@param maxChunkSizeBytes The maximum chunk size. No chunk will be larger than this.
@param averageChunkSizeBytes The average chunk size. The mean size of chunks will be roughly
this (with a few tens of bytes of overhead for the initialization vector and message
authentication code).
| BackupStreamEncrypter::BackupStreamEncrypter | java | Reginer/aosp-android-jar | android-33/src/com/android/server/backup/encryption/tasks/BackupStreamEncrypter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/backup/encryption/tasks/BackupStreamEncrypter.java | MIT |
public boolean hasSameSlicing(@NonNull NetworkStatsExt other) {
return Arrays.equals(transports, other.transports) && slicedByFgbg == other.slicedByFgbg
&& slicedByTag == other.slicedByTag && slicedByMetered == other.slicedByMetered
&& ratType == other.ratType && Objects.equals(subInfo, other.subInfo)
&& oemManaged == other.oemManaged && isTypeProxy == other.isTypeProxy;
} |
A helper function to compare if all fields except NetworkStats are the same.
| NetworkStatsExt::hasSameSlicing | java | Reginer/aosp-android-jar | android-35/src/com/android/server/stats/pull/netstats/NetworkStatsExt.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/stats/pull/netstats/NetworkStatsExt.java | MIT |
public static String toJson(@JSONVerbosityLevel int verbosityLevel) {
return StatisticsRecorderAndroidJni.get().toJson(verbosityLevel);
} |
@param verbosityLevel controls the information that should be included when dumping each of
the histogram.
@return All the registered histograms as JSON text.
| StatisticsRecorderAndroid::toJson | java | Reginer/aosp-android-jar | android-34/src/org/chromium/base/metrics/StatisticsRecorderAndroid.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/chromium/base/metrics/StatisticsRecorderAndroid.java | MIT |
public int getSlotIndex() {
return mSlotIndex;
} |
Returns an identifier for the source of this suggestion.
<p>See {@link TelephonyTimeSuggestion} for more information about {@code slotIndex}.
| TelephonyTimeSuggestion::getSlotIndex | java | Reginer/aosp-android-jar | android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | MIT |
public void addDebugInfo(@NonNull String debugInfo) {
if (mDebugInfo == null) {
mDebugInfo = new ArrayList<>();
}
mDebugInfo.add(debugInfo);
} |
Associates information with the instance that can be useful for debugging / logging.
<p>See {@link TelephonyTimeSuggestion} for more information about {@code debugInfo}.
| TelephonyTimeSuggestion::addDebugInfo | java | Reginer/aosp-android-jar | android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | MIT |
public void addDebugInfo(@NonNull List<String> debugInfo) {
if (mDebugInfo == null) {
mDebugInfo = new ArrayList<>(debugInfo.size());
}
mDebugInfo.addAll(debugInfo);
} |
Associates information with the instance that can be useful for debugging / logging.
<p>See {@link TelephonyTimeSuggestion} for more information about {@code debugInfo}.
| TelephonyTimeSuggestion::addDebugInfo | java | Reginer/aosp-android-jar | android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | MIT |
public Builder(int slotIndex) {
mSlotIndex = slotIndex;
} |
Creates a builder with the specified {@code slotIndex}.
<p>See {@link TelephonyTimeSuggestion} for more information about {@code slotIndex}.
| Builder::Builder | java | Reginer/aosp-android-jar | android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/app/timedetector/TelephonyTimeSuggestion.java | MIT |
public BitmapDrawable(Resources res, Bitmap bitmap) {
init(new BitmapState(bitmap), res);
} |
Create drawable from a bitmap, setting initial target density based on
the display metrics of the resources.
| BitmapDrawable::BitmapDrawable | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public final Paint getPaint() {
return mBitmapState.mPaint;
} |
Returns the paint used to render this drawable.
| BitmapDrawable::getPaint | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public final Bitmap getBitmap() {
return mBitmapState.mBitmap;
} |
Returns the bitmap used by this drawable to render. May be null.
| BitmapDrawable::getBitmap | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setBitmap(@Nullable Bitmap bitmap) {
if (mBitmapState.mBitmap != bitmap) {
mBitmapState.mBitmap = bitmap;
computeBitmapSize();
invalidateSelf();
}
} |
Switch to a new Bitmap object.
| BitmapDrawable::setBitmap | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setTargetDensity(Canvas canvas) {
setTargetDensity(canvas.getDensity());
} |
Set the density scale at which this drawable will be rendered. This
method assumes the drawable will be rendered at the same density as the
specified canvas.
@param canvas The Canvas from which the density scale must be obtained.
@see android.graphics.Bitmap#setDensity(int)
@see android.graphics.Bitmap#getDensity()
| BitmapDrawable::setTargetDensity | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setTargetDensity(DisplayMetrics metrics) {
setTargetDensity(metrics.densityDpi);
} |
Set the density scale at which this drawable will be rendered.
@param metrics The DisplayMetrics indicating the density scale for this drawable.
@see android.graphics.Bitmap#setDensity(int)
@see android.graphics.Bitmap#getDensity()
| BitmapDrawable::setTargetDensity | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setTargetDensity(int density) {
if (mTargetDensity != density) {
mTargetDensity = density == 0 ? DisplayMetrics.DENSITY_DEFAULT : density;
if (mBitmapState.mBitmap != null) {
computeBitmapSize();
}
invalidateSelf();
}
} |
Set the density at which this drawable will be rendered.
@param density The density scale for this drawable.
@see android.graphics.Bitmap#setDensity(int)
@see android.graphics.Bitmap#getDensity()
| BitmapDrawable::setTargetDensity | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public int getGravity() {
return mBitmapState.mGravity;
} | Get the gravity used to position/stretch the bitmap within its bounds.
See android.view.Gravity
@return the gravity applied to the bitmap
| BitmapDrawable::getGravity | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setGravity(int gravity) {
if (mBitmapState.mGravity != gravity) {
mBitmapState.mGravity = gravity;
mDstRectAndInsetsDirty = true;
invalidateSelf();
}
} | Set the gravity used to position/stretch the bitmap within its bounds.
See android.view.Gravity
@param gravity the gravity
| BitmapDrawable::setGravity | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setMipMap(boolean mipMap) {
if (mBitmapState.mBitmap != null) {
mBitmapState.mBitmap.setHasMipMap(mipMap);
invalidateSelf();
}
} |
Enables or disables the mipmap hint for this drawable's bitmap.
See {@link Bitmap#setHasMipMap(boolean)} for more information.
If the bitmap is null calling this method has no effect.
@param mipMap True if the bitmap should use mipmaps, false otherwise.
@see #hasMipMap()
| BitmapDrawable::setMipMap | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public boolean hasMipMap() {
return mBitmapState.mBitmap != null && mBitmapState.mBitmap.hasMipMap();
} |
Indicates whether the mipmap hint is enabled on this drawable's bitmap.
@return True if the mipmap hint is set, false otherwise. If the bitmap
is null, this method always returns false.
@see #setMipMap(boolean)
@attr ref android.R.styleable#BitmapDrawable_mipMap
| BitmapDrawable::hasMipMap | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setAntiAlias(boolean aa) {
mBitmapState.mPaint.setAntiAlias(aa);
invalidateSelf();
} |
Enables or disables anti-aliasing for this drawable. Anti-aliasing affects
the edges of the bitmap only so it applies only when the drawable is rotated.
@param aa True if the bitmap should be anti-aliased, false otherwise.
@see #hasAntiAlias()
| BitmapDrawable::setAntiAlias | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public boolean hasAntiAlias() {
return mBitmapState.mPaint.isAntiAlias();
} |
Indicates whether anti-aliasing is enabled for this drawable.
@return True if anti-aliasing is enabled, false otherwise.
@see #setAntiAlias(boolean)
| BitmapDrawable::hasAntiAlias | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public Shader.TileMode getTileModeX() {
return mBitmapState.mTileModeX;
} |
Indicates the repeat behavior of this drawable on the X axis.
@return {@link android.graphics.Shader.TileMode#CLAMP} if the bitmap does not repeat,
{@link android.graphics.Shader.TileMode#REPEAT} or
{@link android.graphics.Shader.TileMode#MIRROR} otherwise.
| BitmapDrawable::getTileModeX | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public Shader.TileMode getTileModeY() {
return mBitmapState.mTileModeY;
} |
Indicates the repeat behavior of this drawable on the Y axis.
@return {@link android.graphics.Shader.TileMode#CLAMP} if the bitmap does not repeat,
{@link android.graphics.Shader.TileMode#REPEAT} or
{@link android.graphics.Shader.TileMode#MIRROR} otherwise.
| BitmapDrawable::getTileModeY | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setTileModeX(Shader.TileMode mode) {
setTileModeXY(mode, mBitmapState.mTileModeY);
} |
Sets the repeat behavior of this drawable on the X axis. By default, the drawable
does not repeat its bitmap. Using {@link android.graphics.Shader.TileMode#REPEAT} or
{@link android.graphics.Shader.TileMode#MIRROR} the bitmap can be repeated (or tiled)
if the bitmap is smaller than this drawable.
@param mode The repeat mode for this drawable.
@see #setTileModeY(android.graphics.Shader.TileMode)
@see #setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode)
@attr ref android.R.styleable#BitmapDrawable_tileModeX
| BitmapDrawable::setTileModeX | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public final void setTileModeY(Shader.TileMode mode) {
setTileModeXY(mBitmapState.mTileModeX, mode);
} |
Sets the repeat behavior of this drawable on the Y axis. By default, the drawable
does not repeat its bitmap. Using {@link android.graphics.Shader.TileMode#REPEAT} or
{@link android.graphics.Shader.TileMode#MIRROR} the bitmap can be repeated (or tiled)
if the bitmap is smaller than this drawable.
@param mode The repeat mode for this drawable.
@see #setTileModeX(android.graphics.Shader.TileMode)
@see #setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode)
@attr ref android.R.styleable#BitmapDrawable_tileModeY
| BitmapDrawable::setTileModeY | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void setTileModeXY(Shader.TileMode xmode, Shader.TileMode ymode) {
final BitmapState state = mBitmapState;
if (state.mTileModeX != xmode || state.mTileModeY != ymode) {
state.mTileModeX = xmode;
state.mTileModeY = ymode;
state.mRebuildShader = true;
mDstRectAndInsetsDirty = true;
invalidateSelf();
}
} |
Sets the repeat behavior of this drawable on both axis. By default, the drawable
does not repeat its bitmap. Using {@link android.graphics.Shader.TileMode#REPEAT} or
{@link android.graphics.Shader.TileMode#MIRROR} the bitmap can be repeated (or tiled)
if the bitmap is smaller than this drawable.
@param xmode The X repeat mode for this drawable.
@param ymode The Y repeat mode for this drawable.
@see #setTileModeX(android.graphics.Shader.TileMode)
@see #setTileModeY(android.graphics.Shader.TileMode)
| BitmapDrawable::setTileModeXY | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
private void updateShaderMatrix(@NonNull Bitmap bitmap, @NonNull Paint paint,
@NonNull Shader shader, boolean needMirroring) {
final int sourceDensity = bitmap.getDensity();
final int targetDensity = mTargetDensity;
final boolean needScaling = sourceDensity != 0 && sourceDensity != targetDensity;
if (needScaling || needMirroring) {
final Matrix matrix = getOrCreateMirrorMatrix();
matrix.reset();
if (needMirroring) {
final int dx = mDstRect.right - mDstRect.left;
matrix.setTranslate(dx, 0);
matrix.setScale(-1, 1);
}
if (needScaling) {
final float densityScale = targetDensity / (float) sourceDensity;
matrix.postScale(densityScale, densityScale);
}
shader.setLocalMatrix(matrix);
} else {
mMirrorMatrix = null;
shader.setLocalMatrix(Matrix.IDENTITY_MATRIX);
}
paint.setShader(shader);
} |
Updates the {@code paint}'s shader matrix to be consistent with the
destination size and layout direction.
@param bitmap the bitmap to be drawn
@param paint the paint used to draw the bitmap
@param shader the shader to set on the paint
@param needMirroring whether the bitmap should be mirrored
| BitmapDrawable::updateShaderMatrix | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public void clearMutated() {
super.clearMutated();
mMutated = false;
} |
@hide
| BitmapDrawable::clearMutated | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
private void verifyRequiredAttributes(TypedArray a) throws XmlPullParserException {
// If we're not waiting on a theme, verify required attributes.
final BitmapState state = mBitmapState;
if (state.mBitmap == null && (state.mThemeAttrs == null
|| state.mThemeAttrs[R.styleable.BitmapDrawable_src] == 0)) {
throw new XmlPullParserException(a.getPositionDescription() +
": <bitmap> requires a valid 'src' attribute");
}
} |
Ensures all required attributes are set.
@throws XmlPullParserException if any required attributes are missing
| BitmapDrawable::verifyRequiredAttributes | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
private void updateStateFromTypedArray(TypedArray a, int srcDensityOverride)
throws XmlPullParserException {
final Resources r = a.getResources();
final BitmapState state = mBitmapState;
// Account for any configuration changes.
state.mChangingConfigurations |= a.getChangingConfigurations();
// Extract the theme attributes, if any.
state.mThemeAttrs = a.extractThemeAttrs();
state.mSrcDensityOverride = srcDensityOverride;
state.mTargetDensity = Drawable.resolveDensity(r, 0);
final int srcResId = a.getResourceId(R.styleable.BitmapDrawable_src, 0);
if (srcResId != 0) {
final TypedValue value = new TypedValue();
r.getValueForDensity(srcResId, srcDensityOverride, value, true);
// Pretend the requested density is actually the display density. If
// the drawable returned is not the requested density, then force it
// to be scaled later by dividing its density by the ratio of
// requested density to actual device density. Drawables that have
// undefined density or no density don't need to be handled here.
if (srcDensityOverride > 0 && value.density > 0
&& value.density != TypedValue.DENSITY_NONE) {
if (value.density == srcDensityOverride) {
value.density = r.getDisplayMetrics().densityDpi;
} else {
value.density =
(value.density * r.getDisplayMetrics().densityDpi) / srcDensityOverride;
}
}
int density = Bitmap.DENSITY_NONE;
if (value.density == TypedValue.DENSITY_DEFAULT) {
density = DisplayMetrics.DENSITY_DEFAULT;
} else if (value.density != TypedValue.DENSITY_NONE) {
density = value.density;
}
Bitmap bitmap = null;
try (InputStream is = r.openRawResource(srcResId, value)) {
ImageDecoder.Source source = ImageDecoder.createSource(r, is, density);
bitmap = ImageDecoder.decodeBitmap(source, (decoder, info, src) -> {
decoder.setAllocator(ImageDecoder.ALLOCATOR_SOFTWARE);
});
} catch (Exception e) {
// Do nothing and pick up the error below.
}
if (bitmap == null) {
throw new XmlPullParserException(a.getPositionDescription() +
": <bitmap> requires a valid 'src' attribute");
}
state.mBitmap = bitmap;
}
final boolean defMipMap = state.mBitmap != null ? state.mBitmap.hasMipMap() : false;
setMipMap(a.getBoolean(R.styleable.BitmapDrawable_mipMap, defMipMap));
state.mAutoMirrored = a.getBoolean(
R.styleable.BitmapDrawable_autoMirrored, state.mAutoMirrored);
state.mBaseAlpha = a.getFloat(R.styleable.BitmapDrawable_alpha, state.mBaseAlpha);
final int tintMode = a.getInt(R.styleable.BitmapDrawable_tintMode, -1);
if (tintMode != -1) {
state.mBlendMode = Drawable.parseBlendMode(tintMode, BlendMode.SRC_IN);
}
final ColorStateList tint = a.getColorStateList(R.styleable.BitmapDrawable_tint);
if (tint != null) {
state.mTint = tint;
}
final Paint paint = mBitmapState.mPaint;
paint.setAntiAlias(a.getBoolean(
R.styleable.BitmapDrawable_antialias, paint.isAntiAlias()));
paint.setFilterBitmap(a.getBoolean(
R.styleable.BitmapDrawable_filter, paint.isFilterBitmap()));
paint.setDither(a.getBoolean(R.styleable.BitmapDrawable_dither, paint.isDither()));
setGravity(a.getInt(R.styleable.BitmapDrawable_gravity, state.mGravity));
final int tileMode = a.getInt(R.styleable.BitmapDrawable_tileMode, TILE_MODE_UNDEFINED);
if (tileMode != TILE_MODE_UNDEFINED) {
final Shader.TileMode mode = parseTileMode(tileMode);
setTileModeXY(mode, mode);
}
final int tileModeX = a.getInt(R.styleable.BitmapDrawable_tileModeX, TILE_MODE_UNDEFINED);
if (tileModeX != TILE_MODE_UNDEFINED) {
setTileModeX(parseTileMode(tileModeX));
}
final int tileModeY = a.getInt(R.styleable.BitmapDrawable_tileModeY, TILE_MODE_UNDEFINED);
if (tileModeY != TILE_MODE_UNDEFINED) {
setTileModeY(parseTileMode(tileModeY));
}
} |
Updates the constant state from the values in the typed array.
| BitmapDrawable::updateStateFromTypedArray | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
private void init(BitmapState state, Resources res) {
mBitmapState = state;
updateLocalState(res);
if (mBitmapState != null && res != null) {
mBitmapState.mTargetDensity = mTargetDensity;
}
} |
The one helper to rule them all. This is called by all public & private
constructors to set the state and initialize local properties.
| BitmapState::init | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
private void updateLocalState(Resources res) {
mTargetDensity = resolveDensity(res, mBitmapState.mTargetDensity);
mBlendModeFilter = updateBlendModeFilter(mBlendModeFilter, mBitmapState.mTint,
mBitmapState.mBlendMode);
computeBitmapSize();
} |
Initializes local dynamic properties from state. This should be called
after significant state changes, e.g. from the One True Constructor and
after inflating or applying a theme.
| BitmapState::updateLocalState | java | Reginer/aosp-android-jar | android-33/src/android/graphics/drawable/BitmapDrawable.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/graphics/drawable/BitmapDrawable.java | MIT |
public int describeContents() {
return 0;
} |
A class representing Wi-Fi Protected Setup
{@see android.net.wifi.p2p.WifiP2pConfig}
public class WpsInfo implements Parcelable {
/** Push button configuration
public static final int PBC = 0;
/** Display pin method configuration - pin is generated and displayed on device
public static final int DISPLAY = 1;
/** Keypad pin method configuration - pin is entered on device
public static final int KEYPAD = 2;
/** Label pin method configuration - pin is labelled on device
public static final int LABEL = 3;
/** Invalid configuration
public static final int INVALID = 4;
/** Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details
public int setup;
/** Passed with pin method KEYPAD
public String BSSID;
/** Passed with pin method configuration
public String pin;
public WpsInfo() {
setup = INVALID;
BSSID = null;
pin = null;
}
public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append(" setup: ").append(setup);
sbuf.append('\n');
sbuf.append(" BSSID: ").append(BSSID);
sbuf.append('\n');
sbuf.append(" pin: ").append(pin);
sbuf.append('\n');
return sbuf.toString();
}
/** Implement the Parcelable interface | WpsInfo::describeContents | java | Reginer/aosp-android-jar | android-34/src/android/net/wifi/WpsInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/wifi/WpsInfo.java | MIT |
public WpsInfo(WpsInfo source) {
if (source != null) {
setup = source.setup;
BSSID = source.BSSID;
pin = source.pin;
}
} |
A class representing Wi-Fi Protected Setup
{@see android.net.wifi.p2p.WifiP2pConfig}
public class WpsInfo implements Parcelable {
/** Push button configuration
public static final int PBC = 0;
/** Display pin method configuration - pin is generated and displayed on device
public static final int DISPLAY = 1;
/** Keypad pin method configuration - pin is entered on device
public static final int KEYPAD = 2;
/** Label pin method configuration - pin is labelled on device
public static final int LABEL = 3;
/** Invalid configuration
public static final int INVALID = 4;
/** Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details
public int setup;
/** Passed with pin method KEYPAD
public String BSSID;
/** Passed with pin method configuration
public String pin;
public WpsInfo() {
setup = INVALID;
BSSID = null;
pin = null;
}
public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append(" setup: ").append(setup);
sbuf.append('\n');
sbuf.append(" BSSID: ").append(BSSID);
sbuf.append('\n');
sbuf.append(" pin: ").append(pin);
sbuf.append('\n');
return sbuf.toString();
}
/** Implement the Parcelable interface
public int describeContents() {
return 0;
}
/* Copy constructor | WpsInfo::WpsInfo | java | Reginer/aosp-android-jar | android-34/src/android/net/wifi/WpsInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/wifi/WpsInfo.java | MIT |
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(setup);
dest.writeString(BSSID);
dest.writeString(pin);
} |
A class representing Wi-Fi Protected Setup
{@see android.net.wifi.p2p.WifiP2pConfig}
public class WpsInfo implements Parcelable {
/** Push button configuration
public static final int PBC = 0;
/** Display pin method configuration - pin is generated and displayed on device
public static final int DISPLAY = 1;
/** Keypad pin method configuration - pin is entered on device
public static final int KEYPAD = 2;
/** Label pin method configuration - pin is labelled on device
public static final int LABEL = 3;
/** Invalid configuration
public static final int INVALID = 4;
/** Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details
public int setup;
/** Passed with pin method KEYPAD
public String BSSID;
/** Passed with pin method configuration
public String pin;
public WpsInfo() {
setup = INVALID;
BSSID = null;
pin = null;
}
public String toString() {
StringBuffer sbuf = new StringBuffer();
sbuf.append(" setup: ").append(setup);
sbuf.append('\n');
sbuf.append(" BSSID: ").append(BSSID);
sbuf.append('\n');
sbuf.append(" pin: ").append(pin);
sbuf.append('\n');
return sbuf.toString();
}
/** Implement the Parcelable interface
public int describeContents() {
return 0;
}
/* Copy constructor
public WpsInfo(WpsInfo source) {
if (source != null) {
setup = source.setup;
BSSID = source.BSSID;
pin = source.pin;
}
}
/** Implement the Parcelable interface | WpsInfo::writeToParcel | java | Reginer/aosp-android-jar | android-34/src/android/net/wifi/WpsInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/wifi/WpsInfo.java | MIT |
public FileSystemException(String file) {
super((String)null);
this.file = file;
this.other = null;
} |
Constructs an instance of this class. This constructor should be used
when an operation involving one file fails and there isn't any additional
information to explain the reason.
@param file
a string identifying the file or {@code null} if not known.
| FileSystemException::FileSystemException | java | Reginer/aosp-android-jar | android-32/src/java/nio/file/FileSystemException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/file/FileSystemException.java | MIT |
public FileSystemException(String file, String other, String reason) {
super(reason);
this.file = file;
this.other = other;
} |
Constructs an instance of this class. This constructor should be used
when an operation involving two files fails, or there is additional
information to explain the reason.
@param file
a string identifying the file or {@code null} if not known.
@param other
a string identifying the other file or {@code null} if there
isn't another file or if not known
@param reason
a reason message with additional information or {@code null}
| FileSystemException::FileSystemException | java | Reginer/aosp-android-jar | android-32/src/java/nio/file/FileSystemException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/file/FileSystemException.java | MIT |
public String getFile() {
return file;
} |
Returns the file used to create this exception.
@return the file (can be {@code null})
| FileSystemException::getFile | java | Reginer/aosp-android-jar | android-32/src/java/nio/file/FileSystemException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/file/FileSystemException.java | MIT |
public String getOtherFile() {
return other;
} |
Returns the other file used to create this exception.
@return the other file (can be {@code null})
| FileSystemException::getOtherFile | java | Reginer/aosp-android-jar | android-32/src/java/nio/file/FileSystemException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/file/FileSystemException.java | MIT |
public String getReason() {
return super.getMessage();
} |
Returns the string explaining why the file system operation failed.
@return the string explaining why the file system operation failed
| FileSystemException::getReason | java | Reginer/aosp-android-jar | android-32/src/java/nio/file/FileSystemException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/nio/file/FileSystemException.java | MIT |
public PasswordProtection(char[] password) {
this.password = (password == null) ? null : password.clone();
this.protectionAlgorithm = null;
this.protectionParameters = null;
} |
Creates a password parameter.
<p> The specified {@code password} is cloned before it is stored
in the new {@code PasswordProtection} object.
@param password the password, which may be {@code null}
| PasswordProtection::PasswordProtection | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public PasswordProtection(char[] password, String protectionAlgorithm,
AlgorithmParameterSpec protectionParameters) {
if (protectionAlgorithm == null) {
throw new NullPointerException("invalid null input");
}
this.password = (password == null) ? null : password.clone();
this.protectionAlgorithm = protectionAlgorithm;
this.protectionParameters = protectionParameters;
} |
Creates a password parameter and specifies the protection algorithm
and associated parameters to use when encrypting a keystore entry.
<p>
The specified {@code password} is cloned before it is stored in the
new {@code PasswordProtection} object.
@param password the password, which may be {@code null}
@param protectionAlgorithm the encryption algorithm name, for
example, {@code PBEWithHmacSHA256AndAES_256}.
See the Cipher section in the <a href=
"https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher">
Java Cryptography Architecture Standard Algorithm Name
Documentation</a>
for information about standard encryption algorithm names.
@param protectionParameters the encryption algorithm parameter
specification, which may be {@code null}
@exception NullPointerException if {@code protectionAlgorithm} is
{@code null}
@since 1.8
| PasswordProtection::PasswordProtection | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public String getProtectionAlgorithm() {
return protectionAlgorithm;
} |
Gets the name of the protection algorithm.
If none was set then the keystore provider will use its default
protection algorithm. The name of the default protection algorithm
for a given keystore type is set using the
{@code 'keystore.<type>.keyProtectionAlgorithm'} security property.
For example, the
{@code keystore.PKCS12.keyProtectionAlgorithm} property stores the
name of the default key protection algorithm used for PKCS12
keystores. If the security property is not set, an
implementation-specific algorithm will be used.
@return the algorithm name, or {@code null} if none was set
@since 1.8
| PasswordProtection::getProtectionAlgorithm | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public AlgorithmParameterSpec getProtectionParameters() {
return protectionParameters;
} |
Gets the parameters supplied for the protection algorithm.
@return the algorithm parameter specification, or {@code null},
if none was set
@since 1.8
| PasswordProtection::getProtectionParameters | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public synchronized char[] getPassword() {
if (destroyed) {
throw new IllegalStateException("password has been cleared");
}
return password;
} |
Gets the password.
<p>Note that this method returns a reference to the password.
If a clone of the array is created it is the caller's
responsibility to zero out the password information
after it is no longer needed.
@see #destroy()
@return the password, which may be {@code null}
@exception IllegalStateException if the password has
been cleared (destroyed)
| PasswordProtection::getPassword | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public synchronized void destroy() throws DestroyFailedException {
destroyed = true;
if (password != null) {
Arrays.fill(password, ' ');
}
} |
Clears the password.
@exception DestroyFailedException if this method was unable
to clear the password
| PasswordProtection::destroy | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public synchronized boolean isDestroyed() {
return destroyed;
} |
Determines if password has been cleared.
@return true if the password has been cleared, false otherwise
| PasswordProtection::isDestroyed | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public CallbackHandlerProtection(CallbackHandler handler) {
if (handler == null) {
throw new NullPointerException("handler must not be null");
}
this.handler = handler;
} |
Constructs a new CallbackHandlerProtection from a
CallbackHandler.
@param handler the CallbackHandler
@exception NullPointerException if handler is null
| CallbackHandlerProtection::CallbackHandlerProtection | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public CallbackHandler getCallbackHandler() {
return handler;
} |
Returns the CallbackHandler.
@return the CallbackHandler.
| CallbackHandlerProtection::getCallbackHandler | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public default Set<Attribute> getAttributes() {
return Collections.<Attribute>emptySet();
} |
Retrieves the attributes associated with an entry.
<p>
The default implementation returns an empty {@code Set}.
@return an unmodifiable {@code Set} of attributes, possibly empty
@since 1.8
| CallbackHandlerProtection::getAttributes | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain) {
this(privateKey, chain, Collections.<Attribute>emptySet());
} |
Constructs a {@code PrivateKeyEntry} with a
{@code PrivateKey} and corresponding certificate chain.
<p> The specified {@code chain} is cloned before it is stored
in the new {@code PrivateKeyEntry} object.
@param privateKey the {@code PrivateKey}
@param chain an array of {@code Certificate}s
representing the certificate chain.
The chain must be ordered and contain a
{@code Certificate} at index 0
corresponding to the private key.
@exception NullPointerException if
{@code privateKey} or {@code chain}
is {@code null}
@exception IllegalArgumentException if the specified chain has a
length of 0, if the specified chain does not contain
{@code Certificate}s of the same type,
or if the {@code PrivateKey} algorithm
does not match the algorithm of the {@code PublicKey}
in the end entity {@code Certificate} (at index 0)
| PrivateKeyEntry::PrivateKeyEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain,
Set<Attribute> attributes) {
if (privateKey == null || chain == null || attributes == null) {
throw new NullPointerException("invalid null input");
}
if (chain.length == 0) {
throw new IllegalArgumentException
("invalid zero-length input chain");
}
Certificate[] clonedChain = chain.clone();
String certType = clonedChain[0].getType();
for (int i = 1; i < clonedChain.length; i++) {
if (!certType.equals(clonedChain[i].getType())) {
throw new IllegalArgumentException
("chain does not contain certificates " +
"of the same type");
}
}
if (!privateKey.getAlgorithm().equals
(clonedChain[0].getPublicKey().getAlgorithm())) {
throw new IllegalArgumentException
("private key algorithm does not match " +
"algorithm of public key in end entity " +
"certificate (at index 0)");
}
this.privKey = privateKey;
if (clonedChain[0] instanceof X509Certificate &&
!(clonedChain instanceof X509Certificate[])) {
this.chain = new X509Certificate[clonedChain.length];
System.arraycopy(clonedChain, 0,
this.chain, 0, clonedChain.length);
} else {
this.chain = clonedChain;
}
this.attributes =
Collections.unmodifiableSet(new HashSet<>(attributes));
} |
Constructs a {@code PrivateKeyEntry} with a {@code PrivateKey} and
corresponding certificate chain and associated entry attributes.
<p> The specified {@code chain} and {@code attributes} are cloned
before they are stored in the new {@code PrivateKeyEntry} object.
@param privateKey the {@code PrivateKey}
@param chain an array of {@code Certificate}s
representing the certificate chain.
The chain must be ordered and contain a
{@code Certificate} at index 0
corresponding to the private key.
@param attributes the attributes
@exception NullPointerException if {@code privateKey}, {@code chain}
or {@code attributes} is {@code null}
@exception IllegalArgumentException if the specified chain has a
length of 0, if the specified chain does not contain
{@code Certificate}s of the same type,
or if the {@code PrivateKey} algorithm
does not match the algorithm of the {@code PublicKey}
in the end entity {@code Certificate} (at index 0)
@since 1.8
| PrivateKeyEntry::PrivateKeyEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public PrivateKey getPrivateKey() {
return privKey;
} |
Gets the {@code PrivateKey} from this entry.
@return the {@code PrivateKey} from this entry
| PrivateKeyEntry::getPrivateKey | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public Certificate[] getCertificateChain() {
return chain.clone();
} |
Gets the {@code Certificate} chain from this entry.
<p> The stored chain is cloned before being returned.
@return an array of {@code Certificate}s corresponding
to the certificate chain for the public key.
If the certificates are of type X.509,
the runtime type of the returned array is
{@code X509Certificate[]}.
| PrivateKeyEntry::getCertificateChain | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public Certificate getCertificate() {
return chain[0];
} |
Gets the end entity {@code Certificate}
from the certificate chain in this entry.
@return the end entity {@code Certificate} (at index 0)
from the certificate chain in this entry.
If the certificate is of type X.509,
the runtime type of the returned certificate is
{@code X509Certificate}.
| PrivateKeyEntry::getCertificate | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Private key entry and certificate chain with "
+ chain.length + " elements:\r\n");
for (Certificate cert : chain) {
sb.append(cert);
sb.append("\r\n");
}
return sb.toString();
} |
Returns a string representation of this PrivateKeyEntry.
@return a string representation of this PrivateKeyEntry.
| PrivateKeyEntry::toString | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public SecretKeyEntry(SecretKey secretKey) {
if (secretKey == null) {
throw new NullPointerException("invalid null input");
}
this.sKey = secretKey;
this.attributes = Collections.<Attribute>emptySet();
} |
Constructs a {@code SecretKeyEntry} with a
{@code SecretKey}.
@param secretKey the {@code SecretKey}
@exception NullPointerException if {@code secretKey}
is {@code null}
| SecretKeyEntry::SecretKeyEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public SecretKeyEntry(SecretKey secretKey, Set<Attribute> attributes) {
if (secretKey == null || attributes == null) {
throw new NullPointerException("invalid null input");
}
this.sKey = secretKey;
this.attributes =
Collections.unmodifiableSet(new HashSet<>(attributes));
} |
Constructs a {@code SecretKeyEntry} with a {@code SecretKey} and
associated entry attributes.
<p> The specified {@code attributes} is cloned before it is stored
in the new {@code SecretKeyEntry} object.
@param secretKey the {@code SecretKey}
@param attributes the attributes
@exception NullPointerException if {@code secretKey} or
{@code attributes} is {@code null}
@since 1.8
| SecretKeyEntry::SecretKeyEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public SecretKey getSecretKey() {
return sKey;
} |
Gets the {@code SecretKey} from this entry.
@return the {@code SecretKey} from this entry
| SecretKeyEntry::getSecretKey | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public String toString() {
return "Secret key entry with algorithm " + sKey.getAlgorithm();
} |
Returns a string representation of this SecretKeyEntry.
@return a string representation of this SecretKeyEntry.
| SecretKeyEntry::toString | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public TrustedCertificateEntry(Certificate trustedCert) {
if (trustedCert == null) {
throw new NullPointerException("invalid null input");
}
this.cert = trustedCert;
this.attributes = Collections.<Attribute>emptySet();
} |
Constructs a {@code TrustedCertificateEntry} with a
trusted {@code Certificate}.
@param trustedCert the trusted {@code Certificate}
@exception NullPointerException if
{@code trustedCert} is {@code null}
| TrustedCertificateEntry::TrustedCertificateEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public TrustedCertificateEntry(Certificate trustedCert,
Set<Attribute> attributes) {
if (trustedCert == null || attributes == null) {
throw new NullPointerException("invalid null input");
}
this.cert = trustedCert;
this.attributes =
Collections.unmodifiableSet(new HashSet<>(attributes));
} |
Constructs a {@code TrustedCertificateEntry} with a
trusted {@code Certificate} and associated entry attributes.
<p> The specified {@code attributes} is cloned before it is stored
in the new {@code TrustedCertificateEntry} object.
@param trustedCert the trusted {@code Certificate}
@param attributes the attributes
@exception NullPointerException if {@code trustedCert} or
{@code attributes} is {@code null}
@since 1.8
| TrustedCertificateEntry::TrustedCertificateEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public Certificate getTrustedCertificate() {
return cert;
} |
Gets the trusted {@code Certficate} from this entry.
@return the trusted {@code Certificate} from this entry
| TrustedCertificateEntry::getTrustedCertificate | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public String toString() {
return "Trusted certificate entry:\r\n" + cert.toString();
} |
Returns a string representation of this TrustedCertificateEntry.
@return a string representation of this TrustedCertificateEntry.
| TrustedCertificateEntry::toString | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
protected KeyStore(KeyStoreSpi keyStoreSpi, Provider provider, String type)
{
this.keyStoreSpi = keyStoreSpi;
this.provider = provider;
this.type = type;
// BEGIN Android-removed: this debugging mechanism is not supported in Android.
/*
if (!skipDebug && pdebug != null) {
pdebug.println("KeyStore." + type.toUpperCase() + " type from: " +
this.provider.getName());
}
*/
// END Android-removed: this debugging mechanism is not supported in Android.
} |
Creates a KeyStore object of the given type, and encapsulates the given
provider implementation (SPI object) in it.
@param keyStoreSpi the provider implementation.
@param provider the provider.
@param type the keystore type.
| TrustedCertificateEntry::KeyStore | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public static KeyStore getInstance(String type)
throws KeyStoreException
{
try {
Object[] objs = Security.getImpl(type, "KeyStore", (String)null);
return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
} catch (NoSuchAlgorithmException nsae) {
throw new KeyStoreException(type + " not found", nsae);
} catch (NoSuchProviderException nspe) {
throw new KeyStoreException(type + " not found", nspe);
}
} |
Returns a keystore object of the specified type.
<p> This method traverses the list of registered security Providers,
starting with the most preferred Provider.
A new KeyStore object encapsulating the
KeyStoreSpi implementation from the first
Provider that supports the specified type is returned.
<p> Note that the list of registered providers may be retrieved via
the {@link Security#getProviders() Security.getProviders()} method.
@param type the type of keystore.
See the KeyStore section in the <a href=
"https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#KeyStore">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard keystore types.
@return a keystore object of the specified type.
@exception KeyStoreException if no Provider supports a
KeyStoreSpi implementation for the
specified type.
@see Provider
| TrustedCertificateEntry::getInstance | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public static KeyStore getInstance(String type, String provider)
throws KeyStoreException, NoSuchProviderException
{
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("missing provider");
try {
Object[] objs = Security.getImpl(type, "KeyStore", provider);
return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
} catch (NoSuchAlgorithmException nsae) {
throw new KeyStoreException(type + " not found", nsae);
}
} |
Returns a keystore object of the specified type.
<p> A new KeyStore object encapsulating the
KeyStoreSpi implementation from the specified provider
is returned. The specified provider must be registered
in the security provider list.
<p> Note that the list of registered providers may be retrieved via
the {@link Security#getProviders() Security.getProviders()} method.
@param type the type of keystore.
See the KeyStore section in the <a href=
"https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#KeyStore">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard keystore types.
@param provider the name of the provider.
@return a keystore object of the specified type.
@exception KeyStoreException if a KeyStoreSpi
implementation for the specified type is not
available from the specified provider.
@exception NoSuchProviderException if the specified provider is not
registered in the security provider list.
@exception IllegalArgumentException if the provider name is null
or empty.
@see Provider
| TrustedCertificateEntry::getInstance | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public static KeyStore getInstance(String type, Provider provider)
throws KeyStoreException
{
if (provider == null)
throw new IllegalArgumentException("missing provider");
try {
Object[] objs = Security.getImpl(type, "KeyStore", provider);
return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
} catch (NoSuchAlgorithmException nsae) {
throw new KeyStoreException(type + " not found", nsae);
}
} |
Returns a keystore object of the specified type.
<p> A new KeyStore object encapsulating the
KeyStoreSpi implementation from the specified Provider
object is returned. Note that the specified Provider object
does not have to be registered in the provider list.
@param type the type of keystore.
See the KeyStore section in the <a href=
"https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#KeyStore">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard keystore types.
@param provider the provider.
@return a keystore object of the specified type.
@exception KeyStoreException if KeyStoreSpi
implementation for the specified type is not available
from the specified Provider object.
@exception IllegalArgumentException if the specified provider is null.
@see Provider
@since 1.4
| TrustedCertificateEntry::getInstance | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final static String getDefaultType() {
String kstype;
kstype = AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return Security.getProperty(KEYSTORE_TYPE);
}
});
if (kstype == null) {
kstype = "jks";
}
return kstype;
} |
Returns the default keystore type as specified by the
{@code keystore.type} security property, or the string
{@literal "jks"} (acronym for {@literal "Java keystore"})
if no such property exists.
<p>The default keystore type can be used by applications that do not
want to use a hard-coded keystore type when calling one of the
{@code getInstance} methods, and want to provide a default keystore
type in case a user does not specify its own.
<p>The default keystore type can be changed by setting the value of the
{@code keystore.type} security property to the desired keystore type.
@return the default keystore type as specified by the
{@code keystore.type} security property, or the string {@literal "jks"}
if no such property exists.
@see java.security.Security security properties
| TrustedCertificateEntry::getDefaultType | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final Provider getProvider()
{
return this.provider;
} |
Returns the provider of this keystore.
@return the provider of this keystore.
| TrustedCertificateEntry::getProvider | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final String getType()
{
return this.type;
} |
Returns the type of this keystore.
@return the type of this keystore.
| TrustedCertificateEntry::getType | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final Key getKey(String alias, char[] password)
throws KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException
{
if (!initialized) {
throw new KeyStoreException("Uninitialized keystore");
}
return keyStoreSpi.engineGetKey(alias, password);
} |
Returns the key associated with the given alias, using the given
password to recover it. The key must have been associated with
the alias by a call to {@code setKeyEntry},
or by a call to {@code setEntry} with a
{@code PrivateKeyEntry} or {@code SecretKeyEntry}.
@param alias the alias name
@param password the password for recovering the key
@return the requested key, or null if the given alias does not exist
or does not identify a key-related entry.
@exception KeyStoreException if the keystore has not been initialized
(loaded).
@exception NoSuchAlgorithmException if the algorithm for recovering the
key cannot be found
@exception UnrecoverableKeyException if the key cannot be recovered
(e.g., the given password is wrong).
| TrustedCertificateEntry::getKey | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final Certificate[] getCertificateChain(String alias)
throws KeyStoreException
{
if (!initialized) {
throw new KeyStoreException("Uninitialized keystore");
}
return keyStoreSpi.engineGetCertificateChain(alias);
} |
Returns the certificate chain associated with the given alias.
The certificate chain must have been associated with the alias
by a call to {@code setKeyEntry},
or by a call to {@code setEntry} with a
{@code PrivateKeyEntry}.
@param alias the alias name
@return the certificate chain (ordered with the user's certificate first
followed by zero or more certificate authorities), or null if the given alias
does not exist or does not contain a certificate chain
@exception KeyStoreException if the keystore has not been initialized
(loaded).
| TrustedCertificateEntry::getCertificateChain | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final Certificate getCertificate(String alias)
throws KeyStoreException
{
if (!initialized) {
throw new KeyStoreException("Uninitialized keystore");
}
return keyStoreSpi.engineGetCertificate(alias);
} |
Returns the certificate associated with the given alias.
<p> If the given alias name identifies an entry
created by a call to {@code setCertificateEntry},
or created by a call to {@code setEntry} with a
{@code TrustedCertificateEntry},
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},
or created by a call to {@code setEntry} with a
{@code PrivateKeyEntry},
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).
| TrustedCertificateEntry::getCertificate | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
public final Date getCreationDate(String alias)
throws KeyStoreException
{
if (!initialized) {
throw new KeyStoreException("Uninitialized keystore");
}
return keyStoreSpi.engineGetCreationDate(alias);
} |
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).
| TrustedCertificateEntry::getCreationDate | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
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);
} |
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},
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}).
@exception KeyStoreException if the keystore has not been initialized
(loaded), the given key cannot be protected, or this operation fails
for some other reason
| TrustedCertificateEntry::setKeyEntry | java | Reginer/aosp-android-jar | android-32/src/java/security/KeyStore.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/KeyStore.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.