Share via


Preferences.GetByteArray(String, Byte[]) Method

Definition

Returns the byte array value represented by the string associated with the specified key in this preference node.

[Android.Runtime.Register("getByteArray", "(Ljava/lang/String;[B)[B", "GetGetByteArray_Ljava_lang_String_arrayBHandler")]
public abstract byte[]? GetByteArray (string? key, byte[]? def);
[<Android.Runtime.Register("getByteArray", "(Ljava/lang/String;[B)[B", "GetGetByteArray_Ljava_lang_String_arrayBHandler")>]
abstract member GetByteArray : string * byte[] -> byte[]

Parameters

key
String

key whose associated value is to be returned as a byte array.

def
Byte[]

the value to be returned in the event that this preference node has no value associated with key or the associated value cannot be interpreted as a byte array, or the backing store is inaccessible.

Returns

Byte[]

the byte array value represented by the string associated with key in this preference node, or def if the associated value does not exist or cannot be interpreted as a byte array.

Attributes

Exceptions

if this node has been removed.

if the parameter key is null.

Remarks

Returns the byte array value represented by the string associated with the specified key in this preference node. Valid strings are Base64 encoded binary data, as defined in RFC 2045, Section 6.8, with one minor change: the string must consist solely of characters from the Base64 Alphabet; no newline characters or extraneous characters are permitted. This method is intended for use in conjunction with #putByteArray.

Returns the specified default if there is no value associated with the key, the backing store is inaccessible, or if the associated value is not a valid Base64 encoded byte array (as defined above).

If the implementation supports stored defaults and such a default exists and is accessible, it is used in preference to the specified default, unless the stored default is not a valid Base64 encoded byte array (as defined above), in which case the specified default is used.

Java documentation for java.util.prefs.Preferences.getByteArray(java.lang.String, byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to