mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-18 21:35:03 +01:00
Add getFilePath() to AsyncFileWriter Interface
This commit is contained in:
parent
6707af5f7c
commit
f483badd2e
@ -20,13 +20,19 @@ package bisq.persistence;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.AsynchronousFileChannel;
|
||||
import java.nio.channels.CompletionHandler;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class AsyncFileChannelWriter implements AsyncFileWriter {
|
||||
@Getter
|
||||
private final Path filePath;
|
||||
private final AsynchronousFileChannel fileChannel;
|
||||
|
||||
public AsyncFileChannelWriter(AsynchronousFileChannel fileChannel) {
|
||||
public AsyncFileChannelWriter(Path filePath, AsynchronousFileChannel fileChannel) {
|
||||
this.filePath = filePath;
|
||||
this.fileChannel = fileChannel;
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,12 @@
|
||||
|
||||
package bisq.persistence;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public interface AsyncFileWriter {
|
||||
CompletableFuture<Integer> write(byte[] data, int offset);
|
||||
|
||||
Path getFilePath();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class AsyncFileChannelWriterTests {
|
||||
void setup(@TempDir Path tempDir) throws IOException {
|
||||
filePath = tempDir.resolve("file");
|
||||
fileChannel = AsynchronousFileChannel.open(filePath, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE);
|
||||
asyncFileChannelWriter = new AsyncFileChannelWriter(fileChannel);
|
||||
asyncFileChannelWriter = new AsyncFileChannelWriter(filePath, fileChannel);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user