Javase Advanced Section No. 09 byte array input stream Bytearrayinputstream

Source: Internet
Author: User

2016-07-24

1,bytearrayinputstream

The input source for FileInputStream is a file.

The input source of the Bytearrayinputstream is a byte array.

Reset () resets to the location of the mark tag, if the Mark method has not been called,

Reset to the starting position of the buffer (ByteArray)

Mark (int)

 Packagecom.java1995;ImportJava.io.ByteArrayInputStream; Public classTestbytearrayinputstream { Public Static voidMain (string[] args) {String temp= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; byte[] B =temp.getbytes (); Bytearrayinputstream bis=NewBytearrayinputstream (b);  for(inti = 0; I < 2; i++) {            intC; C=Bis.read ();  while(c! =-1) {                if(i = = 0) {System.out.print (Char) c); } Else{System.out.print (character.touppercase (Char) (c)); } C=Bis.read ();            } System.out.println ();        Bis.reset (); }    }}

Resources

[1] Java Easy Start Classic tutorial "full version"

Javase Advanced Section No. 09 byte array input stream Bytearrayinputstream

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.