IT. Expert System.

Android Reference

ByteArrayInputStream


java.io

Class ByteArrayInputStream

    • Field Summary

      Fields
      Modifier and Type Field and Description
      protected byte[] buf
      The byte array containing the bytes to stream over.
      protected int count
      The total number of bytes initially available in the byte array buf.
      protected int mark
      The current mark position.
      protected int pos
      The current position within the byte array.
    • Constructor Summary

      Constructors
      Constructor and Description
      ByteArrayInputStream(byte[] buf)
      Constructs a new ByteArrayInputStream on the byte array buf.
      ByteArrayInputStream(byte[] buf, int offset, int length)
      Constructs a new ByteArrayInputStream on the byte array buf with the initial position set to offset and the number of bytes available set to offset + length.
    • Method Summary

      Methods
      Modifier and Type Method and Description
      int available()
      Returns the number of remaining bytes.
      void close()
      Closes this stream and frees resources associated with this stream.
      void mark(int readlimit)
      Sets a mark position in this ByteArrayInputStream.
      boolean markSupported()
      Indicates whether this stream supports the mark() and reset() methods.
      int read()
      Reads a single byte from the source byte array and returns it as an integer in the range from 0 to 255.
      int read(byte[] buffer, int offset, int length)
      Reads at most len bytes from this stream and stores them in byte array b starting at offset.
      void reset()
      Resets this stream to the last marked location.
      long skip(long byteCount)
      Skips byteCount bytes in this InputStream.
    • Field Detail

      • buf

        protected byte[] buf
        The byte array containing the bytes to stream over.
      • pos

        protected int pos
        The current position within the byte array.
      • mark

        protected int mark
        The current mark position. Initially set to 0 or the offset parameter within the constructor.
      • count

        protected int count
        The total number of bytes initially available in the byte array buf.
    • Constructor Detail

      • ByteArrayInputStream

        public ByteArrayInputStream(byte[] buf)
        Constructs a new ByteArrayInputStream on the byte array buf.
        Parameters:
        buf - the byte array to stream over.
      • ByteArrayInputStream

        public ByteArrayInputStream(byte[] buf,
                            int offset,
                            int length)
        Constructs a new ByteArrayInputStream on the byte array buf with the initial position set to offset and the number of bytes available set to offset + length.
        Parameters:
        buf - the byte array to stream over.
        offset - the initial position in buf to start streaming from.
        length - the number of bytes available for streaming.
    • Method Detail

      • available

        public int available()
        Returns the number of remaining bytes.
        Overrides:
        available in class InputStream
        Returns:
        count - pos
      • mark

        public void mark(int readlimit)
        Sets a mark position in this ByteArrayInputStream. The parameter readlimit is ignored. Sending reset() will reposition the stream back to the marked position.
        Overrides:
        mark in class InputStream
        Parameters:
        readlimit - ignored.
        See Also:
        markSupported(), reset()
      • markSupported

        public boolean markSupported()
        Indicates whether this stream supports the mark() and reset() methods. Returns true since this class supports these methods.
        Overrides:
        markSupported in class InputStream
        Returns:
        always true.
        See Also:
        mark(int), reset()
      • read

        public int read()
        Reads a single byte from the source byte array and returns it as an integer in the range from 0 to 255. Returns -1 if the end of the source array has been reached.
        Specified by:
        read in class InputStream
        Returns:
        the byte read or -1 if the end of this stream has been reached.
      • read

        public int read(byte[] buffer,
               int offset,
               int length)
        Reads at most len bytes from this stream and stores them in byte array b starting at offset. This implementation reads bytes from the source byte array.
        Overrides:
        read in class InputStream
        Parameters:
        buffer - the byte array in which to store the bytes read.
        offset - the initial position in b to store the bytes read from this stream.
        length - the maximum number of bytes to store in b.
        Returns:
        the number of bytes actually read or -1 if no bytes were read and the end of the stream was encountered.
        Throws:
        IndexOutOfBoundsException - if offset < 0 or length < 0, or if offset + length is greater than the size of b.
        NullPointerException - if b is null.
      • reset

        public void reset()
        Resets this stream to the last marked location. This implementation resets the position to either the marked position, the start position supplied in the constructor or 0 if neither has been provided.
        Overrides:
        reset in class InputStream
        See Also:
        mark(int)
      • skip

        public long skip(long byteCount)
        Skips byteCount bytes in this InputStream. Subsequent calls to read will not return these bytes unless reset is used. This implementation skips byteCount number of bytes in the target stream. It does nothing and returns 0 if byteCount is negative.
        Overrides:
        skip in class InputStream
        Parameters:
        byteCount - the number of bytes to skip.
        Returns:
        the number of bytes actually skipped.


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: 468 / 158716509. Delta: 0.03077 с