opencore / dsfinvk-java

Java library to deal with the DSFinV-K export format
Apache License 2.0
6 stars 4 forks source link

[feature-request] add possibility to work with inputstreams instead of files #7

Open bilak opened 4 years ago

bilak commented 4 years ago

Hi, would you be able to provide functionality for parsing *.csv files from input streams instead of files? We are working with dsfinv-k data but just in memory extracting them right from the provided archive files. That probably would be also a requirement for gdpdu-parser.

just note: we are using ByteArrayInputStream to read files multiple times.

Thanks

lfrancke commented 4 years ago

Thanks for the suggestion. I think that makes sense.

I'll have to think about how that'd fit in. If you have any suggestions or further use cases please reach out.

lfrancke commented 4 years ago

What would be a useful method to have?

I assume we're talking about the DsfinvkParser?

This one for example?

public static <T> List<T> parseTable(File indexXml, String tableName, Class<T> clazz, InputStream table) throws ParsingException

There are so many options to chose from. If you let me know what you need I'm sure we can make it work.

bilak commented 4 years ago

Hi, I think we should start with conversion of File indexXml to InputStream indexXml. So basically everywhere where file is used currently, just use inputStream instead. Then If you'd like to still have File at method input, it should then load content of file to ByteArrayInputStream and pass data to modified methods.

lfrancke commented 4 years ago

I have added the required functionality in gdpdu-java: https://github.com/opencore/gdpdu-java/blob/3d25ffca7ae1a84a2f913185dbf9c83616d75b6b/gdpdu-data-parser/src/main/java/com/opencore/gdpdu/data/GdpduDataParser.java

It isn't exposed in dsfinvk-java yet but I'll get to that.