站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class Segment - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

javax.swing.text
Class Segment

java.lang.Object
  |
  +--javax.swing.text.Segment

public class Segment
extends Object

A segment of a character array representing a fragment of text. It should be treated as immutable even though the array is directly accessable. This gives fast access to fragments of text without the overhead of copying around characters. This is effectively an unprotected String.


Field Summary
 char[] array
          This is the array containing the text of interest.
 int count
          This is the number of array elements that make up the text of interest.
 int offset
          This is the offset into the array that the desired text begins.
 
Constructor Summary
Segment()
          Creates a new segment.
Segment(char[] array, int offset, int count)
          Creates a new segment referring to an existing array.
 
Method Summary
 String toString()
          Converts a segment into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

array

public char[] array
This is the array containing the text of interest. This array should never be modified; it is available only for efficiency.

offset

public int offset
This is the offset into the array that the desired text begins.

count

public int count
This is the number of array elements that make up the text of interest.
Constructor Detail

Segment

public Segment()
Creates a new segment.

Segment

public Segment(char[] array,
               int offset,
               int count)
Creates a new segment referring to an existing array.
Parameters:
array - the array to refer to
offset - the offset into the array
count - the number of characters
Method Detail

toString

public String toString()
Converts a segment into a String.
Overrides:
toString in class Object
Returns:
the string

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.