org.eclipse.emf.ecore.xmi.impl
Class StringSegment

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.eclipse.emf.common.util.AbstractEList<E>
              extended by org.eclipse.emf.common.util.BasicEList<StringSegment.Element>
                  extended by org.eclipse.emf.ecore.xmi.impl.StringSegment
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<StringSegment.Element>, java.util.Collection<StringSegment.Element>, java.util.List<StringSegment.Element>, java.util.RandomAccess, EList<StringSegment.Element>
Direct Known Subclasses:
XMLString

public class StringSegment
extends BasicEList<StringSegment.Element>

A String Buffer that never reallocates

See Also:
Serialized Form

Nested Class Summary
protected static class StringSegment.Element
           
protected  class StringSegment.SegmentIterator
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEList
BasicEList.BasicIndexOutOfBoundsException, BasicEList.EIterator<E1>, BasicEList.EListIterator<E1>, BasicEList.FastCompare<E>, BasicEList.NonResolvingEIterator<E1>, BasicEList.NonResolvingEListIterator<E1>, BasicEList.UnmodifiableEList<E>
 
Field Summary
protected  char[] buffer
           
protected static int BUFFER_SIZE
           
protected  int bufferPosition
           
protected  StringSegment.Element cursor
           
protected  int cursorIndex
           
protected static int ELEMENT_SIZE
           
protected  java.lang.String lineSeparator
           
protected static int LIST_SIZE
           
protected  byte[] outputbytes
           
protected  char[] outputchars
           
protected  int segmentCapacity
           
protected  java.io.Writer temporaryFile
           
protected  java.lang.String temporaryFileName
           
 
Fields inherited from class org.eclipse.emf.common.util.BasicEList
data, size
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
StringSegment()
           
StringSegment(int minimumCapacity)
           
StringSegment(int minimumCapacity, int segmentCapacity)
           
StringSegment(java.lang.String temporaryFileName)
           
 
Method Summary
 void add(java.lang.String newString)
           
 void addLine()
           
 int getChars(char[] destination, int position)
           
 int getLength()
           
 java.lang.String getTemporaryFileName()
           
 java.util.Iterator<StringSegment.Element> iterator()
          Returns an iterator.
 java.util.ListIterator<StringSegment.Element> listIterator()
          Returns a list iterator.
 java.lang.Object mark()
           
protected  java.lang.Object[] newData(int capacity)
          Returns new allocated data storage.
 void reset()
           
 void resetToMark(java.lang.Object mark)
           
 void setTemporaryFileName(java.lang.String tempFile)
           
 void startFileBuffering()
           
 java.util.Iterator<java.lang.String> stringIterator()
           
 void write(java.io.OutputStreamWriter os, int flushThreshold)
          Deprecated. since 2.2 - Instead use #write(Writer, int)
 void write(java.io.Writer os, int flushThreshold)
           
 void writeAscii(java.io.OutputStream os, int flushThreshold)
           
 
Methods inherited from class org.eclipse.emf.common.util.BasicEList
addAllUnique, addAllUnique, addAllUnique, addAllUnique, addUnique, addUnique, assign, basicGet, basicList, clear, clone, contains, data, get, grow, indexOf, isEmpty, lastIndexOf, move, primitiveGet, remove, setData, setUnique, shrink, size, toArray, toArray
 
Methods inherited from class org.eclipse.emf.common.util.AbstractEList
add, add, addAll, addAll, basicIterator, basicListIterator, basicListIterator, canContainNull, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, getDuplicates, getNonDuplicates, hashCode, isUnique, listIterator, move, remove, removeAll, resolve, retainAll, set, toString, useEquals, validate
 
Methods inherited from class java.util.AbstractList
removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, subList
 

Field Detail

LIST_SIZE

protected static final int LIST_SIZE
See Also:
Constant Field Values

ELEMENT_SIZE

protected static final int ELEMENT_SIZE
See Also:
Constant Field Values

BUFFER_SIZE

protected static final int BUFFER_SIZE
See Also:
Constant Field Values

segmentCapacity

protected int segmentCapacity

outputbytes

protected byte[] outputbytes

outputchars

protected char[] outputchars

buffer

protected char[] buffer

cursor

protected StringSegment.Element cursor

cursorIndex

protected int cursorIndex

lineSeparator

protected java.lang.String lineSeparator

temporaryFileName

protected java.lang.String temporaryFileName

temporaryFile

protected java.io.Writer temporaryFile

bufferPosition

protected int bufferPosition
Constructor Detail

StringSegment

public StringSegment()

StringSegment

public StringSegment(int minimumCapacity)

StringSegment

public StringSegment(int minimumCapacity,
                     int segmentCapacity)

StringSegment

public StringSegment(java.lang.String temporaryFileName)
Method Detail

setTemporaryFileName

public void setTemporaryFileName(java.lang.String tempFile)

getTemporaryFileName

public java.lang.String getTemporaryFileName()

newData

protected java.lang.Object[] newData(int capacity)
Description copied from class: BasicEList
Returns new allocated data storage. Clients may override this to create typed storage. The cost of type checking via a typed array is negligible.

Overrides:
newData in class BasicEList<StringSegment.Element>
Returns:
new data storage.

reset

public void reset()

add

public void add(java.lang.String newString)

addLine

public void addLine()

mark

public java.lang.Object mark()

startFileBuffering

public void startFileBuffering()

resetToMark

public void resetToMark(java.lang.Object mark)

getLength

public int getLength()

getChars

public int getChars(char[] destination,
                    int position)

writeAscii

public void writeAscii(java.io.OutputStream os,
                       int flushThreshold)
                throws java.io.IOException
Throws:
java.io.IOException

write

@Deprecated
public void write(java.io.OutputStreamWriter os,
                             int flushThreshold)
           throws java.io.IOException
Deprecated. since 2.2 - Instead use #write(Writer, int)

Parameters:
os -
flushThreshold -
Throws:
java.io.IOException

write

public void write(java.io.Writer os,
                  int flushThreshold)
           throws java.io.IOException
Throws:
java.io.IOException

iterator

public java.util.Iterator<StringSegment.Element> iterator()
Description copied from class: AbstractEList
Returns an iterator. This implementation allocates a AbstractEList.EIterator.

Specified by:
iterator in interface java.lang.Iterable<StringSegment.Element>
Specified by:
iterator in interface java.util.Collection<StringSegment.Element>
Specified by:
iterator in interface java.util.List<StringSegment.Element>
Overrides:
iterator in class AbstractEList<StringSegment.Element>
Returns:
an iterator.
See Also:
AbstractEList.EIterator

listIterator

public java.util.ListIterator<StringSegment.Element> listIterator()
Description copied from class: AbstractEList
Returns a list iterator. This implementation allocates a AbstractEList.EListIterator.

Specified by:
listIterator in interface java.util.List<StringSegment.Element>
Overrides:
listIterator in class AbstractEList<StringSegment.Element>
Returns:
a list iterator.
See Also:
AbstractEList.EListIterator

stringIterator

public java.util.Iterator<java.lang.String> stringIterator()

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.