net.snowflake.client.core.bind

## Class BindUploader

- java.lang.Object
- - net.snowflake.client.core.bind.BindUploader

All Implemented Interfaces:
  Closeable, AutoCloseable

    public class BindUploader
    extends Object
    implements Closeable

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static int` `arrayBindValueCount(Map<String,ParameterBindingDTO> bindValues)` Compute the number of array bind values in the given bind map
`void` `close()` Close uploader, deleting the local temporary directory
`Path` `getBindDir()` Return the local path to which binds are serialized
`String` `getStagePath()` Return the stage path to which binds are uploaded
`static boolean` `isArrayBind(Map<String,ParameterBindingDTO> bindValues)` Return whether the bind map uses array binds
`static BindUploader` `newInstance(SFSession session, String stageDir)` Create a new BindUploader which will upload to the given stage path Ensure temporary directory for file writing exists
`void` `setFileSize(int fileSize)` Set the approximate maximum size in bytes for a single bind file
`void` `upload(Map<String,ParameterBindingDTO> bindValues)` Upload the bindValues to stage

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

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

### Method Detail

#### newInstance

    public static BindUploader newInstance(SFSession session,
                                           String stageDir)
                                    throws BindException

Create a new BindUploader which will upload to the given stage path Ensure temporary directory for file writing exists

Parameters:
  `session` - the session to use for uploading binds
  `stageDir` - the stage path to upload to
Returns:
  BindUploader instance
Throws:
  `BindException` - if temporary directory could not be created

#### upload

    public void upload(Map<String,ParameterBindingDTO> bindValues)
                throws BindException

Upload the bindValues to stage

Parameters:
  `bindValues` - the bind map to upload
Throws:
  `BindException` - if the bind map could not be serialized or upload fails

#### close

    public void close()

Close uploader, deleting the local temporary directory

This class can be used in a try-with-resources statement, which ensures that the temporary directory is cleaned up even when exceptions occur

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`

#### setFileSize

    public void setFileSize(int fileSize)

Set the approximate maximum size in bytes for a single bind file

Parameters:
  `fileSize` - size in bytes

#### getStagePath

    public String getStagePath()

Return the stage path to which binds are uploaded

Returns:
  the stage path

#### getBindDir

    public Path getBindDir()

Return the local path to which binds are serialized

Returns:
  the local path

#### arrayBindValueCount

    public static int arrayBindValueCount(Map<String,ParameterBindingDTO> bindValues)

Compute the number of array bind values in the given bind map

Parameters:
  `bindValues` - the bind map
Returns:
  0 if bindValues is null, has no binds, or is not an array bind n otherwise, where n is the number of binds in the array bind

#### isArrayBind

    public static boolean isArrayBind(Map<String,ParameterBindingDTO> bindValues)

Return whether the bind map uses array binds

Parameters:
  `bindValues` - the bind map
Returns:
  whether the bind map uses array binds