Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor File I/O handling #817

Open
nightm4re94 opened this issue Mar 25, 2024 · 2 comments
Open

Refactor File I/O handling #817

nightm4re94 opened this issue Mar 25, 2024 · 2 comments

Comments

@nightm4re94
Copy link
Member

nightm4re94 commented Mar 25, 2024

Make our File handling more robust by replacing the current mix of java.lang.String and java.io.File objects with the more recent java.nio.file.Path api.
The need for many helper methods in the FileUtilities class would no longer be given when using the java.nio.file.Files class, e.g. for copying or reading files.
Especially in the utiLITI editor, this change would simplify many things.
We'd have to make sure that File handling uses Paths exclusively, but things like Maps of currently loaded Spritesheets should still use String values (file names) as the map's keyset rather than Path objects.

Furthermore, we could improve the way we load image files by adopting the ImageIO utility methods for image loading in conjunction with the Path api for path processing.

I have originally started a branch for the conversion but progress has stalled and I got lost.

Some references to the java NIO2 Path api:
https://blogs.oracle.com/javamagazine/post/java-nio-nio2-buffers-channels-async-future-callback?source=:em:nw:mt::::RC_WWMK200429P00043C00073:NSL400304995
https://blogs.oracle.com/javamagazine/post/path-files-input-output?source=:em:nw:mt::::RC_WWMK200429P00043C00073:NSL400304995
https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html
https://www.baeldung.com/java-nio-2-file-api
https://howtodoinjava.com/java/nio/how-to-define-path-in-java-nio/

@SushmitaGoswami
Copy link
Contributor

SushmitaGoswami commented Sep 10, 2024

Can I contribute to this? If yes, do I need to first assign it on my name first? Thanks so much!

@nightm4re94
Copy link
Member Author

Gladly, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants