public class CombinedFile extends Object implements IFileSpecification
IFileSpecification
that include multiple source files into
one. JFlex-generated tokenizers can skip BOM at the beginning of a file, but
not elsewhere. This class skips BOM header in each source file so that the
merged file won't have a BOM in the middle of a file.Modifier and Type | Class and Description |
---|---|
static class |
CombinedFile.BOM
BOM patterns.
|
Constructor and Description |
---|
CombinedFile(List<String> includedFilenames,
String sourceFilename)
Create a combined file by concatenating
includedFilenames
together and append sourceFilename at the end. |
Modifier and Type | Method and Description |
---|---|
Reader |
createReader()
Create a
Reader from the combined source text. |
static CombinedFile.BOM |
getBOM(BufferedInputStream strm)
Get the BOM tag of a stream.
|
long |
getLastModified()
Get the time stamp of the most recent modified file among the source
files.
|
String |
getPath()
The path of the combined file is the path of the source file.
|
static BufferedInputStream |
getStreamAndSkipBOM(String filename)
Get the
BufferedInputStream of a file, skipping the BOM. |
boolean |
isOpenDocument()
Always return false because the combined file is cached in memory.
|
public String getPath()
getPath
in interface IFileSpecification
public Reader createReader() throws FileNotFoundException
Reader
from the combined source text.
Creates a new Reader for the contents of file. Important: The caller should call Reader.close() when it is done reading.
createReader
in interface IFileSpecification
FileNotFoundException
public long getLastModified()
Get the last modified timestamp of the file
getLastModified
in interface IFileSpecification
public boolean isOpenDocument()
isOpenDocument
in interface IFileSpecification
IFileSpecification.createReader()
method returns a reader that reads the live
document buffer.public static BufferedInputStream getStreamAndSkipBOM(String filename) throws IOException
BufferedInputStream
of a file, skipping the BOM.filename
- The path to the file.IOException
public static CombinedFile.BOM getBOM(BufferedInputStream strm) throws IOException
strm
- BufferedInputStream to be checked.CombinedFile.BOM
type.IOException
- Error.Copyright © 2016 The Apache Software Foundation. All rights reserved.