IT. Expert System.

Android Reference

CharArrayReader


java.io

Class CharArrayReader

    • Field Summary

      Fields
      Modifier and Type Field and Description
      protected char[] buf
      The buffer for characters.
      protected int count
      The ending index of the buffer.
      protected int markedPos
      The current mark position.
      protected int pos
      The current buffer position.
    • Constructor Summary

      Constructors
      Constructor and Description
      CharArrayReader(char[] buf)
      Constructs a CharArrayReader on the char array buf.
      CharArrayReader(char[] buf, int offset, int length)
      Constructs a CharArrayReader on the char array buf.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      void close()
      This method closes this CharArrayReader.
      void mark(int readLimit)
      Sets a mark position in this reader.
      boolean markSupported()
      Indicates whether this reader supports the mark() and reset() methods.
      int read()
      Reads a single character from this reader and returns it as an integer with the two higher-order bytes set to 0.
      int read(char[] buffer, int offset, int len)
      Reads at most count characters from this CharArrayReader and stores them at offset in the character array buf.
      boolean ready()
      Indicates whether this reader is ready to be read without blocking.
      void reset()
      Resets this reader's position to the last mark() location.
      long skip(long charCount)
      Skips charCount characters in this reader.
    • Field Detail

      • buf

        protected char[] buf
        The buffer for characters.
      • pos

        protected int pos
        The current buffer position.
      • markedPos

        protected int markedPos
        The current mark position.
      • count

        protected int count
        The ending index of the buffer.
    • Constructor Detail

      • CharArrayReader

        public CharArrayReader(char[] buf)
        Constructs a CharArrayReader on the char array buf. The size of the reader is set to the length of the buffer and the object to to read from is set to buf.
        Parameters:
        buf - the char array from which to read.
      • CharArrayReader

        public CharArrayReader(char[] buf,
                       int offset,
                       int length)
        Constructs a CharArrayReader on the char array buf. The size of the reader is set to length and the start position from which to read the buffer is set to offset.
        Parameters:
        buf - the char array from which to read.
        offset - the index of the first character in buf to read.
        length - the number of characters that can be read from buf.
        Throws:
        IllegalArgumentException - if offset < 0 or length < 0, or if offset is greater than the size of buf .
    • Method Detail

      • close

        public void close()
        This method closes this CharArrayReader. Once it is closed, you can no longer read from it. Only the first invocation of this method has any effect.
        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in class Reader
      • mark

        public void mark(int readLimit)
                  throws IOException
        Sets a mark position in this reader. The parameter readLimit is ignored for CharArrayReaders. Calling reset() will reposition the reader back to the marked position provided the mark has not been invalidated.
        Overrides:
        mark in class Reader
        Parameters:
        readLimit - ignored for CharArrayReaders.
        Throws:
        IOException - if this reader is closed.
        See Also:
        Reader.markSupported(), Reader.reset()
      • markSupported

        public boolean markSupported()
        Indicates whether this reader supports the mark() and reset() methods.
        Overrides:
        markSupported in class Reader
        Returns:
        true for CharArrayReader.
        See Also:
        mark(int), reset()
      • read

        public int read()
                 throws IOException
        Reads a single character from this reader and returns it as an integer with the two higher-order bytes set to 0. Returns -1 if no more characters are available from this reader.
        Overrides:
        read in class Reader
        Returns:
        the character read as an int or -1 if the end of the reader has been reached.
        Throws:
        IOException - if this reader is closed.
      • read

        public int read(char[] buffer,
               int offset,
               int len)
                 throws IOException
        Reads at most count characters from this CharArrayReader and stores them at offset in the character array buf. Returns the number of characters actually read or -1 if the end of reader was encountered.
        Specified by:
        read in class Reader
        Parameters:
        buffer - the character array to store the characters read.
        offset - the initial position in buffer to store the characters read from this reader.
        len - the maximum number of characters to read.
        Returns:
        number of characters read or -1 if the end of the reader has been reached.
        Throws:
        IndexOutOfBoundsException - if offset < 0 or len < 0, or if offset + len is bigger than the size of buffer.
        IOException - if this reader is closed.
      • ready

        public boolean ready()
                      throws IOException
        Indicates whether this reader is ready to be read without blocking. Returns true if the next read will not block. Returns false if this reader may or may not block when read is called. The implementation in CharArrayReader always returns true even when it has been closed.
        Overrides:
        ready in class Reader
        Returns:
        true if this reader will not block when read is called, false if unknown or blocking will occur.
        Throws:
        IOException - if this reader is closed.
        See Also:
        Reader.read(), Reader.read(char[]), Reader.read(char[], int, int)
      • reset

        public void reset()
                   throws IOException
        Resets this reader's position to the last mark() location. Invocations of read() and skip() will occur from this new location. If this reader has not been marked, it is reset to the beginning of the string.
        Overrides:
        reset in class Reader
        Throws:
        IOException - if this reader is closed.
        See Also:
        Reader.mark(int), Reader.markSupported()
      • skip

        public long skip(long charCount)
                  throws IOException
        Skips charCount characters in this reader. Subsequent calls to read will not return these characters unless reset is used. This method does nothing and returns 0 if charCount <= 0.
        Overrides:
        skip in class Reader
        Returns:
        the number of characters actually skipped.
        Throws:
        IOException - if this reader is closed.
        See Also:
        Reader.mark(int), Reader.markSupported(), Reader.reset()


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: 391 / 158749103. Delta: 0.08065 с