Forum Discussion

j_angelevski's avatar
j_angelevski
Contributor III
3 years ago
Solved

Read file from SLDB?

Hi, I am in the process of building a custom snap and I am uncertain of how to read a file from the SLDB. The documentation does not provide an example for this. I was able to read a file from the ...
  • ptaylor's avatar
    3 years ago

    Use the com.snaplogic.common.utilities.URLEncoder class. It would look something like this:

                URLConnection urlConnection = new URLEncoder()
                        .validateAndEncodeURI(path)
                        .toURL().openConnection();
                urlConnection.connect();
                try (InputStream inputStream = urlConnection.getInputStream()) {
                    // ...
                }