mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-13 13:01:02 +00:00
Cleanup
This commit is contained in:
@@ -27,6 +27,11 @@ public class FileStore implements StreamDataStore, FilenameStore {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOpen() {
|
||||
return machine.exists(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDisplay() {
|
||||
return file + "@" + machine.toDisplay();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class InputStreamDataStore implements StreamDataStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
public boolean canOpen() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,11 @@ import java.nio.file.Path;
|
||||
@JsonTypeName("local")
|
||||
public class LocalMachineStore implements MachineStore {
|
||||
|
||||
@Override
|
||||
public boolean exists(String file) {
|
||||
return Files.exists(Path.of(file));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toDisplay() {
|
||||
return "local";
|
||||
|
||||
@@ -13,4 +13,5 @@ public interface MachineStore extends DataStore {
|
||||
|
||||
OutputStream openOutput(String file) throws Exception;
|
||||
|
||||
public boolean exists(String file);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class OutputStreamStore implements StreamDataStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
public boolean canOpen() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class StdinDataStore implements StreamDataStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
public boolean canOpen() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StdoutDataStore implements StreamDataStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
public boolean canOpen() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,8 @@ public interface StreamDataStore extends DataStore {
|
||||
throw new UnsupportedOperationException("Can't open store output");
|
||||
}
|
||||
|
||||
default OutputStream openAppendingOutput() throws Exception {
|
||||
throw new UnsupportedOperationException("Can't open store output");
|
||||
}
|
||||
|
||||
default boolean exists() {
|
||||
return false;
|
||||
default boolean canOpen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
default boolean persistent() {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class URLDataStore implements StreamDataStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
public boolean canOpen() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user