# Introduction

The following Java sample programs are provided:

- ExtractFilter
- FilterFileByChunk
- FilterFileToFile
- FilterFileToStream
- FilterStreamByChunk
- FilterStreamToFile
- FilterStreamToStream
- FilterTest

The source code for the programs is in the directory `javaapi/sample`. Included alongside the source code are compiled `.class` files, and the following Batch (`.bat`) and C Shell (`.csh`) files that help run the corresponding program:

    FilterFileToFile.bat (.csh)

    FilterStreamToStream.bat (.csh)

    FilterFileToStream.bat (.csh)

    FilterStreamToFile.bat (.csh)

    FilterFileByChunk.bat (.csh)

    FilterStreamByChunk.bat (.csh)

The sample programs pass license information to KeyView through the `Filter` constructor. This is the method recommended by Micro Focus. Before the sample code can be compiled, you must replace the placeholders `YOUR_LICENSE_ORGANIZATION` and `YOUR_LICENSE_KEY` with your license information.

The compiled `.class` files that are supplied in the SDK have an embedded trial license, which expires approximately five months after release. If the environment variables `KV_SAMPLE_PROGRAM_LICENSE_ORGANIZATION` and `KV_SAMPLE_PROGRAM_LICENSE_KEY` are set then those values are used instead, so that you can use the programs after the embedded trial license has expired, and test or troubleshoot with your own license.

NOTE: The sample programs that demonstrate the use of an input stream show filtering from a `java.io.InputStream` object. In KeyView version 12.9 and later, the stream methods are overloaded to allow you to pass a `com.verity.api.SeekableInputStream` implementation into KeyView. Micro Focus recommends this option, as it allows KeyView to seek about in the file, only reading the parts it needs to read.

If you do need to use a Java InputStream, and you know the stream length, using the method overload that passes in the size might allow KeyView to avoid caching the whole file.

_FT_HTML5_bannerTitle.htm