-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bulk operation support, ZIP file reading in CLI
- Loading branch information
Showing
9 changed files
with
148 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package run.slicer.poke.cli; | ||
|
||
import run.slicer.poke.Entry; | ||
|
||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.util.zip.ZipEntry; | ||
import java.util.zip.ZipFile; | ||
|
||
record ZipEntryImpl(ZipFile file, ZipEntry entry) implements Entry { | ||
@Override | ||
public String name() { | ||
return entry.getName(); | ||
} | ||
|
||
@Override | ||
public byte[] data() { | ||
try { | ||
return file.getInputStream(entry).readAllBytes(); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@NullMarked | ||
package run.slicer.poke.cli; | ||
|
||
import org.jspecify.annotations.NullMarked; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package run.slicer.poke; | ||
|
||
import org.jspecify.annotations.Nullable; | ||
|
||
public interface Entry { | ||
static Entry of(@Nullable String name, byte[] data) { | ||
return new EntryImpl(name, data); | ||
} | ||
|
||
@Nullable | ||
String name(); | ||
|
||
default Entry withName(String name) { | ||
return new EntryImpl(name, this.data()); | ||
} | ||
|
||
byte[] data(); | ||
|
||
default Entry withData(byte[] data) { | ||
return new EntryImpl(this.name(), data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package run.slicer.poke; | ||
|
||
import org.jspecify.annotations.Nullable; | ||
|
||
public record EntryImpl(@Nullable String name, byte[] data) implements Entry { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@NullMarked | ||
package run.slicer.poke; | ||
|
||
import org.jspecify.annotations.NullMarked; |