Share via


Preferences.PutByteArray(String, Byte[]) Method

Definition

Associates a string representing the specified byte array with the specified key in this preference node.

[Android.Runtime.Register("putByteArray", "(Ljava/lang/String;[B)V", "GetPutByteArray_Ljava_lang_String_arrayBHandler")]
public abstract void PutByteArray (string? key, byte[]? value);
[<Android.Runtime.Register("putByteArray", "(Ljava/lang/String;[B)V", "GetPutByteArray_Ljava_lang_String_arrayBHandler")>]
abstract member PutByteArray : string * byte[] -> unit

Parameters

key
String

key with which the string form of value is to be associated.

value
Byte[]

value whose string form is to be associated with key.

Attributes

Exceptions

if the given key or value is null.

if the given key's length is bigger than MAX_KEY_LENGTH or value's length is bigger than three quarters of MAX_KEY_LENGTH.

if this node has been removed.

Remarks

Associates a string representing the specified byte array with the specified key in this preference node. The associated string is the Base64 encoding of the byte array, as defined in RFC 2045, Section 6.8, with one minor change: the string will consist solely of characters from the Base64 Alphabet; it will not contain any newline characters. Note that the maximum length of the byte array is limited to three quarters of MAX_VALUE_LENGTH so that the length of the Base64 encoded String does not exceed MAX_VALUE_LENGTH. This method is intended for use in conjunction with #getByteArray.

Java documentation for java.util.prefs.Preferences.putByteArray(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