Can Reflectionss help in the process of copying a directory from the classpath to the file system?

15 views
Skip to first unread message

Electro Type

unread,
Apr 8, 2019, 11:32:48 AM4/8/19
to google-code-reflections
I'm not sure if Reflections can help me here...

I'm looking for a way to recursively copy/extract a directory taken from the classpath (in a .jar) to a file system directory.

Let's say the directory on the classpath is located at "/some/directory" and that this entry is unique on the classpath (no duplicate).

Is there a way Reflections can help extracting such directory? This extraction doesn't seem to be a trivial task as you first need to find the exact .jar containing the directory in order to loop over its ZipEntry objects and copy them.

I see that the PathMatchingResourcePatternResolver class from Spring seems to do the trick, but I'm not using Spring and I'm looking for the simplies solution that doesn't use it: https://github.com/spring-projects/spring-framework/blob/master/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

Can Reflections help find the path to the .jar a directory is in? I would then use

ZipFile zipFile = new ZipFile(jarFilePath);

and copy its entries to the file system...

Thanks!
Reply all
Reply to author
Forward
0 new messages