java.lang.CharSequence翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--NewPage-->

<HTML>

<HEAD>

<!-- Generated by javadoc (build 1.4.2-rc) on Fri Jun 13 00:14:17 PDT 2003 -->

<TITLE>

CharSequence (Java 2 Platform SE v1.4.2)

</TITLE>

<META NAME="keywords" CONTENT="java.lang.CharSequence interface">

<META NAME="keywords" CONTENT="length()">

<META NAME="keywords" CONTENT="charAt()">

<META NAME="keywords" CONTENT="subSequence()">

<META NAME="keywords" CONTENT="toString()">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">

function windowTitle()

{

parent.document.title="CharSequence (Java 2 Platform SE v1.4.2)";

}

</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">

<!-- ========= START OF TOP NAVBAR ======= -->

<A NAME="navbar_top"><!-- --></A>

<A HREF="#skip-navbar_top" title="Skip navigation links"></A>

<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">

<TR>

<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">

<A NAME="navbar_top_firstrow"><!-- --></A>

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">

<TR ALIGN="center" VALIGN="top">

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CharSequence.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>

</TR>

</TABLE>

</TD>

<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>

<b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.4.2</b></EM>

</TD>

</TR>

<TR>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

&nbsp;PREV CLASS&nbsp;

&nbsp;<A HREF="../../java/lang/Cloneable.html" title="interface in java.lang"><B>NEXT CLASS</B></A></FONT></TD>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

<A HREF="../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;

&nbsp;<A HREF="CharSequence.html" target="_top"><B>NO FRAMES</B></A> &nbsp;

&nbsp;<SCRIPT type="text/javascript">

<!--

if(window==top) {

document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');

}

//-->

</SCRIPT>

<NOSCRIPT>

<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>

</NOSCRIPT>

</FONT></TD>

</TR>

<TR>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>

</TR>

</TABLE>

<A NAME="skip-navbar_top"></A>

<!-- ========= END OF TOP NAVBAR ========= -->

<HR>

<!-- ======== START OF CLASS DATA ======== -->

<H2>

<FONT SIZE="-1">

java.lang</FONT>

<BR>

Interface CharSequence</H2>

<DL>

<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../java/nio/CharBuffer.html" title="class in java.nio">CharBuffer</A>, <A HREF="../../java/lang/String.html" title="class in java.lang">String</A>, <A HREF="../../java/lang/StringBuffer.html" title="class in java.lang">StringBuffer</A></DD>

</DL>

<HR>

<DL>

<DT>public interface <B>CharSequence</B></DL>

<P>

A <tt>CharSequence</tt> is a readable sequence of characters. This

interface provides uniform, read-only access to many different kinds of

character sequences.

CharSequence用作只读的字符序列,该接口提供了多种不同字符序列的统一访问方式。

<p> This interface does not refine the general contracts of the <A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>equals</CODE></A> and <A HREF="../../java/lang/Object.html#hashCode()"><CODE>hashCode</CODE></A> methods. The result of comparing two

objects that implement <tt>CharSequence</tt> is therefore, in general,

undefined. Each object may be implemented by a different class, and there

is no guarantee that each class will be capable of testing its instances

for equality with those of the other. It is therefore inappropriate to use

arbitrary <tt>CharSequence</tt> instances as elements in a set or as keys in

a map.

该接口没有重新定义通用的equals和hashCode方法,因此没有对实现CharSequence的两个对象进行比较的结果给出定义。

每个对象可能由不同的类实现,因此不能随意的对两个对象进行比较,所以将CharSequence的实例

作为set的元素或者map的关键字都是不合适的。

</p>

<P>

<P>

<DL>

<DT><B>Since:</B></DT>

<DD>1.4</DD>

</DL>

<HR>

<P>

<!-- ======== NESTED CLASS SUMMARY ======== -->

<!-- =========== FIELD SUMMARY =========== -->

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

<TD COLSPAN=2><FONT SIZE="+2">

<B>Method Summary</B></FONT></TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;char</CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/lang/CharSequence.html#charAt(int)">charAt</A></B>(int&nbsp;index)</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the character at the specified index.返回指定下标的字符。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;int</CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/lang/CharSequence.html#length()">length</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the length of this character sequence.返回该字符序列的长度。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;<A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A></CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/lang/CharSequence.html#subSequence(int, int)">subSequence</A></B>(int&nbsp;start,

int&nbsp;end)</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a new character sequence that is a subsequence of this sequence.

返回该字符序列的子序列。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;<A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/lang/CharSequence.html#toString()">toString</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a string containing the characters in this sequence in the same

order as this sequence.

将该字符序列按相同顺序转换成字符串。</TD>

</TR>

</TABLE>

&nbsp;

<P>

<!-- ============ FIELD DETAIL =========== -->

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

<TD COLSPAN=1><FONT SIZE="+2">

