# 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)

*** ** * ** ***


```
public final class StorageDomain.BinaryFile extends StorageDomain
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.test.backup.host.StorageDomain](https://developer.android.com/reference/androidx/test/backup/host/StorageDomain) ||
|   | ↳ | [androidx.test.backup.host.StorageDomain.BinaryFile](https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile) |

*** ** * ** ***

Targets local raw binary files stored within internal app storage.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#BinaryFile(kotlin.String,kotlin.ByteArray,kotlin.Boolean)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html path, @https://developer.android.com/reference/androidx/annotation/NonNull byte[] content, boolean isDeviceProtectedStorage )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull byte[]` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#getContent()()` The raw byte array content of the file. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#getPath()()` The path of the file, relative to the app's files directory (`Context.getFilesDir()`), such as `"my_image.png"`. |
| `int` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#toString()()` |

## Public constructors

### BinaryFile

Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#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](https://developer.android.com/jetpack/androidx/releases/test-backup#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](https://developer.android.com/jetpack/androidx/releases/test-backup#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](https://developer.android.com/jetpack/androidx/releases/test-backup#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 `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.BinaryFile#path()` then starts at the files directory of device-protected storage.

### toString

```
public @NonNull String toString()
```