StorageDomain.BinaryFile


public final class StorageDomain.BinaryFile extends StorageDomain


Targets local raw binary files stored within internal app storage.

Summary

Public constructors

BinaryFile(
    @NonNull String path,
    @NonNull byte[] content,
    boolean isDeviceProtectedStorage
)

Public methods

boolean
equals(Object other)
final @NonNull byte[]

The raw byte array content of the file.

final @NonNull String

The path of the file, relative to the app's files directory (Context.getFilesDir()), such as "my_image.png".

int
final boolean

Whether the file is in device-protected storage, which is available before the user first unlocks the device, rather than in the default storage of the app.

@NonNull String

Public constructors

BinaryFile

Added in 1.0.0-alpha04
public BinaryFile(
    @NonNull String path,
    @NonNull byte[] content,
    boolean isDeviceProtectedStorage
)

Public methods

equals

public boolean equals(Object other)

getContent

Added in 1.0.0-alpha04
public final @NonNull byte[] getContent()

The raw byte array content of the file. The domain keeps a copy of it, and returns a new copy on each read.

getPath

Added in 1.0.0-alpha04
public final @NonNull String getPath()

The path of the file, relative to the app's files directory (Context.getFilesDir()), such as "my_image.png". An absolute path is used as is.

hashCode

public int hashCode()

isDeviceProtectedStorage

Added in 1.0.0-alpha04
public final boolean isDeviceProtectedStorage()

Whether the file is in device-protected storage, which is available before the user first unlocks the device, rather than in the default storage of the app. That is credential-encrypted storage, unless the app sets android:defaultToDeviceProtectedStorage. A relative path then starts at the files directory of device-protected storage.

toString

public @NonNull String toString()