• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kit-data-manager / ro-crate-java / #373

28 Apr 2025 09:57AM UTC coverage: 86.891% (+0.9%) from 85.949%
#373

Pull #247

github

web-flow
Merge a4e0ad782 into 0ab3f3ca9
Pull Request #247: Generalize reading and writing crates

249 of 278 new or added lines in 16 files covered. (89.57%)

2 existing lines in 2 files now uncovered.

1889 of 2174 relevant lines covered (86.89%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/src/main/java/edu/kit/datamanager/ro_crate/reader/Readers.java
1
package edu.kit.datamanager.ro_crate.reader;
2

3
import java.io.InputStream;
4
import java.nio.file.Path;
5

6
/**
7
 * Factory for creating common RO-Crate reader instances.
8
 * Provides convenient static methods to instantiate readers with pre-configured strategies.
9
 */
10
public class Readers {
11

12
    /**
13
     * Private constructor to prevent instantiation of this utility class.
14
     */
15
    private Readers() {}
16

17
    /**
18
     * Creates a reader that reads from ZIP files using input streams.
19
     *
20
     * @return A reader configured for ZIP files
21
     *
22
     * @see ZipStreamStrategy#ZipStreamStrategy()
23
     */
24
    public static CrateReader<InputStream> newZipStreamReader() {
25
        return new CrateReader<>(new ZipStreamStrategy());
1✔
26
    }
27

28
    /**
29
     * Creates a reader that reads from ZIP files using input streams,
30
     * extracting to a custom temporary location.
31
     *
32
     * @param extractPath Path where ZIP contents should be extracted
33
     * @param useUuidSubfolder Whether to create a UUID subfolder under extractPath
34
     * @return A reader configured for ZIP files with custom extraction
35
     *
36
     * @see ZipStreamStrategy#ZipStreamStrategy(Path, boolean)
37
     */
38
    public static CrateReader<InputStream> newZipStreamReader(Path extractPath, boolean useUuidSubfolder) {
NEW
39
        return new CrateReader<>(new ZipStreamStrategy(extractPath, useUuidSubfolder));
×
40
    }
41

42
    /**
43
     * Creates a reader that reads from a folder using a string path.
44
     *
45
     * @return A reader configured for folders
46
     *
47
     * @see FolderStrategy
48
     */
49
    public static CrateReader<String> newFolderReader() {
50
        return new CrateReader<>(new FolderStrategy());
1✔
51
    }
52

53
    /**
54
     * Creates a reader that reads from a ZIP file using a string path.
55
     *
56
     * @return A reader configured for ZIP files
57
     *
58
     * @see ZipStrategy#ZipStrategy()
59
     */
60
    public static CrateReader<String> newZipPathReader() {
61
        return new CrateReader<>(new ZipStrategy());
1✔
62
    }
63

64
    /**
65
     * Creates a reader that reads from a ZIP file using a string path,
66
     * extracting to a custom temporary location.
67
     *
68
     * @param extractPath Path where ZIP contents should be extracted
69
     * @param useUuidSubfolder Whether to create a UUID subfolder under extractPath
70
     * @return A reader configured for ZIP files with custom extraction
71
     *
72
     * @see ZipStrategy#ZipStrategy(Path, boolean)
73
     */
74
    public static CrateReader<String> newZipPathReader(Path extractPath, boolean useUuidSubfolder) {
NEW
75
        return new CrateReader<>(new ZipStrategy(extractPath, useUuidSubfolder));
×
76
    }
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc