Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
class: SegmentCache [javadoc | source]
java.lang.Object
   javax.swing.text.SegmentCache
SegmentCache caches Segments to avoid continually creating and destroying of Segments. A common use of this class would be:
  Segment segment = segmentCache.getSegment();
  // do something with segment
  ...
  segmentCache.releaseSegment(segment);
Constructor:
 public SegmentCache() 
Method from javax.swing.text.SegmentCache Summary:
getSegment,   getSharedInstance,   getSharedSegment,   releaseSegment,   releaseSharedSegment
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.SegmentCache Detail:
 public Segment getSegment() 
    Returns a Segment. When done, the Segment should be recycled by invoking releaseSegment.
 public static SegmentCache getSharedInstance() 
    Returns the shared SegmentCache.
 public static Segment getSharedSegment() 
    A convenience method to get a Segment from the shared SegmentCache.
 public  void releaseSegment(Segment segment) 
    Releases a Segment. You should not use a Segment after you release it, and you should NEVER release the same Segment more than once, eg:
      segmentCache.releaseSegment(segment);
      segmentCache.releaseSegment(segment);
    
    Will likely result in very bad things happening!
 public static  void releaseSharedSegment(Segment segment) 
    A convenience method to release a Segment to the shared SegmentCache.