<B>Method Detail</B></FONT></TD>

</TR>

</TABLE>

<A NAME="length()"><!-- --></A><H3>

length</H3>

<PRE>

public int <B>length</B>()</PRE>

<DL>

<DD>Returns the length of this character sequence. The length is the number

of 16-bit Unicode characters in the sequence.

返回字符序列的长度,此长度指的是字符序列中16比特的Unicode字符数。</p>

<P>

<DD><DL>

<DT><B>Returns:</B><DD>the number of characters in this sequence

序列中的字符数</DL>

</DD>

</DL>

<HR>

<A NAME="charAt(int)"><!-- --></A><H3>

charAt</H3>

<PRE>

public char <B>charAt</B>(int&nbsp;index)</PRE>

<DL>

<DD>Returns the character at the specified index. An index ranges from zero

to <tt>length() - 1</tt>. The first character of the sequence is at

index zero, the next at index one, and so on, as for array

indexing. 返回指定下标处的字符。下标的范围从0到length()-1。第一个字符的下标为0,其次为1,以此类推。

</p>

<P>

<DD><DL>

<DT><B>Parameters:</B><DD><CODE>index</CODE> - the index of the character to be returned

被返回字符的下标

<DT><B>Returns:</B><DD>the specified character 指定字符

<DT><B>Throws:</B>

<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if the <tt>index</tt> argument is negative or not less than

<tt>length()</tt> 如果index参数为负或不小于length时抛出。</DL>

</DD>

</DL>

<HR>

<A NAME="subSequence(int, int)"><!-- --></A><H3>

subSequence</H3>

<PRE>

public <A HREF="../../java/lang/CharSequence.html" title="interface in java.lang">CharSequence</A> <B>subSequence</B>(int&nbsp;start,

int&nbsp;end)</PRE>

<DL>

<DD>Returns a new character sequence that is a subsequence of this sequence.

The subsequence starts with the character at the specified index and

ends with the character at index <tt>end - 1</tt>. The length of the

returned sequence is <tt>end - start</tt>, so if <tt>start == end</tt>

then an empty sequence is returned.

返回该字符序列的子序列。子序列由指定下标的字符开始,结束于下标为end-1的字符处。返回的序列长度

为end-start,因此如果start==end,返回空序列。</p>

<P>

<DD><DL>

<DT><B>Parameters:</B><DD><CODE>start</CODE> - the start index, inclusive

开始下标,含本下标处的字符<DD><CODE>end</CODE> - the end index, exclusive

结束下标,不含本下标处的字符

<DT><B>Returns:</B><DD>the specified subsequence 指定的子序列

<DT><B>Throws:</B>

<DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html" title="class in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>start</tt> or <tt>end</tt> are negative,

if <tt>end</tt> is greater than <tt>length()</tt>,

or if <tt>start</tt> is greater than <tt>end</tt>

如果start或end为负,end大于length,或者start大于end时抛出</DL>

</DD>

</DL>

<HR>

<A NAME="toString()"><!-- --></A><H3>

toString</H3>

<PRE>

public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toString</B>()</PRE>

<DL>

<DD>Returns a string containing the characters in this sequence in the same

order as this sequence. The length of the string will be the length of

this sequence.

将该字符序列按相同顺序转换成字符串。字符串的长度等于该序列的长度。</p>

<P>

<DD><DL>

<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>

</DD>

<DD><DL>

<DT><B>Returns:</B><DD>a string consisting of exactly this sequence of characters

包含该字符序列的字符串</DL>

</DD>

</DL>

<!-- ========= END OF CLASS DATA ========= -->

<HR>

<!-- ======= START OF BOTTOM NAVBAR ====== -->

<A NAME="navbar_bottom"><!-- --></A>

<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>

<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">

<TR>

<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">

<A NAME="navbar_bottom_firstrow"><!-- --></A>

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">

<TR ALIGN="center" VALIGN="top">

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CharSequence.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>

</TR>

</TABLE>

</TD>

<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>

<b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.4.2</b></EM>

</TD>

</TR>

<TR>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

&nbsp;PREV CLASS&nbsp;

&nbsp;<A HREF="../../java/lang/Cloneable.html" title="interface in java.lang"><B>NEXT CLASS</B></A></FONT></TD>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

<A HREF="../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;

&nbsp;<A HREF="CharSequence.html" target="_top"><B>NO FRAMES</B></A> &nbsp;

&nbsp;<SCRIPT type="text/javascript">

<!--

if(window==top) {

document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');

}

//-->

</SCRIPT>

<NOSCRIPT>

<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>

</NOSCRIPT>

</FONT></TD>

</TR>

<TR>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>

</TR>

</TABLE>

<A NAME="skip-navbar_bottom"></A>

<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

<font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../../../relnotes/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>

</BODY>

</HTML>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航