I had the idea to replace all reading and writing to the filesystm in my codebase to use a generic, abstract DataProvider instead. It was quite interesting to do and it also works as intended now
Now everything is loaded via this selfmade abstract DataProvider which already has 3 implementations:
- MemoryDataProvider (read and write directly into RAM; you can bulk import files from filesystem, load a ZipFile or just instanciate it empty; generally used for tests)
- FileDataProvider (so normal File IO behavior here)
- ZipDataProvider (as the name says, reading from ZipFiles; writing is not supported)
- Iām planning to make a DataProvider that uses my REST client to load the data from a REST service in the near future
This whole concept is like java.nio.FileSystemsā little brother - but since it has to work on Android too I had to do this myself.
Since I use TinySound on PC side I had to change a bit of its source to be able to load from InputStream data instead of an URLā¦