public class ResourceSnippet extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static ResourceSnippet |
Empty |
Constructor and Description |
---|
ResourceSnippet(String text,
int startLine,
int endLine) |
Modifier and Type | Method and Description |
---|---|
static ResourceSnippet |
createResourceSnippet(InputStream is,
int startChar,
int endChar,
String charset)
extract a ResourceSnippet from InputStream at the given char positions
|
static ResourceSnippet |
createResourceSnippet(Resource res,
int startChar,
int endChar,
String charset)
extract a ResourceSnippet from a Resource at the given char positions
|
static ResourceSnippet |
createResourceSnippet(String src,
int startChar,
int endChar) |
String |
getContent()
returns the actual text of the snippet
|
static String |
getContents(InputStream is,
String charset) |
static String |
getContents(Resource res,
String charset) |
int |
getEndLine()
returns the end line number
|
static int |
getLineNumber(String text,
int posChar)
returns the line number of the given char in the text
|
int |
getStartLine()
returns the start line number
|
public static final ResourceSnippet Empty
public ResourceSnippet(String text, int startLine, int endLine)
public String getContent()
public int getStartLine()
public int getEndLine()
public static String getContents(InputStream is, String charset)
public static String getContents(Resource res, String charset)
public static ResourceSnippet createResourceSnippet(String src, int startChar, int endChar)
public static ResourceSnippet createResourceSnippet(InputStream is, int startChar, int endChar, String charset)
is
- - InputStream of the ResourcestartChar
- - start position of the snippetendChar
- - end position of the snippetcharset
- - use server's charset, default should be UTF-8public static ResourceSnippet createResourceSnippet(Resource res, int startChar, int endChar, String charset)
res
- - Resource from which to extract the snippetstartChar
- - start position of the snippetendChar
- - end position of the snippetcharset
- - use server's charset, default should be UTF-8public static int getLineNumber(String text, int posChar)
Copyright © 2015 Lucee