Package com.snowflake.snowpark_java.types

## Class SnowflakeFile

- java.lang.Object
- - com.snowflake.snowpark_java.types.SnowflakeFile

-     public class SnowflakeFile
      extends java.lang.Object

  Custom Snowflake class that provides users with additional information on top of the core capability of reading Snowflake files.
  Since:
    1.3.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SnowflakeFile()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.io.InputStream` | `getInputStream()` | Obtain and return the input stream for the file.
    `java.lang.Long` | `getSize()` | Total size of the file obtained from the cloud storage provider when available, returns null otherwise.
    `static SnowflakeFile` | `newInstance​(java.lang.String scopedUrl)` | Create a new instance of SnowflakeFile.
    `static SnowflakeFile` | `newInstance​(java.lang.String url, boolean requireScopedUrl)` | Create a new instance of SnowflakeFile.
    `static SnowflakeFile` | `newInstanceFromOwnerFileUrl​(java.lang.String url)` | Deprecated. Use newInstance(String, bool) instead.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SnowflakeFile

          public SnowflakeFile()

  - ### Method Detail

    - #### newInstance

          public static SnowflakeFile newInstance​(java.lang.String scopedUrl)

      Create a new instance of SnowflakeFile. Calls into our C++ layer to construct it.
      Parameters:
        `scopedUrl` - can be scoped URL. Stage file references should use the second override to set requireScopedUrl to false.
      Returns:
        A new instance of SnowflakeFile for the given URL.
      Since:
        1.3.0

    - #### newInstance

          public static SnowflakeFile newInstance​(java.lang.String url,
                                                  boolean requireScopedUrl)

      Create a new instance of SnowflakeFile. Calls into our C++ layer to construct it.

      This method should be used when the UDF author (owner) intends to access their own files via a stage URL. If scoped URL is required, newInstance(scopedUrl) can be used. This method requires a scoped URL and is the same as calling newInstance(scopedUrl, /*requiredScopedUrl*\/=true).

      All files are accessed in the context of the UDF owner (with the exception of caller's rights stored procedures which use the caller's context). UDF callers should use scoped URLs to allow the UDF to access their files. By accepting only scoped URLs the UDF owner can ensure the UDF caller had access to the provided file. Removing the requirement that the URL is a scoped URL (requireScopedUrl=false) allows the caller to provide URLs that may be only accessible by the UDF owner.

      Parameters:
        `url` - scoped URL, file URL, or string path for files located in a stage
        `requireScopedUrl` - whether to fail if this URL is not a scoped URL
      Returns:
        A new instance of SnowflakeFile for the given URL.
      Since:
        1.8.0

    - #### newInstanceFromOwnerFileUrl

          @Deprecated
          public static SnowflakeFile newInstanceFromOwnerFileUrl​(java.lang.String url)

      Deprecated.
      Use newInstance(String, bool) instead.
      Create a new instance of SnowflakeFile. Calls into our C++ layer to construct it.

      This method should be used when the UDF author (owner) intends to access their own files whereas the other method (newInstance) should be used when the UDF owner intends to access files passed into the function by the caller.

      All files are accessed in the context of the UDF owner and therefore implementation should prefer using the newInstance for callers files as it only allows scoped URLs and therefore a caller cannot inadvertently access the owner's files.

      Parameters:
        `url` - can be scoped URL or a stage file reference.
      Returns:
        A new instance of SnowflakeFile for the given URL.
      Since:
        1.8.0

    - #### getInputStream

          public java.io.InputStream getInputStream()

      Obtain and return the input stream for the file. Successive calls do not create a new input stream, but rather return the cached stream for the file.
      Returns:
        An InputStream for the SnowflakeFile.
      Since:
        1.3.0

    - #### getSize

          public java.lang.Long getSize()

      Total size of the file obtained from the cloud storage provider when available, returns null otherwise.
      Returns:
        the size of the file, as provided by the cloud storage provider.
      Since:
        1.3.0