- 所有类 (Java 2 Platform SE 5.0)
- 已过时的 API
- 此 API 文档的组织方式
- 概述 (Java 2 Platform SE 5.0)
- Java 2 Platform 软件包
- 所有软件包的分层结构
- java.awt 接口 ActiveEvent
- java.awt 接口 Adjustable
- java.awt 类 AlphaComposite
- java.awt 类 AWTError
- java.awt 类 AWTEvent
- java.awt 类 AWTEventMulticaster
- java.awt 类 AWTException
- java.awt 类 AWTKeyStroke
- java.awt 类 AWTPermission
- java.awt 类 BasicStroke
- java.awt 类 BorderLayout
- java.awt 类 BufferCapabilities.FlipContents
- java.awt 类 BufferCapabilities
- java.awt 类 Button
- java.awt 类 Canvas
- java.awt 类 CardLayout
- java.awt 类 Checkbox
- java.awt 类 CheckboxGroup
- java.awt 类 CheckboxMenuItem
- java.awt 类 Choice
- java.awt 类 Color
- java.awt 类 Component
- java.awt 类 ComponentOrientation
- java.awt 接口 Composite
- java.awt 接口 CompositeContext
- java.awt 类 Container
- java.awt 类 ContainerOrderFocusTraversalPolicy
- java.awt 类 Cursor
- java.awt 类 DefaultFocusTraversalPolicy
- java.awt 类 DefaultKeyboardFocusManager
- java.awt 类 Dialog
- java.awt 类 Dimension
- java.awt 类 DisplayMode
- java.awt 类 Event
- java.awt 类 EventQueue
- java.awt 类 FileDialog
- java.awt 类 FlowLayout
- java.awt 类 FocusTraversalPolicy
- java.awt 类 Font
- java.awt 类 FontFormatException
- java.awt 类 FontMetrics
- java.awt 类 Frame
- java.awt 类 GradientPaint
- java.awt 类 Graphics
- java.awt 类 Graphics2D
- java.awt 类 GraphicsConfigTemplate
- java.awt 类 GraphicsConfiguration
- java.awt 类 GraphicsDevice
- java.awt 类 GraphicsEnvironment
- java.awt 类 GridBagConstraints
- java.awt 类 GridBagLayout
- java.awt 类 GridLayout
- java.awt 类 HeadlessException
- java.awt 类 IllegalComponentStateException
- java.awt 类 Image
- java.awt 类 ImageCapabilities
- java.awt 类 Insets
- java.awt 接口 ItemSelectable
- java.awt 类 JobAttributes.DefaultSelectionType
- java.awt 类 JobAttributes.DestinationType
- java.awt 类 JobAttributes.DialogType
- java.awt 类 JobAttributes
- java.awt 类 JobAttributes.MultipleDocumentHandlingType
- java.awt 类 JobAttributes.SidesType
- java.awt 类 KeyboardFocusManager
- java.awt 接口 KeyEventDispatcher
- java.awt 接口 KeyEventPostProcessor
- java.awt 类 Label
- java.awt 接口 LayoutManager
- java.awt 接口 LayoutManager2
- java.awt 类 List
- java.awt 类 MediaTracker
- java.awt 类 Menu
- java.awt 类 MenuBar
- java.awt 类 MenuComponent
- java.awt 接口 MenuContainer
- java.awt 类 MenuItem
- java.awt 类 MenuShortcut
- java.awt 类 MouseInfo
- java.awt (Java 2 Platform SE 5.0)
- 软件包 java.awt
- java.awt 类 PageAttributes.ColorType
- java.awt 类 PageAttributes
- java.awt 类 PageAttributes.MediaType
- java.awt 类 PageAttributes.OrientationRequestedType
- java.awt 类 PageAttributes.OriginType
- java.awt 类 PageAttributes.PrintQualityType
- java.awt 接口 Paint
- java.awt 接口 PaintContext
- java.awt 类 Panel
- java.awt 类 Point
- java.awt 类 PointerInfo
- java.awt 类 Polygon
- java.awt 类 PopupMenu
- java.awt 接口 PrintGraphics
- java.awt 类 PrintJob
- java.awt 类 Rectangle
- java.awt 类 RenderingHints
- java.awt 类 RenderingHints.Key
- java.awt 类 Robot
- java.awt 类 Scrollbar
- java.awt 类 ScrollPane
- java.awt 类 ScrollPaneAdjustable
- java.awt 接口 Shape
- java.awt 接口 Stroke
- java.awt 类 SystemColor
- java.awt 类 TextArea
- java.awt 类 TextComponent
- java.awt 类 TextField
- java.awt 类 TexturePaint
- java.awt 类 Toolkit
- java.awt 接口 Transparency
- java.awt 类 Window
- java.awt.color 类 CMMException
- java.awt.color 类 ColorSpace
- java.awt.color 类 ICC_ColorSpace
- java.awt.color 类 ICC_Profile
- java.awt.color 类 ICC_ProfileGray
- java.awt.color 类 ICC_ProfileRGB
- java.awt.color (Java 2 Platform SE 5.0)
- 软件包 java.awt.color
- java.awt.color 类 ProfileDataException
- java.awt.datatransfer 类 Clipboard
- java.awt.datatransfer 接口 ClipboardOwner
- java.awt.datatransfer 类 DataFlavor
- java.awt.datatransfer 类 FlavorEvent
- java.awt.datatransfer 接口 FlavorListener
- java.awt.datatransfer 接口 FlavorMap
- java.awt.datatransfer 接口 FlavorTable
- java.awt.datatransfer 类 MimeTypeParseException
- java.awt.datatransfer (Java 2 Platform SE 5.0)
- 软件包 java.awt.datatransfer
- java.awt.datatransfer 类 StringSelection
- java.awt.datatransfer 类 SystemFlavorMap
- java.awt.datatransfer 接口 Transferable
- java.awt.datatransfer 类 UnsupportedFlavorException
- java.awt.dnd 接口 Autoscroll
- java.awt.dnd 类 DnDConstants
- java.awt.dnd 类 DragGestureEvent
- java.awt.dnd 接口 DragGestureListener
- java.awt.dnd 类 DragGestureRecognizer
- java.awt.dnd 类 DragSource
- java.awt.dnd 类 DragSourceAdapter
- java.awt.dnd 类 DragSourceContext
- java.awt.dnd 类 DragSourceDragEvent
- java.awt.dnd 类 DragSourceDropEvent
- java.awt.dnd 类 DragSourceEvent
- java.awt.dnd 接口 DragSourceListener
- java.awt.dnd 接口 DragSourceMotionListener
- java.awt.dnd 类 DropTarget.DropTargetAutoScroller
- java.awt.dnd 类 DropTarget
- java.awt.dnd 类 DropTargetAdapter
- java.awt.dnd 类 DropTargetContext
- java.awt.dnd 类 DropTargetDragEvent
- java.awt.dnd 类 DropTargetDropEvent
- java.awt.dnd 类 DropTargetEvent
- java.awt.dnd 接口 DropTargetListener
- java.awt.dnd 类 InvalidDnDOperationException
- java.awt.dnd 类 MouseDragGestureRecognizer
- java.awt.dnd (Java 2 Platform SE 5.0)
- 软件包 java.awt.dnd
- java.awt.event 类 ActionEvent
- java.awt.event 接口 ActionListener
- java.awt.event 类 AdjustmentEvent
- java.awt.event 接口 AdjustmentListener
- java.awt.event 接口 AWTEventListener
- java.awt.event 类 AWTEventListenerProxy
- java.awt.event 类 ComponentAdapter
- java.awt.event 类 ComponentEvent
- java.awt.event 接口 ComponentListener
- java.awt.event 类 ContainerAdapter
- java.awt.event 类 ContainerEvent
- java.awt.event 接口 ContainerListener
- java.awt.event 类 FocusAdapter
- java.awt.event 类 FocusEvent
- java.awt.event 接口 FocusListener
- java.awt.event 类 HierarchyBoundsAdapter
- java.awt.event 接口 HierarchyBoundsListener
- java.awt.event 类 HierarchyEvent
- java.awt.event 接口 HierarchyListener
- java.awt.event 类 InputEvent
- java.awt.event 类 InputMethodEvent
- java.awt.event 接口 InputMethodListener
- java.awt.event 类 InvocationEvent
- java.awt.event 类 ItemEvent
- java.awt.event 接口 ItemListener
- java.awt.event 类 KeyAdapter
- java.awt.event 类 KeyEvent
- java.awt.event 接口 KeyListener
- java.awt.event 类 MouseAdapter
- java.awt.event 类 MouseEvent
- java.awt.event 接口 MouseListener
- java.awt.event 类 MouseMotionAdapter
- java.awt.event 接口 MouseMotionListener
- java.awt.event 类 MouseWheelEvent
- java.awt.event 接口 MouseWheelListener
- java.awt.event (Java 2 Platform SE 5.0)
- 软件包 java.awt.event
- java.awt.event 类 PaintEvent
- java.awt.event 类 TextEvent
- java.awt.event 接口 TextListener
- java.awt.event 类 WindowAdapter
- java.awt.event 类 WindowEvent
- java.awt.event 接口 WindowFocusListener
- java.awt.event 接口 WindowListener
- java.awt.event 接口 WindowStateListener
- java.awt.font 类 FontRenderContext
- java.awt.font 类 GlyphJustificationInfo
- java.awt.font 类 GlyphMetrics
- java.awt.font 类 GlyphVector
- java.awt.font 类 GraphicAttribute
- java.awt.font 类 ImageGraphicAttribute
- java.awt.font 类 LineBreakMeasurer
- java.awt.font 类 LineMetrics
- java.awt.font 接口 MultipleMaster
- java.awt.font 类 NumericShaper
- java.awt.font 接口 OpenType
- java.awt.font (Java 2 Platform SE 5.0)
- 软件包 java.awt.font
- java.awt.font 类 ShapeGraphicAttribute
- java.awt.font 类 TextAttribute
- java.awt.font 类 TextHitInfo
- java.awt.font 类 TextLayout.CaretPolicy
- java.awt.font 类 TextLayout
- java.awt.font 类 TextMeasurer
- java.awt.font 类 TransformAttribute
- java.awt.geom 类 AffineTransform
- java.awt.geom 类 Arc2D.Double
- java.awt.geom 类 Arc2D.Float
- java.awt.geom 类 Arc2D
- java.awt.geom 类 Area
- java.awt.geom 类 CubicCurve2D.Double
- java.awt.geom 类 CubicCurve2D.Float
- java.awt.geom 类 CubicCurve2D
- java.awt.geom 类 Dimension2D
- java.awt.geom 类 Ellipse2D.Double
- java.awt.geom 类 Ellipse2D.Float
- java.awt.geom 类 Ellipse2D
- java.awt.geom 类 FlatteningPathIterator
- java.awt.geom 类 GeneralPath
- java.awt.geom 类 IllegalPathStateException
- java.awt.geom 类 Line2D.Double
- java.awt.geom 类 Line2D.Float
- java.awt.geom 类 Line2D
- java.awt.geom 类 NoninvertibleTransformException
- java.awt.geom (Java 2 Platform SE 5.0)
- 软件包 java.awt.geom
- java.awt.geom 接口 PathIterator
- java.awt.geom 类 Point2D.Double
- java.awt.geom 类 Point2D.Float
- java.awt.geom 类 Point2D
- java.awt.geom 类 QuadCurve2D.Double
- java.awt.geom 类 QuadCurve2D.Float
- java.awt.geom 类 QuadCurve2D
- java.awt.geom 类 Rectangle2D.Double
- java.awt.geom 类 Rectangle2D.Float
- java.awt.geom 类 Rectangle2D
- java.awt.geom 类 RectangularShape
- java.awt.geom 类 RoundRectangle2D.Double
- java.awt.geom 类 RoundRectangle2D.Float
- java.awt.geom 类 RoundRectangle2D
- java.awt.im 类 InputContext
- java.awt.im 类 InputMethodHighlight
- java.awt.im 接口 InputMethodRequests
- java.awt.im 类 InputSubset
- java.awt.im (Java 2 Platform SE 5.0)
- 软件包 java.awt.im
- java.awt.im.spi 接口 InputMethod
- java.awt.im.spi 接口 InputMethodContext
- java.awt.im.spi 接口 InputMethodDescriptor
- java.awt.im.spi (Java 2 Platform SE 5.0)
- 软件包 java.awt.im.spi
- java.awt.image 类 AffineTransformOp
- java.awt.image 类 AreaAveragingScaleFilter
- java.awt.image 类 BandCombineOp
- java.awt.image 类 BandedSampleModel
- java.awt.image 类 BufferedImage
- java.awt.image 类 BufferedImageFilter
- java.awt.image 接口 BufferedImageOp
- java.awt.image 类 BufferStrategy
- java.awt.image 类 ByteLookupTable
- java.awt.image 类 ColorConvertOp
- java.awt.image 类 ColorModel
- java.awt.image 类 ComponentColorModel
- java.awt.image 类 ComponentSampleModel
- java.awt.image 类 ConvolveOp
- java.awt.image 类 CropImageFilter
- java.awt.image 类 DataBuffer
- java.awt.image 类 DataBufferByte
- java.awt.image 类 DataBufferDouble
- java.awt.image 类 DataBufferFloat
- java.awt.image 类 DataBufferInt
- java.awt.image 类 DataBufferShort
- java.awt.image 类 DataBufferUShort
- java.awt.image 类 DirectColorModel
- java.awt.image 类 FilteredImageSource
- java.awt.image 接口 ImageConsumer
- java.awt.image 类 ImageFilter
- java.awt.image 接口 ImageObserver
- java.awt.image 接口 ImageProducer
- java.awt.image 类 ImagingOpException
- java.awt.image 类 IndexColorModel
- java.awt.image 类 Kernel
- java.awt.image 类 LookupOp
- java.awt.image 类 LookupTable
- java.awt.image 类 MemoryImageSource
- java.awt.image 类 MultiPixelPackedSampleModel
- java.awt.image (Java 2 Platform SE 5.0)
- 软件包 java.awt.image
- java.awt.image 类 PackedColorModel
- java.awt.image 类 PixelGrabber
- java.awt.image 类 PixelInterleavedSampleModel
- java.awt.image 类 Raster
- java.awt.image 类 RasterFormatException
- java.awt.image 接口 RasterOp
- java.awt.image 接口 RenderedImage
- java.awt.image 类 ReplicateScaleFilter
- java.awt.image 类 RescaleOp
- java.awt.image 类 RGBImageFilter
- java.awt.image 类 SampleModel
- java.awt.image 类 ShortLookupTable
- java.awt.image 类 SinglePixelPackedSampleModel
- java.awt.image 接口 TileObserver
- java.awt.image 类 VolatileImage
- java.awt.image 类 WritableRaster
- java.awt.image 接口 WritableRenderedImage
- java.awt.image.renderable 接口 ContextualRenderedImageFactory
- java.awt.image.renderable (Java 2 Platform SE 5.0)
- 软件包 java.awt.image.renderable
- java.awt.image.renderable 类 ParameterBlock
- java.awt.image.renderable 接口 RenderableImage
- java.awt.image.renderable 类 RenderableImageOp
- java.awt.image.renderable 类 RenderableImageProducer
- java.awt.image.renderable 类 RenderContext
- java.awt.image.renderable 接口 RenderedImageFactory
- java.awt.print 类 Book
- java.awt.print (Java 2 Platform SE 5.0)
- 软件包 java.awt.print
- java.awt.print 接口 Pageable
- java.awt.print 类 PageFormat
- java.awt.print 类 Paper
- java.awt.print 接口 Printable
- java.awt.print 类 PrinterAbortException
- java.awt.print 类 PrinterException
- java.awt.print 接口 PrinterGraphics
- java.awt.print 类 PrinterIOException
- java.awt.print 类 PrinterJob
- java.io 类 BufferedInputStream
- java.io 类 BufferedOutputStream
- java.io 类 BufferedReader
- java.io 类 BufferedWriter
- java.io 类 ByteArrayInputStream
- java.io 类 ByteArrayOutputStream
- java.io 类 CharArrayReader
- java.io 类 CharArrayWriter
- java.io 类 CharConversionException
- java.io 接口 Closeable
- java.io 接口 DataInput
- java.io 类 DataInputStream
- java.io 接口 DataOutput
- java.io 类 DataOutputStream
- java.io 类 EOFException
- java.io 接口 Externalizable
- java.io 类 File
- java.io 类 FileDescriptor
- java.io 接口 FileFilter
- java.io 类 FileInputStream
- java.io 接口 FilenameFilter
- java.io 类 FileNotFoundException
- java.io 类 FileOutputStream
- java.io 类 FilePermission
- java.io 类 FileReader
- java.io 类 FileWriter
- java.io 类 FilterInputStream
- java.io 类 FilterOutputStream
- java.io 类 FilterReader
- java.io 类 FilterWriter
- java.io 接口 Flushable
- java.io 类 InputStream
- java.io 类 InputStreamReader
- java.io 类 InterruptedIOException
- java.io 类 InvalidClassException
- java.io 类 InvalidObjectException
- java.io 类 IOException
- java.io 类 LineNumberInputStream
- java.io 类 LineNumberReader
- java.io 类 NotActiveException
- java.io 类 NotSerializableException
- java.io 接口 ObjectInput
- java.io 类 ObjectInputStream.GetField
- java.io 类 ObjectInputStream
- java.io 接口 ObjectInputValidation
- java.io 接口 ObjectOutput
- java.io 类 ObjectOutputStream
- java.io 类 ObjectOutputStream.PutField
- java.io 类 ObjectStreamClass
- java.io 接口 ObjectStreamConstants
- java.io 类 ObjectStreamException
- java.io 类 ObjectStreamField
- java.io 类 OptionalDataException
- java.io 类 OutputStream
- java.io 类 OutputStreamWriter
- java.io (Java 2 Platform SE 5.0)
- 软件包 java.io
- java.io 类 PipedInputStream
- java.io 类 PipedOutputStream
- java.io 类 PipedReader
- java.io 类 PipedWriter
- java.io 类 PrintStream
- java.io 类 PrintWriter
- java.io 类 PushbackInputStream
- java.io 类 PushbackReader
- java.io 类 RandomAccessFile
- java.io 类 Reader
- java.io 类 SequenceInputStream
- java.io 接口 Serializable
- java.io 类 SerializablePermission
- java.io 类 StreamCorruptedException
- java.io 类 StreamTokenizer
- java.io 类 StringBufferInputStream
- java.io 类 StringReader
- java.io 类 StringWriter
- java.io 类 SyncFailedException
- java.io 类 UnsupportedEncodingException
- java.io 类 UTFDataFormatException
- java.io 类 WriteAbortedException
- java.io 类 Writer
- java.lang 类 AbstractMethodError
- java.lang 接口 Appendable
- java.lang 类 ArithmeticException
- java.lang 类 ArrayIndexOutOfBoundsException
- java.lang 类 ArrayStoreException
- java.lang 类 AssertionError
- java.lang 类 Boolean
- java.lang 类 Byte
- java.lang 类 Character
- java.lang 类 Character.Subset
- java.lang 类 Character.UnicodeBlock
- java.lang 接口 CharSequence
- java.lang 类 Class<T>
- java.lang 类 ClassCastException
- java.lang 类 ClassCircularityError
- java.lang 类 ClassFormatError
- java.lang 类 ClassLoader
- java.lang 类 ClassNotFoundException
- java.lang 接口 Cloneable
- java.lang 类 CloneNotSupportedException
- java.lang 接口 Comparable<T>
- java.lang 类 Compiler
- java.lang 注释类型 Deprecated
- java.lang 类 Double
- java.lang 类 Enum<E extends Enum<E>>
- java.lang 类 EnumConstantNotPresentException
- java.lang 类 Error
- java.lang 类 Exception
- java.lang 类 ExceptionInInitializerError
- java.lang 类 Float
- java.lang 类 IllegalAccessError
- java.lang 类 IllegalAccessException
- java.lang 类 IllegalArgumentException
- java.lang 类 IllegalMonitorStateException
- java.lang 类 IllegalStateException
- java.lang 类 IllegalThreadStateException
- java.lang 类 IncompatibleClassChangeError
- java.lang 类 IndexOutOfBoundsException
- java.lang 类 InheritableThreadLocal<T>
- java.lang 类 InstantiationError
- java.lang 类 InstantiationException
- java.lang 类 Integer
- java.lang 类 InternalError
- java.lang 类 InterruptedException
- java.lang 接口 Iterable<T>
- java.lang 类 LinkageError
- java.lang 类 Long
- java.lang 类 Math
- java.lang 类 NegativeArraySizeException
- java.lang 类 NoClassDefFoundError
- java.lang 类 NoSuchFieldError
- java.lang 类 NoSuchFieldException
- java.lang 类 NoSuchMethodError
- java.lang 类 NoSuchMethodException
- java.lang 类 NullPointerException
- java.lang 类 Number
- java.lang 类 NumberFormatException
- java.lang 类 Object
- java.lang 类 OutOfMemoryError
- java.lang 注释类型 Override
- java.lang (Java 2 Platform SE 5.0)
- 软件包 java.lang
- java.lang 类 Package
- java.lang 类 Process
- java.lang 类 ProcessBuilder
- java.lang 接口 Readable
- java.lang 接口 Runnable
- java.lang 类 Runtime
- java.lang 类 RuntimeException
- java.lang 类 RuntimePermission
- java.lang 类 SecurityException
- java.lang 类 SecurityManager
- java.lang 类 Short
- java.lang 类 StackOverflowError
- java.lang 类 StackTraceElement
- java.lang 类 StrictMath
- java.lang 类 String
- java.lang 类 StringBuffer
- java.lang 类 StringBuilder
- java.lang 类 StringIndexOutOfBoundsException
- java.lang 注释类型 SuppressWarnings
- java.lang 类 System
- java.lang 类 Thread
- java.lang 枚举 Thread.State
- java.lang 接口 Thread.UncaughtExceptionHandler
- java.lang 类 ThreadDeath
- java.lang 类 ThreadGroup
- java.lang 类 ThreadLocal<T>
- java.lang 类 Throwable
- java.lang 类 TypeNotPresentException
- java.lang 类 UnknownError
- java.lang 类 UnsatisfiedLinkError
- java.lang 类 UnsupportedClassVersionError
- java.lang 类 UnsupportedOperationException
- java.lang 类 VerifyError
- java.lang 类 VirtualMachineError
- java.lang 类 Void
- java.lang.annotation 接口 Annotation
- java.lang.annotation 类 AnnotationFormatError
- java.lang.annotation 类 AnnotationTypeMismatchException
- java.lang.annotation 注释类型 Documented
- java.lang.annotation 枚举 ElementType
- java.lang.annotation 类 IncompleteAnnotationException
- java.lang.annotation 注释类型 Inherited
- java.lang.annotation (Java 2 Platform SE 5.0)
- 软件包 java.lang.annotation
- java.lang.annotation 注释类型 Retention
- java.lang.annotation 枚举 RetentionPolicy
- java.lang.annotation 注释类型 Target
- java.lang.instrument 类 ClassDefinition
- java.lang.instrument 接口 ClassFileTransformer
- java.lang.instrument 类 IllegalClassFormatException
- java.lang.instrument 接口 Instrumentation
- java.lang.instrument (Java 2 Platform SE 5.0)
- 软件包 java.lang.instrument
- java.lang.instrument 类 UnmodifiableClassException
- java.lang.management 接口 ClassLoadingMXBean
- java.lang.management 接口 CompilationMXBean
- java.lang.management 接口 GarbageCollectorMXBean
- java.lang.management 类 ManagementFactory
- java.lang.management 类 ManagementPermission
- java.lang.management 接口 MemoryManagerMXBean
- java.lang.management 接口 MemoryMXBean
- java.lang.management 类 MemoryNotificationInfo
- java.lang.management 接口 MemoryPoolMXBean
- java.lang.management 枚举 MemoryType
- java.lang.management 类 MemoryUsage
- java.lang.management 接口 OperatingSystemMXBean
- java.lang.management (Java 2 Platform SE 5.0)
- 软件包 java.lang.management
- java.lang.management 接口 RuntimeMXBean
- java.lang.management 类 ThreadInfo
- java.lang.management 接口 ThreadMXBean
- java.lang.ref (Java 2 Platform SE 5.0)
- 软件包 java.lang.ref
- java.lang.ref 类 PhantomReference<T>
- java.lang.ref 类 Reference<T>
- java.lang.ref 类 ReferenceQueue<T>
- java.lang.ref 类 SoftReference<T>
- java.lang.ref 类 WeakReference<T>
- java.lang.reflect 类 AccessibleObject
- java.lang.reflect 接口 AnnotatedElement
- java.lang.reflect 类 Array
- java.lang.reflect 类 Constructor<T>
- java.lang.reflect 类 Field
- java.lang.reflect 接口 GenericArrayType
- java.lang.reflect 接口 GenericDeclaration
- java.lang.reflect 类 GenericSignatureFormatError
- java.lang.reflect 接口 InvocationHandler
- java.lang.reflect 类 InvocationTargetException
- java.lang.reflect 类 MalformedParameterizedTypeException
- java.lang.reflect 接口 Member
- java.lang.reflect 类 Method
- java.lang.reflect 类 Modifier
- java.lang.reflect (Java 2 Platform SE 5.0)
- 软件包 java.lang.reflect
- java.lang.reflect 接口 ParameterizedType
- java.lang.reflect 类 Proxy
- java.lang.reflect 类 ReflectPermission
- java.lang.reflect 接口 Type
- java.lang.reflect 接口 TypeVariable<D extends GenericDeclaration>
- java.lang.reflect 类 UndeclaredThrowableException
- java.lang.reflect 接口 WildcardType
- java.text 类 Annotation
- java.text 类 AttributedCharacterIterator.Attribute
- java.text 接口 AttributedCharacterIterator
- java.text 类 AttributedString
- java.text 类 Bidi
- java.text 类 BreakIterator
- java.text 接口 CharacterIterator
- java.text 类 ChoiceFormat
- java.text 类 CollationElementIterator
- java.text 类 CollationKey
- java.text 类 Collator
- java.text 类 DateFormat.Field
- java.text 类 DateFormat
- java.text 类 DateFormatSymbols
- java.text 类 DecimalFormat
- java.text 类 DecimalFormatSymbols
- java.text 类 FieldPosition
- java.text 类 Format.Field
- java.text 类 Format
- java.text 类 MessageFormat.Field
- java.text 类 MessageFormat
- java.text 类 NumberFormat.Field
- java.text 类 NumberFormat
- java.text (Java 2 Platform SE 5.0)
- 软件包 java.text
- java.text 类 ParseException
- java.text 类 ParsePosition
- java.text 类 RuleBasedCollator
- java.text 类 SimpleDateFormat
- java.text 类 StringCharacterIterator
- java.util 类 AbstractCollection<E>
- java.util 类 AbstractList<E>
- java.util 类 AbstractMap<K,V>
- java.util 类 AbstractQueue<E>
- java.util 类 AbstractSequentialList<E>
- java.util 类 AbstractSet<E>
- java.util 类 ArrayList<E>
- java.util 类 Arrays
- java.util 类 BitSet
- java.util 类 Calendar
- java.util 接口 Collection<E>
- java.util 类 Collections
- java.util 接口 Comparator<T>
- java.util 类 ConcurrentModificationException
- java.util 类 Currency
- java.util 类 Date
- java.util 类 Dictionary<K,V>
- java.util 类 DuplicateFormatFlagsException
- java.util 类 EmptyStackException
- java.util 接口 Enumeration<E>
- java.util 类 EnumMap<K extends Enum<K>,V>
- java.util 类 EnumSet<E extends Enum<E>>
- java.util 接口 EventListener
- java.util 类 EventListenerProxy
- java.util 类 EventObject
- java.util 类 FormatFlagsConversionMismatchException
- java.util 接口 Formattable
- java.util 类 FormattableFlags
- java.util 枚举 Formatter.BigDecimalLayoutForm
- java.util 类 Formatter
- java.util 类 FormatterClosedException
- java.util 类 GregorianCalendar
- java.util 类 HashMap<K,V>
- java.util 类 HashSet<E>
- java.util 类 Hashtable<K,V>
- java.util 类 IdentityHashMap<K,V>
- java.util 类 IllegalFormatCodePointException
- java.util 类 IllegalFormatConversionException
- java.util 类 IllegalFormatException
- java.util 类 IllegalFormatFlagsException
- java.util 类 IllegalFormatPrecisionException
- java.util 类 IllegalFormatWidthException
- java.util 类 InputMismatchException
- java.util 类 InvalidPropertiesFormatException
- java.util 接口 Iterator<E>
- java.util 类 LinkedHashMap<K,V>
- java.util 类 LinkedHashSet<E>
- java.util 类 LinkedList<E>
- java.util 接口 List<E>
- java.util 接口 ListIterator<E>
- java.util 类 ListResourceBundle
- java.util 类 Locale
- java.util 接口 Map.Entry<K,V>
- java.util 接口 Map<K,V>
- java.util 类 MissingFormatArgumentException
- java.util 类 MissingFormatWidthException
- java.util 类 MissingResourceException
- java.util 类 NoSuchElementException
- java.util 类 Observable
- java.util 接口 Observer
- java.util (Java 2 Platform SE 5.0)
- 软件包 java.util
- java.util 类 PriorityQueue<E>
- java.util 类 Properties
- java.util 类 PropertyPermission
- java.util 类 PropertyResourceBundle
- java.util 接口 Queue<E>
- java.util 类 Random
- java.util 接口 RandomAccess
- java.util 类 ResourceBundle
- java.util 类 Scanner
- java.util 接口 Set<E>
- java.util 类 SimpleTimeZone
- java.util 接口 SortedMap<K,V>
- java.util 接口 SortedSet<E>
- java.util 类 Stack<E>
- java.util 类 StringTokenizer
- java.util 类 Timer
- java.util 类 TimerTask
- java.util 类 TimeZone
- java.util 类 TooManyListenersException
- java.util 类 TreeMap<K,V>
- java.util 类 TreeSet<E>
- java.util 类 UnknownFormatConversionException
- java.util 类 UnknownFormatFlagsException
- java.util 类 UUID
- java.util 类 Vector<E>
- java.util 类 WeakHashMap<K,V>
- java.util.concurrent 类 AbstractExecutorService
- java.util.concurrent 类 ArrayBlockingQueue<E>
- java.util.concurrent 接口 BlockingQueue<E>
- java.util.concurrent 类 BrokenBarrierException
- java.util.concurrent 接口 Callable<V>
- java.util.concurrent 类 CancellationException
- java.util.concurrent 接口 CompletionService<V>
- java.util.concurrent 类 ConcurrentHashMap<K,V>
- java.util.concurrent 类 ConcurrentLinkedQueue<E>
- java.util.concurrent 接口 ConcurrentMap<K,V>
- java.util.concurrent 类 CopyOnWriteArrayList<E>
- java.util.concurrent 类 CopyOnWriteArraySet<E>
- java.util.concurrent 类 CountDownLatch
- java.util.concurrent 类 CyclicBarrier
- java.util.concurrent 接口 Delayed
- java.util.concurrent 类 DelayQueue<E extends Delayed>
- java.util.concurrent 类 Exchanger<V>
- java.util.concurrent 类 ExecutionException
- java.util.concurrent 接口 Executor
- java.util.concurrent 类 ExecutorCompletionService<V>
- java.util.concurrent 类 Executors
- java.util.concurrent 接口 ExecutorService
- java.util.concurrent 接口 Future<V>
- java.util.concurrent 类 FutureTask<V>
- java.util.concurrent 类 LinkedBlockingQueue<E>
- java.util.concurrent (Java 2 Platform SE 5.0)
- 软件包 java.util.concurrent
- java.util.concurrent 类 PriorityBlockingQueue<E>
- java.util.concurrent 类 RejectedExecutionException
- java.util.concurrent 接口 RejectedExecutionHandler
- java.util.concurrent 接口 ScheduledExecutorService
- java.util.concurrent 接口 ScheduledFuture<V>
- java.util.concurrent 类 ScheduledThreadPoolExecutor
- java.util.concurrent 类 Semaphore
- java.util.concurrent 类 SynchronousQueue<E>
- java.util.concurrent 接口 ThreadFactory
- java.util.concurrent 类 ThreadPoolExecutor.AbortPolicy
- java.util.concurrent 类 ThreadPoolExecutor.CallerRunsPolicy
- java.util.concurrent 类 ThreadPoolExecutor.DiscardOldestPolicy
- java.util.concurrent 类 ThreadPoolExecutor.DiscardPolicy
- java.util.concurrent 类 ThreadPoolExecutor
- java.util.concurrent 类 TimeoutException
- java.util.concurrent 枚举 TimeUnit
- java.util.concurrent.atomic 类 AtomicBoolean
- java.util.concurrent.atomic 类 AtomicInteger
- java.util.concurrent.atomic 类 AtomicIntegerArray
- java.util.concurrent.atomic 类 AtomicIntegerFieldUpdater<T>
- java.util.concurrent.atomic 类 AtomicLong
- java.util.concurrent.atomic 类 AtomicLongArray
- java.util.concurrent.atomic 类 AtomicLongFieldUpdater<T>
- java.util.concurrent.atomic 类 AtomicMarkableReference<V>
- java.util.concurrent.atomic 类 AtomicReference<V>
- java.util.concurrent.atomic 类 AtomicReferenceArray<E>
- java.util.concurrent.atomic 类 AtomicReferenceFieldUpdater<T,V>
- java.util.concurrent.atomic 类 AtomicStampedReference<V>
- java.util.concurrent.atomic (Java 2 Platform SE 5.0)
- 软件包 java.util.concurrent.atomic
- java.util.concurrent.locks 类 AbstractQueuedSynchronizer
- java.util.concurrent.locks 接口 Condition
- java.util.concurrent.locks 接口 Lock
- java.util.concurrent.locks 类 LockSupport
- java.util.concurrent.locks (Java 2 Platform SE 5.0)
- 软件包 java.util.concurrent.locks
- java.util.concurrent.locks 接口 ReadWriteLock
- java.util.concurrent.locks 类 ReentrantLock
- java.util.concurrent.locks 类 ReentrantReadWriteLock
- java.util.concurrent.locks 类 ReentrantReadWriteLock.ReadLock
- java.util.concurrent.locks 类 ReentrantReadWriteLock.WriteLock
- java.util.jar 类 Attributes
- java.util.jar 类 Attributes.Name
- java.util.jar 类 JarEntry
- java.util.jar 类 JarException
- java.util.jar 类 JarFile
- java.util.jar 类 JarInputStream
- java.util.jar 类 JarOutputStream
- java.util.jar 类 Manifest
- java.util.jar 类 Pack200
- java.util.jar 接口 Pack200.Packer
- java.util.jar 接口 Pack200.Unpacker
- java.util.jar (Java 2 Platform SE 5.0)
- 软件包 java.util.jar
- java.util.logging 类 ConsoleHandler
- java.util.logging 类 ErrorManager
- java.util.logging 类 FileHandler
- java.util.logging 接口 Filter
- java.util.logging 类 Formatter
- java.util.logging 类 Handler
- java.util.logging 类 Level
- java.util.logging 类 Logger
- java.util.logging 接口 LoggingMXBean
- java.util.logging 类 LoggingPermission
- java.util.logging 类 LogManager
- java.util.logging 类 LogRecord
- java.util.logging 类 MemoryHandler
- java.util.logging (Java 2 Platform SE 5.0)
- 软件包 java.util.logging
- java.util.logging 类 SimpleFormatter
- java.util.logging 类 SocketHandler
- java.util.logging 类 StreamHandler
- java.util.logging 类 XMLFormatter
- java.util.prefs 类 AbstractPreferences
- java.util.prefs 类 BackingStoreException
- java.util.prefs 类 InvalidPreferencesFormatException
- java.util.prefs 类 NodeChangeEvent
- java.util.prefs 接口 NodeChangeListener
- java.util.prefs (Java 2 Platform SE 5.0)
- 软件包 java.util.prefs
- java.util.prefs 类 PreferenceChangeEvent
- java.util.prefs 接口 PreferenceChangeListener
- java.util.prefs 类 Preferences
- java.util.prefs 接口 PreferencesFactory
- java.util.regex 类 Matcher
- java.util.regex 接口 MatchResult
- java.util.regex (Java 2 Platform SE 5.0)
- 软件包 java.util.regex
- java.util.regex 类 Pattern
- java.util.regex 类 PatternSyntaxException
- java.util.zip 类 Adler32
- java.util.zip 类 CheckedInputStream
- java.util.zip 类 CheckedOutputStream
- java.util.zip 接口 Checksum
- java.util.zip 类 CRC32
- java.util.zip 类 DataFormatException
- java.util.zip 类 Deflater
- java.util.zip 类 DeflaterOutputStream
- java.util.zip 类 GZIPInputStream
- java.util.zip 类 GZIPOutputStream
- java.util.zip 类 Inflater
- java.util.zip 类 InflaterInputStream
- java.util.zip (Java 2 Platform SE 5.0)
- 软件包 java.util.zip
- java.util.zip 类 ZipEntry
- java.util.zip 类 ZipException
- java.util.zip 类 ZipFile
- java.util.zip 类 ZipInputStream
- java.util.zip 类 ZipOutputStream
java.lang 类 StringBuilder
java.lang.Object └java.lang.StringBuilder
- 所有已实现的接口:
- Serializable, Appendable, CharSequence
public final class StringBuilder
- extends Object
- implements Serializable, CharSequence
一个可变的字符序列。此类提供一个与 StringBuffer
兼容的 API,但不保证同步。该类被设计用作 StringBuffer
的一个简易替换,用在字符串缓冲区被单个线程使用的时候(这种情况很普遍)。如果可能,建议优先采用该类,因为在大多数实现中,它比 StringBuffer
要快。
在 StringBuilder
上的主要操作是 append
和 insert
方法,可重载这些方法,以接受任意类型的数据。每个方法都能有效地将给定的数据转换成字符串,然后将该字符串的字符追加或插入到字符串生成器中。 append
方法始终将这些字符添加到生成器的末端;而 insert
方法则在指定的点添加字符。
例如,如果 z
引用一个当前内容为“ start
”的字符串生成器对象,则该方法调用 z.append("le")
将使字符串生成器包含“ startle
”,而 z.insert(4, "le")
将更改字符串生成器,使之包含“ starlet
”。
通常,如果 sb 引用 StringBuilder
的实例,则 sb.append(x)
和 sb.insert(sb.length(),x)
具有相同的效果。 每个字符串生成器都有一定的容量。只要字符串生成器所包含的字符序列的长度没有超出此容量,就无需分配新的内部缓冲区。如果内部缓冲区溢出,则此容量自动增大。
将 StringBuilder
的实例用于多个线程是不安全的。如果需要这样的同步,则建议使用 StringBuffer
。
- 从以下版本开始:
- 1.5
- 另请参见:
StringBuffer
,String
, 序列化表格
构造方法摘要 | |
---|---|
StringBuilder() 构造一个其中不带字符的字符串生成器,初始容量为 16 个字符。 | |
StringBuilder(CharSequenceseq) 构造一个字符串生成器,包含与指定的 CharSequence 相同的字符。 | |
StringBuilder(intcapacity) 构造一个其中不带字符的字符串生成器,初始容量由 capacity 参数指定。 | |
StringBuilder(Stringstr) 构造一个字符串生成器,并初始化为指定的字符串内容。 |
方法摘要 | |
---|---|
StringBuilder | append(booleanb) Appends the string representation of the boolean argument to the sequence. |
StringBuilder | append(charc) Appends the string representation of the char argument to this sequence. |
StringBuilder | append(char[]str) Appends the string representation of the char array argument to this sequence. |
StringBuilder | append(char[]str, intoffset, intlen) Appends the string representation of a subarray of the char array argument to this sequence. |
StringBuilder | append(CharSequences) 向此 Appendable 追加指定的字符序列。 |
StringBuilder | append(CharSequences, intstart, intend) Appends a subsequence of the specified CharSequence to this sequence. |
StringBuilder | append(doubled) Appends the string representation of the double argument to this sequence. |
StringBuilder | append(floatf) Appends the string representation of the float argument to this sequence. |
StringBuilder | append(inti) Appends the string representation of the int argument to this sequence. |
StringBuilder | append(longlng) Appends the string representation of the long argument to this sequence. |
StringBuilder | append(Objectobj) Appends the string representation of the Object argument. |
StringBuilder | append(Stringstr) Appends the specified string to this character sequence. |
StringBuilder | append(StringBuffersb) 将指定的 StringBuffer 追加到此序列。 |
StringBuilder | appendCodePoint(intcodePoint) Appends the string representation of the codePoint argument to this sequence. |
int | capacity() Returns the current capacity. |
char | charAt(intindex) Returns the char value in this sequence at the specified index. |
int | codePointAt(intindex) Returns the character (Unicode code point) at the specified index. |
int | codePointBefore(intindex) Returns the character (Unicode code point) before the specified index. |
int | codePointCount(intbeginIndex, intendIndex) Returns the number of Unicode code points in the specified text range of this sequence. |
StringBuilder | delete(intstart, intend) Removes the characters in a substring of this sequence. |
StringBuilder | deleteCharAt(intindex) Removes the char at the specified position in this sequence. |
void | ensureCapacity(intminimumCapacity) Ensures that the capacity is at least equal to the specified minimum. |
void | getChars(intsrcBegin, intsrcEnd, char[]dst, intdstBegin) Characters are copied from this sequence into the destination character array dst . |
int | indexOf(Stringstr) Returns the index within this string of the first occurrence of the specified substring. |
int | indexOf(Stringstr, intfromIndex) Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. |
StringBuilder | insert(intoffset, booleanb) Inserts the string representation of the boolean argument into this sequence. |
StringBuilder | insert(intoffset, charc) Inserts the string representation of the char argument into this sequence. |
StringBuilder | insert(intoffset, char[]str) Inserts the string representation of the char array argument into this sequence. |
StringBuilder | insert(intindex, char[]str, intoffset, intlen) Inserts the string representation of a subarray of the str array argument into this sequence. |
StringBuilder | insert(intdstOffset, CharSequences) Inserts the specified CharSequence into this sequence. |
StringBuilder | insert(intdstOffset, CharSequences, intstart, intend) Inserts a subsequence of the specified CharSequence into this sequence. |
StringBuilder | insert(intoffset, doubled) Inserts the string representation of the double argument into this sequence. |
StringBuilder | insert(intoffset, floatf) Inserts the string representation of the float argument into this sequence. |
StringBuilder | insert(intoffset, inti) Inserts the string representation of the second int argument into this sequence. |
StringBuilder | insert(intoffset, longl) Inserts the string representation of the long argument into this sequence. |
StringBuilder | insert(intoffset, Objectobj) Inserts the string representation of the Object argument into this character sequence. |
StringBuilder | insert(intoffset, Stringstr) Inserts the string into this character sequence. |
int | lastIndexOf(Stringstr) Returns the index within this string of the rightmost occurrence of the specified substring. |
int | lastIndexOf(Stringstr, intfromIndex) Returns the index within this string of the last occurrence of the specified substring. |
int | length() Returns the length (character count). |
int | offsetByCodePoints(intindex, intcodePointOffset) Returns the index within this sequence that is offset from the given index by codePointOffset code points. |
StringBuilder | replace(intstart, intend, Stringstr) Replaces the characters in a substring of this sequence with characters in the specified String . |
StringBuilder | reverse() Causes this character sequence to be replaced by the reverse of the sequence. |
void | setCharAt(intindex, charch) The character at the specified index is set to ch . |
void | setLength(intnewLength) Sets the length of the character sequence. |
CharSequence | subSequence(intstart, intend) Returns a new character sequence that is a subsequence of this sequence. |
String | substring(intstart) Returns a new String that contains a subsequence of characters currently contained in this character sequence. |
String | substring(intstart, intend) Returns a new String that contains a subsequence of characters currently contained in this sequence. |
String | toString() Returns a string representing the data in this sequence. |
void | trimToSize() Attempts to reduce storage used for the character sequence. |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
从接口 java.lang.CharSequence 继承的方法 |
---|
charAt, length, subSequence |
构造方法详细信息
StringBuilder
public StringBuilder()
- 构造一个其中不带字符的字符串生成器,初始容量为 16 个字符。
StringBuilder
public StringBuilder(intcapacity)
- 构造一个其中不带字符的字符串生成器,初始容量由
capacity
参数指定。- 参数:
capacity
- 初始容量。- 抛出:
NegativeArraySizeException
- 如果capacity
参数小于0
。
StringBuilder
public StringBuilder(Stringstr)
- 构造一个字符串生成器,并初始化为指定的字符串内容。该字符串生成器的初始容量为
16
加上字符串参数的长度。- 参数:
str
- 缓冲区的初始内容。- 抛出:
NullPointerException
- 如果str
为null
StringBuilder
public StringBuilder(CharSequenceseq)
- 构造一个字符串生成器,包含与指定的
CharSequence
相同的字符。该字符串生成器的初始容量为16
加上CharSequence
参数的长度。- 参数:
seq
- 要复制的序列。- 抛出:
NullPointerException
- 如果seq
为null
方法详细信息
append
public StringBuilder append(Objectobj)
- Appends the string representation of the
Object
argument.The argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then appended to this sequence. - 参数:
obj
- anObject
.- 返回:
- a reference to this object.
- 另请参见:
String.valueOf(java.lang.Object)
,append(java.lang.String)
append
public StringBuilder append(Stringstr)
- Appends the specified string to this character sequence.
The characters of the
String
argument are appended, in order, increasing the length of this sequence by the length of the argument. Ifstr
isnull
, then the four characters"null"
are appended.Let n be the length of this character sequence just prior to execution of the
append
method. Then the character at index k in the new character sequence is equal to the character at index k in the old character sequence, if k is less than n; otherwise, it is equal to the character at index k-n in the argumentstr
. - 参数:
str
- a string.- 返回:
- a reference to this object.
append
public StringBuilder append(StringBuffersb)
- 将指定的
StringBuffer
追加到此序列。按顺序将
StringBuffer
参数中的字符追加到该序列中,使该序列在长度上增加该参数的长度。如果sb
为null
,则向该序列中追加 4 个"null"
字符。在执行
append
方法前,让此字符序列的长度为 n。如果 k 小于 n,则新字符序列中索引 k 处的字符等于原有序列中索引 k 处的字符;否则它等于参数sb
中索引 k-n 处的字符。 - 参数:
sb
- 要追加的StringBuffer
。- 返回:
- 此对象的一个引用。
append
public StringBuilder append(CharSequences)
- 从接口
Appendable
复制的描述 - 向此
Appendable
追加指定的字符序列。有时可能没有追加整个序列,这取决于使用哪个类来实现字符序列
csq
。例如,如果csq
是CharBuffer
的一个实例,则通过缓冲区的位置和限制来定义要追加的子序列。 - 指定者:
- 接口
Appendable
中的append
- 参数:
s
- 要追加的字符串序列。如果csq
为null
,则向该 Appendable 追加四个字符"null"
。- 返回:
- 此
Appendable
的引用 - 抛出:
IndexOutOfBoundsException
append
public StringBuilder append(CharSequences, intstart, intend)
- Appends a subsequence of the specified
CharSequence
to this sequence.Characters of the argument
s
, starting at indexstart
, are appended, in order, to the contents of this sequence up to the (exclusive) indexend
. The length of this sequence is increased by the value ofend - start
.Let n be the length of this character sequence just prior to execution of the
append
method. Then the character at index k in this character sequence becomes equal to the character at index k in this sequence, if k is less than n; otherwise, it is equal to the character at index k+start-n in the arguments
.If
s
isnull
, then this method appends characters as if the s parameter was a sequence containing the four characters"null"
. - 指定者:
- 接口
Appendable
中的append
- 参数:
s
- the sequence to append.start
- the starting index of the subsequence to be appended.end
- the end index of the subsequence to be appended.- 返回:
- a reference to this object.
- 抛出:
IndexOutOfBoundsException
- ifstart
orend
are negative, orstart
is greater thanend
orend
is greater thans.length()
append
public StringBuilder append(char[]str)
- Appends the string representation of the
char
array argument to this sequence.The characters of the array argument are appended, in order, to the contents of this sequence. The length of this sequence increases by the length of the argument.
The overall effect is exactly as if the argument were converted to a string by the method
String.valueOf(char[])
and the characters of that string were thenappended
to this character sequence. - 参数:
str
- the characters to be appended.- 返回:
- a reference to this object.
append
public StringBuilder append(char[]str, intoffset, intlen)
- Appends the string representation of a subarray of the
char
array argument to this sequence.Characters of the
char
arraystr
, starting at indexoffset
, are appended, in order, to the contents of this sequence. The length of this sequence increases by the value oflen
.The overall effect is exactly as if the arguments were converted to a string by the method
String.valueOf(char[],int,int)
and the characters of that string were thenappended
to this character sequence. - 参数:
str
- the characters to be appended.offset
- the index of the firstchar
to append.len
- the number ofchar
s to append.- 返回:
- a reference to this object.
append
public StringBuilder append(booleanb)
- Appends the string representation of the
boolean
argument to the sequence.The argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then appended to this sequence. - 参数:
b
- aboolean
.- 返回:
- a reference to this object.
- 另请参见:
String.valueOf(boolean)
,append(java.lang.String)
append
public StringBuilder append(charc)
- Appends the string representation of the
char
argument to this sequence.The argument is appended to the contents of this sequence. The length of this sequence increases by
1
.The overall effect is exactly as if the argument were converted to a string by the method
String.valueOf(char)
and the character in that string were thenappended
to this character sequence. - 指定者:
- 接口
Appendable
中的append
- 参数:
c
- achar
.- 返回:
- a reference to this object.
append
public StringBuilder append(inti)
- Appends the string representation of the
int
argument to this sequence.The argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then appended to this sequence. - 参数:
i
- anint
.- 返回:
- a reference to this object.
- 另请参见:
String.valueOf(int)
,append(java.lang.String)
append
public StringBuilder append(longlng)
- Appends the string representation of the
long
argument to this sequence.The argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then appended to this sequence. - 参数:
lng
- along
.- 返回:
- a reference to this object.
- 另请参见:
String.valueOf(long)
,append(java.lang.String)
append
public StringBuilder append(floatf)
- Appends the string representation of the
float
argument to this sequence.The argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then appended to this string sequence. - 参数:
f
- afloat
.- 返回:
- a reference to this object.
- 另请参见:
String.valueOf(float)
,append(java.lang.String)
append
public StringBuilder append(doubled)
- Appends the string representation of the
double
argument to this sequence.The argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then appended to this sequence. - 参数:
d
- adouble
.- 返回:
- a reference to this object.
- 另请参见:
String.valueOf(double)
,append(java.lang.String)
appendCodePoint
public StringBuilder appendCodePoint(intcodePoint)
- Appends the string representation of the
codePoint
argument to this sequence.The argument is appended to the contents of this sequence. The length of this sequence increases by
Character.charCount(codePoint)
.The overall effect is exactly as if the argument were converted to a
char
array by the methodCharacter.toChars(int)
and the character in that array were thenappended
to this character sequence. - 参数:
codePoint
- a Unicode code point- 返回:
- a reference to this object.
- 从以下版本开始:
- 1.5
delete
public StringBuilder delete(intstart, intend)
- Removes the characters in a substring of this sequence. The substring begins at the specified
start
and extends to the character at indexend - 1
or to the end of the sequence if no such character exists. Ifstart
is equal toend
, no changes are made. - 参数:
start
- The beginning index, inclusive.end
- The ending index, exclusive.- 返回:
- This object.
- 抛出:
StringIndexOutOfBoundsException
- ifstart
is negative, greater thanlength()
, or greater thanend
.
deleteCharAt
public StringBuilder deleteCharAt(intindex)
- Removes the
char
at the specified position in this sequence. This sequence is shortened by onechar
.Note: If the character at the given index is a supplementary character, this method does not remove the entire character. If correct handling of supplementary characters is required, determine the number of
char
s to remove by callingCharacter.charCount(thisSequence.codePointAt(index))
, wherethisSequence
is this sequence. - 参数:
index
- Index ofchar
to remove- 返回:
- This object.
- 抛出:
StringIndexOutOfBoundsException
- if theindex
is negative or greater than or equal tolength()
.
replace
public StringBuilder replace(intstart, intend, Stringstr)
- Replaces the characters in a substring of this sequence with characters in the specified
String
. The substring begins at the specifiedstart
and extends to the character at indexend - 1
or to the end of the sequence if no such character exists. First the characters in the substring are removed and then the specifiedString
is inserted atstart
. (This sequence will be lengthened to accommodate the specified String if necessary.) - 参数:
start
- The beginning index, inclusive.end
- The ending index, exclusive.str
- String that will replace previous contents.- 返回:
- This object.
- 抛出:
StringIndexOutOfBoundsException
- ifstart
is negative, greater thanlength()
, or greater thanend
.
insert
public StringBuilder insert(intindex, char[]str, intoffset, intlen)
- Inserts the string representation of a subarray of the
str
array argument into this sequence. The subarray begins at the specifiedoffset
and extendslen
char
s. The characters of the subarray are inserted into this sequence at the position indicated byindex
. The length of this sequence increases bylen
char
s. - 参数:
index
- position at which to insert subarray.str
- Achar
array.offset
- the index of the firstchar
in subarray to be inserted.len
- the number ofchar
s in the subarray to be inserted.- 返回:
- This object
- 抛出:
StringIndexOutOfBoundsException
- ifindex
is negative or greater thanlength()
, oroffset
orlen
are negative, or(offset+len)
is greater thanstr.length
.
insert
public StringBuilder insert(intoffset, Objectobj)
- Inserts the string representation of the
Object
argument into this character sequence.The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then inserted into this sequence at the indicated offset.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.obj
- anObject
.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
String.valueOf(java.lang.Object)
,insert(int, java.lang.String)
,length()
insert
public StringBuilder insert(intoffset, Stringstr)
- Inserts the string into this character sequence.
The characters of the
String
argument are inserted, in order, into this sequence at the indicated offset, moving up any characters originally above that position and increasing the length of this sequence by the length of the argument. Ifstr
isnull
, then the four characters"null"
are inserted into this sequence.The character at index k in the new character sequence is equal to:
- the character at index k in the old character sequence, if k is less than
offset
- the character at index k
-offset
in the argumentstr
, if k is not less thanoffset
but is less thanoffset+str.length()
- the character at index k
-str.length()
in the old character sequence, if k is not less thanoffset+str.length()
The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - the character at index k in the old character sequence, if k is less than
- 参数:
offset
- the offset.str
- a string.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
length()
insert
public StringBuilder insert(intoffset, char[]str)
- Inserts the string representation of the
char
array argument into this sequence.The characters of the array argument are inserted into the contents of this sequence at the position indicated by
offset
. The length of this sequence increases by the length of the argument.The overall effect is exactly as if the argument were converted to a string by the method
String.valueOf(char[])
and the characters of that string were theninserted
into this character sequence at the position indicated byoffset
. - 参数:
offset
- the offset.str
- a character array.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.
insert
public StringBuilder insert(intdstOffset, CharSequences)
- Inserts the specified
CharSequence
into this sequence.The characters of the
CharSequence
argument are inserted, in order, into this sequence at the indicated offset, moving up any characters originally above that position and increasing the length of this sequence by the length of the argument s.The result of this method is exactly the same as if it were an invocation of this object's insert(dstOffset, s, 0, s.length()) method.
If
s
isnull
, then the four characters"null"
are inserted into this sequence. - 参数:
dstOffset
- the offset.s
- the sequence to be inserted- 返回:
- a reference to this object.
- 抛出:
IndexOutOfBoundsException
- if the offset is invalid.
insert
public StringBuilder insert(intdstOffset, CharSequences, intstart, intend)
- Inserts a subsequence of the specified
CharSequence
into this sequence.The subsequence of the argument
s
specified bystart
andend
are inserted, in order, into this sequence at the specified destination offset, moving up any characters originally above that position. The length of this sequence is increased byend - start
.The character at index k in this sequence becomes equal to:
- the character at index k in this sequence, if k is less than
dstOffset
- the character at index k
+start-dstOffset
in the arguments
, if k is greater than or equal todstOffset
but is less thandstOffset+end-start
- the character at index k
-(end-start)
in this sequence, if k is greater than or equal todstOffset+end-start
The dstOffset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence.The start argument must be nonnegative, and not greater than
end
.The end argument must be greater than or equal to
start
, and less than or equal to the length of s.If
s
isnull
, then this method inserts characters as if the s parameter was a sequence containing the four characters"null"
. - the character at index k in this sequence, if k is less than
- 参数:
dstOffset
- the offset in this sequence.s
- the sequence to be inserted.start
- the starting index of the subsequence to be inserted.end
- the end index of the subsequence to be inserted.- 返回:
- a reference to this object.
- 抛出:
IndexOutOfBoundsException
- ifdstOffset
is negative or greater thanthis.length()
, orstart
orend
are negative, orstart
is greater thanend
orend
is greater thans.length()
insert
public StringBuilder insert(intoffset, booleanb)
- Inserts the string representation of the
boolean
argument into this sequence.The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then inserted into this sequence at the indicated offset.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.b
- aboolean
.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
String.valueOf(boolean)
,insert(int, java.lang.String)
,length()
insert
public StringBuilder insert(intoffset, charc)
- Inserts the string representation of the
char
argument into this sequence.The second argument is inserted into the contents of this sequence at the position indicated by
offset
. The length of this sequence increases by one.The overall effect is exactly as if the argument were converted to a string by the method
String.valueOf(char)
and the character in that string were theninserted
into this character sequence at the position indicated byoffset
.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.c
- achar
.- 返回:
- a reference to this object.
- 抛出:
IndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
length()
insert
public StringBuilder insert(intoffset, inti)
- Inserts the string representation of the second
int
argument into this sequence.The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then inserted into this sequence at the indicated offset.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.i
- anint
.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
String.valueOf(int)
,insert(int, java.lang.String)
,length()
insert
public StringBuilder insert(intoffset, longl)
- Inserts the string representation of the
long
argument into this sequence.The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then inserted into this sequence at the position indicated byoffset
.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.l
- along
.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
String.valueOf(long)
,insert(int, java.lang.String)
,length()
insert
public StringBuilder insert(intoffset, floatf)
- Inserts the string representation of the
float
argument into this sequence.The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then inserted into this sequence at the indicated offset.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.f
- afloat
.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
String.valueOf(float)
,insert(int, java.lang.String)
,length()
insert
public StringBuilder insert(intoffset, doubled)
- Inserts the string representation of the
double
argument into this sequence.The second argument is converted to a string as if by the method
String.valueOf
, and the characters of that string are then inserted into this sequence at the indicated offset.The offset argument must be greater than or equal to
0
, and less than or equal to the length of this sequence. - 参数:
offset
- the offset.d
- adouble
.- 返回:
- a reference to this object.
- 抛出:
StringIndexOutOfBoundsException
- if the offset is invalid.- 另请参见:
String.valueOf(double)
,insert(int, java.lang.String)
,length()
indexOf
public int indexOf(Stringstr)
- Returns the index within this string of the first occurrence of the specified substring. The integer returned is the smallest value k such that:
isthis.toString().startsWith(str, k)
true
. - 参数:
str
- any string.- 返回:
- if the string argument occurs as a substring within this object, then the index of the first character of the first such substring is returned; if it does not occur as a substring,
-1
is returned. - 抛出:
NullPointerException
- ifstr
isnull
.
indexOf
public int indexOf(Stringstr, intfromIndex)
- Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. The integer returned is the smallest value
k
for which:
If no such value of k exists, then -1 is returned.k >= Math.min(fromIndex, str.length()) && this.toString().startsWith(str, k)
- 参数:
str
- the substring for which to search.fromIndex
- the index from which to start the search.- 返回:
- the index within this string of the first occurrence of the specified substring, starting at the specified index.
- 抛出:
NullPointerException
- ifstr
isnull
.
lastIndexOf
public int lastIndexOf(Stringstr)
- Returns the index within this string of the rightmost occurrence of the specified substring. The rightmost empty string "" is considered to occur at the index value
this.length()
. The returned index is the largest value k such that
is true.this.toString().startsWith(str, k)
- 参数:
str
- the substring to search for.- 返回:
- if the string argument occurs one or more times as a substring within this object, then the index of the first character of the last such substring is returned. If it does not occur as a substring,
-1
is returned. - 抛出:
NullPointerException
- ifstr
isnull
.
lastIndexOf
public int lastIndexOf(Stringstr, intfromIndex)
- Returns the index within this string of the last occurrence of the specified substring. The integer returned is the largest value k such that:
If no such value of k exists, then -1 is returned.k <= Math.min(fromIndex, str.length()) && this.toString().startsWith(str, k)
- 参数:
str
- the substring to search for.fromIndex
- the index to start the search from.- 返回:
- the index within this sequence of the last occurrence of the specified substring.
- 抛出:
NullPointerException
- ifstr
isnull
.
reverse
public StringBuilder reverse()
- Causes this character sequence to be replaced by the reverse of the sequence. If there are any surrogate pairs included in the sequence, these are treated as single characters for the reverse operation. Thus, the order of the high-low surrogates is never reversed. Let n be the character length of this character sequence (not the length in
char
values) just prior to execution of thereverse
method. Then the character at index k in the new character sequence is equal to the character at index n-k-1 in the old character sequence.Note that the reverse operation may result in producing surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation. For example, reversing "\uDC00\uD800" produces "\uD800\uDC00" which is a valid surrogate pair.
- 返回:
- a reference to this object.
toString
public String toString()
- Returns a string representing the data in this sequence. A new
String
object is allocated and initialized to contain the character sequence currently represented by this object. ThisString
is then returned. Subsequent changes to this sequence do not affect the contents of theString
. - 指定者:
- 接口
CharSequence
中的toString
- 返回:
- a string representation of this sequence of characters.
length
public int length()
- Returns the length (character count).
- 指定者:
- 接口
CharSequence
中的length
- 返回:
- the length of the sequence of characters currently represented by this object
capacity
public int capacity()
- Returns the current capacity. The capacity is the amount of storage available for newly inserted characters, beyond which an allocation will occur.
- 返回:
- the current capacity
ensureCapacity
public void ensureCapacity(intminimumCapacity)
- Ensures that the capacity is at least equal to the specified minimum. If the current capacity is less than the argument, then a new internal array is allocated with greater capacity. The new capacity is the larger of:
- The
minimumCapacity
argument. - Twice the old capacity, plus
2
.
minimumCapacity
argument is nonpositive, this method takes no action and simply returns. - The
- 参数:
minimumCapacity
- the minimum desired capacity.
trimToSize
public void trimToSize()
- Attempts to reduce storage used for the character sequence. If the buffer is larger than necessary to hold its current sequence of characters, then it may be resized to become more space efficient. Calling this method may, but is not required to, affect the value returned by a subsequent call to the
capacity()
method.
setLength
public void setLength(intnewLength)
- Sets the length of the character sequence. The sequence is changed to a new character sequence whose length is specified by the argument. For every nonnegative index k less than
newLength
, the character at index k in the new character sequence is the same as the character at index k in the old sequence if k is less than the length of the old character sequence; otherwise, it is the null character'\u0000'
. In other words, if thenewLength
argument is less than the current length, the length is changed to the specified length.If the
newLength
argument is greater than or equal to the current length, sufficient null characters ('\u0000'
) are appended so that length becomes thenewLength
argument.The
newLength
argument must be greater than or equal to0
. - 参数:
newLength
- the new length- 抛出:
IndexOutOfBoundsException
- if thenewLength
argument is negative.
charAt
public char charAt(intindex)
- Returns the
char
value in this sequence at the specified index. The firstchar
value is at index0
, the next at index1
, and so on, as in array indexing.The index argument must be greater than or equal to
0
, and less than the length of this sequence.If the
char
value specified by the index is a surrogate, the surrogate value is returned. - 指定者:
- 接口
CharSequence
中的charAt
- 参数:
index
- the index of the desiredchar
value.- 返回:
- the
char
value at the specified index. - 抛出:
IndexOutOfBoundsException
- ifindex
is negative or greater than or equal tolength()
.
codePointAt
public int codePointAt(intindex)
- Returns the character (Unicode code point) at the specified index. The index refers to
char
values (Unicode code units) and ranges from0
tolength()
- 1
.If the
char
value specified at the given index is in the high-surrogate range, the following index is less than the length of this sequence, and thechar
value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, thechar
value at the given index is returned. - 参数:
index
- the index to thechar
values- 返回:
- the code point value of the character at the
index
- 抛出:
IndexOutOfBoundsException
- if theindex
argument is negative or not less than the length of this sequence.
codePointBefore
public int codePointBefore(intindex)
- Returns the character (Unicode code point) before the specified index. The index refers to
char
values (Unicode code units) and ranges from1
tolength()
.If the
char
value at(index - 1)
is in the low-surrogate range,(index - 2)
is not negative, and thechar
value at(index - 2)
is in the high-surrogate range, then the supplementary code point value of the surrogate pair is returned. If thechar
value atindex - 1
is an unpaired low-surrogate or a high-surrogate, the surrogate value is returned. - 参数:
index
- the index following the code point that should be returned- 返回:
- the Unicode code point value before the given index.
- 抛出:
IndexOutOfBoundsException
- if theindex
argument is less than 1 or greater than the length of this sequence.
codePointCount
public int codePointCount(intbeginIndex, intendIndex)
- Returns the number of Unicode code points in the specified text range of this sequence. The text range begins at the specified
beginIndex
and extends to thechar
at indexendIndex - 1
. Thus the length (inchar
s) of the text range isendIndex-beginIndex
. Unpaired surrogates within this sequence count as one code point each. - 参数:
beginIndex
- the index to the firstchar
of the text range.endIndex
- the index after the lastchar
of the text range.- 返回:
- the number of Unicode code points in the specified text range
- 抛出:
IndexOutOfBoundsException
- if thebeginIndex
is negative, orendIndex
is larger than the length of this sequence, orbeginIndex
is larger thanendIndex
.
offsetByCodePoints
public int offsetByCodePoints(intindex, intcodePointOffset)
- Returns the index within this sequence that is offset from the given
index
bycodePointOffset
code points. Unpaired surrogates within the text range given byindex
andcodePointOffset
count as one code point each. - 参数:
index
- the index to be offsetcodePointOffset
- the offset in code points- 返回:
- the index within this sequence
- 抛出:
IndexOutOfBoundsException
- ifindex
is negative or larger then the length of this sequence, or ifcodePointOffset
is positive and the subsequence starting withindex
has fewer thancodePointOffset
code points, or ifcodePointOffset
is negative and the subsequence beforeindex
has fewer than the absolute value ofcodePointOffset
code points.
getChars
public void getChars(intsrcBegin, intsrcEnd, char[]dst, intdstBegin)
- Characters are copied from this sequence into the destination character array
dst
. The first character to be copied is at indexsrcBegin
; the last character to be copied is at indexsrcEnd-1
. The total number of characters to be copied issrcEnd-srcBegin
. The characters are copied into the subarray ofdst
starting at indexdstBegin
and ending at index:dstbegin + (srcEnd-srcBegin) - 1
- 参数:
srcBegin
- start copying at this offset.srcEnd
- stop copying at this offset.dst
- the array to copy the data into.dstBegin
- offset intodst
.- 抛出:
NullPointerException
- ifdst
isnull
.IndexOutOfBoundsException
- if any of the following is true:srcBegin
is negativedstBegin
is negative- the
srcBegin
argument is greater than thesrcEnd
argument. srcEnd
is greater thanthis.length()
.dstBegin+srcEnd-srcBegin
is greater thandst.length
setCharAt
public void setCharAt(intindex, charch)
- The character at the specified index is set to
ch
. This sequence is altered to represent a new character sequence that is identical to the old character sequence, except that it contains the characterch
at positionindex
.The index argument must be greater than or equal to
0
, and less than the length of this sequence. - 参数:
index
- the index of the character to modify.ch
- the new character.- 抛出:
IndexOutOfBoundsException
- ifindex
is negative or greater than or equal tolength()
.
substring
public String substring(intstart)
- Returns a new
String
that contains a subsequence of characters currently contained in this character sequence. The substring begins at the specified index and extends to the end of this sequence. - 参数:
start
- The beginning index, inclusive.- 返回:
- The new string.
- 抛出:
StringIndexOutOfBoundsException
- ifstart
is less than zero, or greater than the length of this object.
subSequence
public CharSequence subSequence(intstart, intend)
- Returns a new character sequence that is a subsequence of this sequence.
An invocation of this method of the form
behaves in exactly the same way as the invocationsb.subSequence(begin,end)
This method is provided so that this class can implement thesb.substring(begin,end)
CharSequence
interface. - 指定者:
- 接口
CharSequence
中的subSequence
- 参数:
start
- the start index, inclusive.end
- the end index, exclusive.- 返回:
- the specified subsequence.
- 抛出:
IndexOutOfBoundsException
- ifstart
orend
are negative, ifend
is greater thanlength()
, or ifstart
is greater thanend
substring
public String substring(intstart, intend)
- Returns a new
String
that contains a subsequence of characters currently contained in this sequence. The substring begins at the specifiedstart
and extends to the character at indexend - 1
. - 参数:
start
- The beginning index, inclusive.end
- The ending index, exclusive.- 返回:
- The new string.
- 抛出:
StringIndexOutOfBoundsException
- ifstart
orend
are negative or greater thanlength()
, orstart
is greater thanend
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论