# StorageDomain.TextFile

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.TextFile) Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/test-backup#1.0.0-alpha04)

*** ** * ** ***


```
public final class StorageDomain.TextFile 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.TextFile](https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.TextFile) |

*** ** * ** ***

Targets local raw text files stored within internal app storage.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.TextFile#TextFile(kotlin.String,kotlin.String,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 https://developer.android.com/reference/java/lang/String.html content, boolean isDeviceProtectedStorage )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.TextFile#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `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.TextFile#getContent()()` The string 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.TextFile#getPath()()` The path of the file, relative to the app's files directory (`Context.getFilesDir()`), such as `"my_data.txt"`. |
| `int` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.TextFile#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/test/backup/host/StorageDomain.TextFile#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.TextFile#toString()()` |

## Public constructors

### TextFile

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

```
public TextFile(
    @NonNull String path,
    @NonNull String 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 String getContent()
```

The string content of the file.

### 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_data.txt"`. 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.TextFile#path()` then starts at the files directory of device-protected storage.

### toString

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