org.qedeq.base.io
Class SubTextInput

java.lang.Object
  extended by java.io.InputStream
      extended by org.qedeq.base.io.TextInput
          extended by org.qedeq.base.io.SubTextInput
All Implemented Interfaces:
java.io.Closeable

public class SubTextInput
extends TextInput

Wraps a text output stream.

Author:
Michael Meyling

Field Summary
 
Fields inherited from class org.qedeq.base.io.TextInput
CR, EOF
 
Constructor Summary
SubTextInput(java.lang.String source)
          Constructor.
SubTextInput(SubTextInput original, int absoluteStart, int absoluteEnd)
          Constructor.
 
Method Summary
 int getAbsoluteEnd()
          Get the absolute end position of the current SubTextInput.
 int getAbsolutePosition()
          Get the absolute position of the current position.
 int getAbsoluteStart()
          Get the absolute start position of the current SubTextInput.
 java.lang.String getAbsoluteSubstring(int absoluteFrom, int absoluteTo)
          Get sub string of source.
 SubTextInput getSubTextInput(int absoluteFrom, int absoluteTo)
          Get sub string of source as a new SubTextInput.
 void setAbsolutePosition(int absolutePosition)
          Set the current position by calculating the relative position from the given absolute position.
 
Methods inherited from class org.qedeq.base.io.TextInput
addColumn, addPosition, addRow, asString, forward, forward, getChar, getChar, getColumn, getLine, getMaximumPosition, getPosition, getPosition, getPosition, getRow, getSourceArea, getSourcePosition, getSubstring, isEmpty, isEmpty, read, readCounter, readInverse, readLetterDigitString, readNextAttributeValue, readNextXmlName, readNonNegativeInt, readQuoted, readString, readStringTilWhitespace, replace, setColumn, setPosition, setPosition, setRow, showLinePosition, skipBackToBeginOfXmlTag, skipForwardToEndOfXmlTag, skipToEndOfLine, skipWhiteSpace, skipWhiteSpaceInverse
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubTextInput

public SubTextInput(java.lang.String source)
Constructor.

Parameters:
source - Text input.

SubTextInput

public SubTextInput(SubTextInput original,
                    int absoluteStart,
                    int absoluteEnd)
Constructor.

Parameters:
original - Parent input.
absoluteStart - Input part starts here.
absoluteEnd - Input part ends here.
Method Detail

getAbsoluteStart

public int getAbsoluteStart()
Get the absolute start position of the current SubTextInput.

Returns:
Absolute start position.

getAbsoluteEnd

public int getAbsoluteEnd()
Get the absolute end position of the current SubTextInput.

Returns:
Absolute end position.

getAbsolutePosition

public int getAbsolutePosition()
Get the absolute position of the current position.

Returns:
Absolute position of current position.

setAbsolutePosition

public void setAbsolutePosition(int absolutePosition)
Set the current position by calculating the relative position from the given absolute position.

Parameters:
absolutePosition - This should be the absolute position.

getAbsoluteSubstring

public java.lang.String getAbsoluteSubstring(int absoluteFrom,
                                             int absoluteTo)
Get sub string of source. The given parameters have values for the underlying original SubTextInput at the base.

Parameters:
absoluteFrom - Absolute start of sub string.
absoluteTo - Absolute end of sub string.
Returns:
Sub string.

getSubTextInput

public SubTextInput getSubTextInput(int absoluteFrom,
                                    int absoluteTo)
Get sub string of source as a new SubTextInput. The given parameters have values for the underlying original SubTextInput at the base.

Parameters:
absoluteFrom - Absolute start of sub string.
absoluteTo - Absolute end of sub string.
Returns:
Sub string.


Copyright © 2014. All Rights Reserved.