# StorageDomain.BinaryFile

Artifact: [androidx.test.backup:backup-host](https://developer.android.com/jetpack/androidx/releases/test-backup) [View Source](https://cs.android.com/search?q=file:androidx/test/backup/host/StorageDomain.kt+class:androidx.test.backup.host.StorageDomain.BinaryFile) Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#1.0.0-alpha04)

*** ** * ** ***


```
class StorageDomain.BinaryFile : StorageDomain
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.test.backup.host.StorageDomain](https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain) ||
|   | ↳ | [androidx.test.backup.host.StorageDomain.BinaryFile](https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile) |

*** ** * ** ***

Targets local raw binary files stored within internal app storage.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#BinaryFile(kotlin.String,kotlin.ByteArray,kotlin.Boolean)( path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, content: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html, isDeviceProtectedStorage: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#content()` The raw byte array content of the file. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#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. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#path()` The path of the file, relative to the app's files directory (`Context.getFilesDir()`), such as `"my_image.png"`. |

## Public constructors

### BinaryFile

Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#1.0.0-alpha04)

```
BinaryFile(
    path: String,
    content: ByteArray,
    isDeviceProtectedStorage: Boolean = false
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### content

Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#1.0.0-alpha04)

```
val content: ByteArray
```

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

### isDeviceProtectedStorage

Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#1.0.0-alpha04)

```
val isDeviceProtectedStorage: 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. That is credential-encrypted storage, unless the app sets `android:defaultToDeviceProtectedStorage`. A relative `https://developer.android.com/reference/kotlin/androidx/test/backup/host/StorageDomain.BinaryFile#path()` then starts at the files directory of device-protected storage.

### path

Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#1.0.0-alpha04)

```
val path: String
```

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.