|
1 | 1 | /*
|
2 |
| - * Copyright 2017-2023 ObjectBox Ltd. All rights reserved. |
| 2 | + * Copyright 2017-2024 ObjectBox Ltd. All rights reserved. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
16 | 16 |
|
17 | 17 | package io.objectbox;
|
18 | 18 |
|
| 19 | +import org.greenrobot.essentials.io.IoUtils; |
| 20 | + |
19 | 21 | import java.io.BufferedInputStream;
|
20 | 22 | import java.io.BufferedOutputStream;
|
21 | 23 | import java.io.File;
|
|
43 | 45 | import io.objectbox.exception.DbMaxReadersExceededException;
|
44 | 46 | import io.objectbox.flatbuffers.FlatBufferBuilder;
|
45 | 47 | import io.objectbox.ideasonly.ModelUpdate;
|
46 |
| -import org.greenrobot.essentials.io.IoUtils; |
47 | 48 |
|
48 | 49 | /**
|
49 | 50 | * Configures and builds a {@link BoxStore} with reasonable defaults. To get an instance use {@code MyObjectBox.builder()}.
|
@@ -161,8 +162,21 @@ public BoxStoreBuilder name(String name) {
|
161 | 162 | }
|
162 | 163 |
|
163 | 164 | /**
|
164 |
| - * The directory where all DB files should be placed in. |
165 |
| - * Cannot be used in combination with {@link #name(String)}/{@link #baseDirectory(File)}. |
| 165 | + * The directory where all database files should be placed in. |
| 166 | + * <p> |
| 167 | + * If the directory does not exist, it will be created. Make sure the process has permissions to write to this |
| 168 | + * directory. |
| 169 | + * <p> |
| 170 | + * To switch to an in-memory database, use a file path with {@link BoxStore#IN_MEMORY_PREFIX} and an identifier |
| 171 | + * instead: |
| 172 | + * <p> |
| 173 | + * <pre>{@code |
| 174 | + * BoxStore inMemoryStore = MyObjectBox.builder() |
| 175 | + * .directory(BoxStore.IN_MEMORY_PREFIX + "notes-db") |
| 176 | + * .build(); |
| 177 | + * }</pre> |
| 178 | + * <p> |
| 179 | + * Can not be used in combination with {@link #name(String)} or {@link #baseDirectory(File)}. |
166 | 180 | */
|
167 | 181 | public BoxStoreBuilder directory(File directory) {
|
168 | 182 | if (name != null) {
|
|
0 commit comments