IT. Expert System.

Android Reference

StringWriter


java.io

Class StringWriter

    • Field Summary

    • Constructor Summary

      Constructors
      Constructor and Description
      StringWriter()
      Constructs a new StringWriter which has a StringBuffer allocated with the default size of 16 characters.
      StringWriter(int initialSize)
      Constructs a new StringWriter which has a StringBuffer allocated with a size of initialSize characters.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      StringWriter append(char c)
      Appends the character c to this writer's StringBuffer.
      StringWriter append(CharSequence csq)
      Appends the character sequence csq to this writer's StringBuffer.
      StringWriter append(CharSequence csq, int start, int end)
      Appends a subsequence of the character sequence csq to this writer's StringBuffer.
      void close()
      Calling this method has no effect.
      void flush()
      Calling this method has no effect.
      StringBuffer getBuffer()
      Gets a reference to this writer's internal StringBuffer.
      String toString()
      Gets a copy of the contents of this writer as a string.
      void write(char[] chars, int offset, int count)
      Writes count characters starting at offset in buf to this writer's StringBuffer.
      void write(int oneChar)
      Writes one character to this writer's StringBuffer.
      void write(String str)
      Writes the characters from the specified string to this writer's StringBuffer.
      void write(String str, int offset, int count)
      Writes count characters from str starting at offset to this writer's StringBuffer.
    • Constructor Detail

      • StringWriter

        public StringWriter()
        Constructs a new StringWriter which has a StringBuffer allocated with the default size of 16 characters. The StringBuffer is also the lock used to synchronize access to this writer.
      • StringWriter

        public StringWriter(int initialSize)
        Constructs a new StringWriter which has a StringBuffer allocated with a size of initialSize characters. The StringBuffer is also the lock used to synchronize access to this writer.
        Parameters:
        initialSize - the intial size of the target string buffer.
    • Method Detail

      • close

        public void close()
                   throws IOException
        Calling this method has no effect. In contrast to most Writer subclasses, the other methods in StringWriter do not throw an IOException if close() has been called.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in class Writer
        Throws:
        IOException - if an error occurs while closing this writer.
      • flush

        public void flush()
        Calling this method has no effect.
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in class Writer
      • getBuffer

        public StringBuffer getBuffer()
        Gets a reference to this writer's internal StringBuffer. Any changes made to the returned buffer are reflected in this writer.
        Returns:
        a reference to this writer's internal StringBuffer.
      • toString

        public String toString()
        Gets a copy of the contents of this writer as a string.
        Overrides:
        toString in class Object
        Returns:
        this writer's contents as a string.
      • write

        public void write(char[] chars,
                 int offset,
                 int count)
        Writes count characters starting at offset in buf to this writer's StringBuffer.
        Specified by:
        write in class Writer
        Parameters:
        chars - the non-null character array to write.
        offset - the index of the first character in chars to write.
        count - the maximum number of characters to write.
        Throws:
        IndexOutOfBoundsException - if offset < 0 or count < 0, or if offset + count is greater than the size of buf.
      • write

        public void write(int oneChar)
        Writes one character to this writer's StringBuffer. Only the two least significant bytes of the integer oneChar are written.
        Overrides:
        write in class Writer
        Parameters:
        oneChar - the character to write to this writer's StringBuffer.
      • write

        public void write(String str)
        Writes the characters from the specified string to this writer's StringBuffer.
        Overrides:
        write in class Writer
        Parameters:
        str - the non-null string containing the characters to write.
      • write

        public void write(String str,
                 int offset,
                 int count)
        Writes count characters from str starting at offset to this writer's StringBuffer.
        Overrides:
        write in class Writer
        Parameters:
        str - the non-null string containing the characters to write.
        offset - the index of the first character in str to write.
        count - the number of characters from str to write.
        Throws:
        StringIndexOutOfBoundsException - if offset < 0 or count < 0, or if offset + count is greater than the length of str.
      • append

        public StringWriter append(char c)
        Appends the character c to this writer's StringBuffer. This method works the same way as write(int).
        Specified by:
        append in interface Appendable
        Overrides:
        append in class Writer
        Parameters:
        c - the character to append to the target stream.
        Returns:
        this writer.
      • append

        public StringWriter append(CharSequence csq)
        Appends the character sequence csq to this writer's StringBuffer. This method works the same way as StringWriter.write(csq.toString()). If csq is null, then the string "null" is written to the target stream.
        Specified by:
        append in interface Appendable
        Overrides:
        append in class Writer
        Parameters:
        csq - the character sequence appended to the target.
        Returns:
        this writer.
      • append

        public StringWriter append(CharSequence csq,
                          int start,
                          int end)
        Appends a subsequence of the character sequence csq to this writer's StringBuffer. This method works the same way as StringWriter.writer(csq.subsequence(start, end).toString()). If csq is null, then the specified subsequence of the string "null" will be written to the target.
        Specified by:
        append in interface Appendable
        Overrides:
        append in class Writer
        Parameters:
        csq - the character sequence appended to the target.
        start - the index of the first char in the character sequence appended to the target.
        end - the index of the character following the last character of the subsequence appended to the target.
        Returns:
        this writer.
        Throws:
        IndexOutOfBoundsException - if start > end, start < 0, end < 0 or either start or end are greater or equal than the length of csq.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 498 / . Delta: 0.05252 с