net.snowflake.client.jdbc

## Class SnowflakeChunkDownloader

- java.lang.Object
- - net.snowflake.client.jdbc.SnowflakeChunkDownloader

All Implemented Interfaces:
  ChunkDownloader

    public class SnowflakeChunkDownloader
    extends Object
    implements ChunkDownloader

Class for managing async download of offline result chunks

Created by jhuang on 11/12/14.

### Nested Class Summary

Nested Classes
`static class` `SnowflakeChunkDownloader.NoOpChunkDownloader` This is a No Operation chunk downloader to avoid potential null pointer exception

### Constructor Summary

Constructors
Constructor and Description
`SnowflakeChunkDownloader(SnowflakeResultSetSerializableV1 resultSetSerializable)` Constructor to initialize downloader

### Method Summary

All Methods Instance Methods Concrete Methods
`SnowflakeResultChunk` `getNextChunkToConsume()` The method does the following:
`OCSPMode` `getOCSPMode()`
`DownloaderMetrics` `terminate()` terminate the downloader

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

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

### Constructor Detail

#### SnowflakeChunkDownloader

    public SnowflakeChunkDownloader(SnowflakeResultSetSerializableV1 resultSetSerializable)
                             throws SnowflakeSQLException

Constructor to initialize downloader

Parameters:
  `resultSetSerializable` - the result set serializable object which includes required metadata to start chunk downloader
Throws:
  `SnowflakeSQLException`

### Method Detail

#### getOCSPMode

    public OCSPMode getOCSPMode()

#### getNextChunkToConsume

    public SnowflakeResultChunk getNextChunkToConsume()
                                               throws InterruptedException,
                                                      SnowflakeSQLException

The method does the following:

1. free the previous chunk data and submit a new chunk to be downloaded

2. get next chunk to consume, if it is not ready for consumption, it waits until it is ready

Specified by:
  `getNextChunkToConsume` in interface `ChunkDownloader`
Returns:
  next SnowflakeResultChunk to be consumed
Throws:
  `InterruptedException` - if downloading thread was interrupted
  `SnowflakeSQLException` - if downloader encountered an error

#### terminate

    public DownloaderMetrics terminate()
                                throws InterruptedException

terminate the downloader

Specified by:
  `terminate` in interface `ChunkDownloader`
Returns:
  chunk downloader metrics collected over instance lifetime
Throws:
  `InterruptedException`