# Class SamInputResource

java.lang.Object
htsjdk.samtools.SamInputResource

public class SamInputResource extends Object
Describes a SAM-like resource, including its data (where the records are), and optionally an index.

A data or index source may originate from a `File`, `InputStream`, `URL`, or `SeekableStream`; look for the appropriate overload for `htsjdk.samtools.SamInputResource#of()`.

## Method Summary

Modifier and Type
Method
Description
`SamInputResource`
`index(SeekableStream seekableStream)`
Updates the index to point at the provided resource, then returns itself.
`SamInputResource`
`index(File file)`
Updates the index to point at the provided resource, then returns itself.
`SamInputResource`
`index(InputStream inputStream)`
Updates the index to point at the provided resource, then returns itself.
`SamInputResource`
`index(URL url)`
Updates the index to point at the provided resource, then returns itself.
`SamInputResource`
`index(Path path)`
Updates the index to point at the provided resource, then returns itself.
`SamInputResource`
`index(Path path, Function<SeekableByteChannel, SeekableByteChannel> wrapper)`
Updates the index to point at the provided resource, with the provided wrapper, then returns itself.
`static SamInputResource`
`of(SeekableStream seekableStream)`
Creates a `SamInputResource` reading from the provided resource, with no index.
`static SamInputResource`
`of(File file)`
Creates a `SamInputResource` reading from the provided resource, with no index.
`static SamInputResource`
`of(InputStream inputStream)`
Creates a `SamInputResource` reading from the provided resource, with no index.
`static SamInputResource`
`of(String string)`
Creates a `SamInputResource` from a string specifying *either* a url or a file path
`static SamInputResource`
`of(URI uri)`
Creates a `SamInputResource` from a URI which may represent an htsget path, or some other resource such as a filesystem path or a URL, with no index.
`static SamInputResource`
`of(URI uri, Function<SeekableByteChannel, SeekableByteChannel> wrapper)`
Creates a `SamInputResource` with no index from a URI which may represent an htsget path, or some other resource such as a filesystem path or a URL, with no index, and with a wrapper to apply to the SeekableByteChannel for custom prefetching/buffering.
`static SamInputResource`
`of(URL url)`
Creates a `SamInputResource` reading from the provided resource, with no index.
`static SamInputResource`
`of(Path path)`
Creates a `SamInputResource` reading from the provided resource, with no index.
`static SamInputResource`
`of(Path path, Function<SeekableByteChannel, SeekableByteChannel> wrapper)`
Creates a `SamInputResource` reading from the provided resource, with no index, and with a wrapper to apply to the SeekableByteChannel for custom prefetching/buffering.
`String`
`toString()`

### Methods inherited from class Object

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

## Method Details

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### of

public static SamInputResource of(File file)
Creates a `SamInputResource` reading from the provided resource, with no index.

### of

public static SamInputResource of(Path path)
Creates a `SamInputResource` reading from the provided resource, with no index.

### of

public static SamInputResource of(Path path, Function<SeekableByteChannel, SeekableByteChannel> wrapper)
Creates a `SamInputResource` reading from the provided resource, with no index, and with a wrapper to apply to the SeekableByteChannel for custom prefetching/buffering.

### of

public static SamInputResource of(InputStream inputStream)
Creates a `SamInputResource` reading from the provided resource, with no index.

### of

public static SamInputResource of(URL url)
Creates a `SamInputResource` reading from the provided resource, with no index.

### of

public static SamInputResource of(SeekableStream seekableStream)
Creates a `SamInputResource` reading from the provided resource, with no index.

### of

public static SamInputResource of(URI uri)
Creates a `SamInputResource` from a URI which may represent an htsget path, or some other resource such as a filesystem path or a URL, with no index. This method will first attempt to treat the resource as an htsget resource, then fall back to treating it as a file system path, then as a URL

### of

public static SamInputResource of(URI uri, Function<SeekableByteChannel, SeekableByteChannel> wrapper)
Creates a `SamInputResource` with no index from a URI which may represent an htsget path, or some other resource such as a filesystem path or a URL, with no index, and with a wrapper to apply to the SeekableByteChannel for custom prefetching/buffering. This method will first attempt to treat the resource as an htsget resource, then fall back to treating it as a file system path, then as a URL

### of

public static SamInputResource of(String string)
Creates a `SamInputResource` from a string specifying *either* a url or a file path

### index

public SamInputResource index(File file)
Updates the index to point at the provided resource, then returns itself.

### index

public SamInputResource index(Path path)
Updates the index to point at the provided resource, then returns itself.

### index

public SamInputResource index(Path path, Function<SeekableByteChannel, SeekableByteChannel> wrapper)
Updates the index to point at the provided resource, with the provided wrapper, then returns itself.

### index

public SamInputResource index(InputStream inputStream)
Updates the index to point at the provided resource, then returns itself.

### index

public SamInputResource index(URL url)
Updates the index to point at the provided resource, then returns itself.

### index

public SamInputResource index(SeekableStream seekableStream)
Updates the index to point at the provided resource, then returns itself.