Java stream (stream), file, and Io-java Bytearrayinputstream class

Source: Internet
Author: User

The byte array input stream creates a byte array buffer in memory, and the data read from the input stream is saved in the byte array buffer. There are several ways to create a byte array input stream Object.

The receive byte array is created as a parameter:

New Bytearrayinputstream (byte [] a);

Another way to create this is to receive a byte array, and two shaping variables off, Len,off represents the first read byte, and Len represents the length of the read Byte.

New Bytearrayinputstream (byteintint len)

After you have successfully created the byte array input stream object, you can see the following methods for reading or other operations of the Convection.

⊙ public int read (): reads the next data byte from this input Stream.

⊙ public int read (byte[] r, int off, int len): reads the maximum number len of data bytes from this input stream into a byte array.

⊙ public int available (): Returns the number of bytes read from this input stream without blocking.

⊙ public void Mark (int read): sets the current marker position in the Stream.

⊙ public Long Skip (long n): skips n an input byte from this input Stream.

Cheer Up--not to Be continued

Java stream (stream), file, and Io-java Bytearrayinputstream class

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.