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

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

15 Apr 2025 08:24AM UTC coverage: 86.955%. First build
#348

Pull #233

github

web-flow
Merge pull request #244 from kit-data-manager/renovate/commons-io-commons-io-2.x

chore(deps): update dependency commons-io:commons-io to v2.19.0
Pull Request #233: Version 2.1.0

521 of 659 new or added lines in 18 files covered. (79.06%)

1873 of 2154 relevant lines covered (86.95%)

0.87 hits per line

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

7.69
/src/main/java/edu/kit/datamanager/ro_crate/reader/StreamReaderStrategy.java
1
package edu.kit.datamanager.ro_crate.reader;
2

3
import com.fasterxml.jackson.databind.node.ObjectNode;
4
import edu.kit.datamanager.ro_crate.writer.StreamWriterStrategy;
5
import java.io.File;
6
import java.io.FileInputStream;
7
import java.io.FileNotFoundException;
8
import java.io.InputStream;
9
import org.slf4j.LoggerFactory;
10

11
/**
12
 *
13
 * @author jejkal
14
 */
15
public interface StreamReaderStrategy extends ReaderStrategy {
16

17
    static org.slf4j.Logger logger = LoggerFactory.getLogger(StreamWriterStrategy.class);
1✔
18

19
    /**
20
     * Default override of readMetadataJson interface from ReaderStrategy. The
21
     * override assumes, that location is a file, which is used as input stream.
22
     * If this assumption is not true, this call will fail.
23
     *
24
     * @param location The source, which is supposed to be a file.
25
     *
26
     * @return the RO-Crate metadata as ObjectNode
27
     */
28
    @Override
29
    default ObjectNode readMetadataJson(String location) {
NEW
30
        ObjectNode result = null;
×
31
        try {
NEW
32
            result = readMetadataJson(new FileInputStream(new File(location)));
×
NEW
33
        } catch (FileNotFoundException ex) {
×
NEW
34
            logger.error("Failed read crate from source " + location, ex);
×
NEW
35
        }
×
NEW
36
        return result;
×
37
    }
38

39
    /**
40
     * Default override of readContent interface from ReaderStrategy. The
41
     * override assumes, that location is a file, which is used as input stream.
42
     * If this assumption is not true, this call will fail.
43
     *
44
     * @param location The source, which is supposed to be a file.
45
     *
46
     * @return the RO-Crate content as file, i.e., a folder
47
     */
48
    @Override
49
    default File readContent(String location) {
NEW
50
        File result = null;
×
51
        try {
NEW
52
            result = readContent(new FileInputStream(new File(location)));
×
NEW
53
        } catch (FileNotFoundException ex) {
×
NEW
54
            logger.error("Failed read crate from source " + location, ex);
×
NEW
55
        }
×
NEW
56
        return result;
×
57
    }
58

59
    ObjectNode readMetadataJson(InputStream source);
60

61
    File readContent(InputStream source);
62

63
}
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