Package com.google.javascript.jscomp

# Class SourceFile.Builder

java.lang.Object
com.google.javascript.jscomp.SourceFile.Builder

Enclosing class:
  `SourceFile`

public static class SourceFile.Builder extends Object
A builder interface for source files. Allows users to customize the Charset, and the original path of the source file (if it differs from the path on disk).

## Constructor Summary

Constructors
Constructor
Description
`Builder()`

## Method Summary

Modifier and Type
Method
Description
`SourceFile`
`buildFromCode(String fileName, String code)`
`SourceFile`
`buildFromFile(File file)`
`SourceFile`
`buildFromFile(String fileName)`
`SourceFile`
`buildFromGenerator(String fileName, SourceFile.Generator generator)`
`SourceFile`
`buildFromInputStream(String fileName, InputStream s)`
`SourceFile`
`buildFromReader(String fileName, Reader r)`
`SourceFile.Builder`
`withCharset(Charset charset)`
Set the charset to use when reading from an input stream or file.
`SourceFile.Builder`
`withOriginalPath(String originalPath)`
Set the original path to use.

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

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

## Constructor Details

### Builder

public Builder()

## Method Details

### withCharset

public SourceFile.Builder withCharset(Charset charset)
Set the charset to use when reading from an input stream or file.

### withOriginalPath

public SourceFile.Builder withOriginalPath(String originalPath)
Set the original path to use.

### buildFromFile

public SourceFile buildFromFile(String fileName)

### buildFromFile

public SourceFile buildFromFile(File file)

### buildFromCode

public SourceFile buildFromCode(String fileName, String code)

### buildFromInputStream

public SourceFile buildFromInputStream(String fileName, InputStream s) throws IOException

Throws:
  `IOException`

### buildFromReader

public SourceFile buildFromReader(String fileName, Reader r) throws IOException

Throws:
  `IOException`

### buildFromGenerator

public SourceFile buildFromGenerator(String fileName, SourceFile.Generator generator)