freemarker.core

Class SimpleCharStream


public class SimpleCharStream
extends java.lang.Object

An implementation of interface CharStream, where the stream is assumed to contain only ASCII characters (without unicode processing).

Field Summary

protected int[]
bufcolumn
protected char[]
buffer
protected int[]
bufline
int
bufpos
Position in buffer.
protected int
column
protected int
inBuf
protected java.io.Reader
inputStream
protected int
line
protected int
maxNextCharInd
protected boolean
prevCharIsCR
protected boolean
prevCharIsLF
static boolean
staticFlag
Whether parser is static.
protected int
tabSize

Constructor Summary

SimpleCharStream(java.io.InputStream dstream)
Constructor.
SimpleCharStream(java.io.InputStream dstream, String encoding)
Constructor.
SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn)
Constructor.
SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize)
Constructor.
SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn)
Constructor.
SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize)
Constructor.
SimpleCharStream(java.io.Reader dstream)
Constructor.
SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn)
Constructor.
SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
Constructor.

Method Summary

char
BeginToken()
Start.
void
Done()
Reset buffer when finished.
protected void
ExpandBuff(boolean wrapAround)
protected void
FillBuff()
String
GetImage()
Get token literal value.
char[]
GetSuffix(int len)
Get the suffix.
void
ReInit(java.io.InputStream dstream)
Reinitialise.
void
ReInit(java.io.InputStream dstream, String encoding)
Reinitialise.
void
ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn)
Reinitialise.
void
ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize)
Reinitialise.
void
ReInit(java.io.InputStream dstream, int startline, int startcolumn)
Reinitialise.
void
ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize)
Reinitialise.
void
ReInit(java.io.Reader dstream)
Reinitialise.
void
ReInit(java.io.Reader dstream, int startline, int startcolumn)
Reinitialise.
void
ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
Reinitialise.
protected void
UpdateLineColumn(char c)
void
adjustBeginLineColumn(int newLine, int newCol)
Method to adjust line and column numbers for the start of a token.
void
backup(int amount)
Backup a number of characters.
int
getBeginColumn()
Get token beginning column number.
int
getBeginLine()
Get token beginning line number.
int
getColumn()
Deprecated.
int
getEndColumn()
Get token end column number.
int
getEndLine()
Get token end line number.
int
getLine()
Deprecated.
protected int
getTabSize(int i)
char
readChar()
Read a character.
protected void
setTabSize(int i)

Field Details

bufcolumn

protected int[] bufcolumn

buffer

protected char[] buffer

bufline

protected int[] bufline

bufpos

public int bufpos
Position in buffer.

column

protected int column

inBuf

protected int inBuf

inputStream

protected java.io.Reader inputStream

line

protected int line

maxNextCharInd

protected int maxNextCharInd

prevCharIsCR

protected boolean prevCharIsCR

prevCharIsLF

protected boolean prevCharIsLF

staticFlag

public static final boolean staticFlag
Whether parser is static.
Field Value:
false

tabSize

protected int tabSize

Constructor Details

SimpleCharStream

public SimpleCharStream(java.io.InputStream dstream)
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.InputStream dstream,
                        String encoding)
            throws java.io.UnsupportedEncodingException
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.InputStream dstream,
                        String encoding,
                        int startline,
                        int startcolumn)
            throws java.io.UnsupportedEncodingException
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.InputStream dstream,
                        String encoding,
                        int startline,
                        int startcolumn,
                        int buffersize)
            throws java.io.UnsupportedEncodingException
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.InputStream dstream,
                        int startline,
                        int startcolumn)
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.InputStream dstream,
                        int startline,
                        int startcolumn,
                        int buffersize)
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.Reader dstream)
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.Reader dstream,
                        int startline,
                        int startcolumn)
Constructor.

SimpleCharStream

public SimpleCharStream(java.io.Reader dstream,
                        int startline,
                        int startcolumn,
                        int buffersize)
Constructor.

Method Details

BeginToken

public char BeginToken()
            throws java.io.IOException
Start.

Done

public void Done()
Reset buffer when finished.

ExpandBuff

protected void ExpandBuff(boolean wrapAround)

FillBuff

protected void FillBuff()
            throws java.io.IOException

GetImage

public String GetImage()
Get token literal value.

GetSuffix

public char[] GetSuffix(int len)
Get the suffix.

ReInit

public void ReInit(java.io.InputStream dstream)
Reinitialise.

ReInit

public void ReInit(java.io.InputStream dstream,
                   String encoding)
            throws java.io.UnsupportedEncodingException
Reinitialise.

ReInit

public void ReInit(java.io.InputStream dstream,
                   String encoding,
                   int startline,
                   int startcolumn)
            throws java.io.UnsupportedEncodingException
Reinitialise.

ReInit

public void ReInit(java.io.InputStream dstream,
                   String encoding,
                   int startline,
                   int startcolumn,
                   int buffersize)
            throws java.io.UnsupportedEncodingException
Reinitialise.

ReInit

public void ReInit(java.io.InputStream dstream,
                   int startline,
                   int startcolumn)
Reinitialise.

ReInit

public void ReInit(java.io.InputStream dstream,
                   int startline,
                   int startcolumn,
                   int buffersize)
Reinitialise.

ReInit

public void ReInit(java.io.Reader dstream)
Reinitialise.

ReInit

public void ReInit(java.io.Reader dstream,
                   int startline,
                   int startcolumn)
Reinitialise.

ReInit

public void ReInit(java.io.Reader dstream,
                   int startline,
                   int startcolumn,
                   int buffersize)
Reinitialise.

UpdateLineColumn

protected void UpdateLineColumn(char c)

adjustBeginLineColumn

public void adjustBeginLineColumn(int newLine,
                                  int newCol)
Method to adjust line and column numbers for the start of a token.

backup

public void backup(int amount)
Backup a number of characters.

getBeginColumn

public int getBeginColumn()
Get token beginning column number.

getBeginLine

public int getBeginLine()
Get token beginning line number.

getColumn

public int getColumn()

Deprecated.


getEndColumn

public int getEndColumn()
Get token end column number.

getEndLine

public int getEndLine()
Get token end line number.

getLine

public int getLine()

Deprecated.


getTabSize

protected int getTabSize(int i)

readChar

public char readChar()
            throws java.io.IOException
Read a character.

setTabSize

protected void setTabSize(int i)