zoukankan      html  css  js  c++  java
  • java 内存操作流

     1 package hjw;
    2 import java.io.ByteArrayInputStream;
    3 import java.io.ByteArrayOutputStream;
    4 import java.io.IOException;
    5 //import org.omg.CORBA_2_3.portable.OutputStream;
    6 public class dm {
    7 public static void main(String[] args) throws Exception {
    8 String str="HELLOWORLD";
    9 ByteArrayInputStream bis=new ByteArrayInputStream(str.getBytes());
    10 ByteArrayOutputStream bos=new ByteArrayOutputStream();
    11 int temp=0;
    12 while((temp=bis.read())!=-1){
    13 char c=(char) temp;
    14 bos.write(Character.toLowerCase(c));
    15 }
    16 String newStr=bos.toString();
    17 try{
    18 bis.close();
    19 bos.close();
    20 }catch (IOException e){
    21 e.printStackTrace();
    22 }
    23 System.out.println(newStr);
    24 }
    25 }
    26

    完成了大写字母装换成小写字母、、、

  • 相关阅读:
    对于git的认识
    第一篇博客
    结对编程
    对git的认识
    李叔同先生的《梦》
    51nod 1449 砝码称重
    LeetCode 21-29题解
    LeetCode 11-20题解
    LeetCode 6-10 题解
    LeetCode刷题重启博客
  • 原文地址:https://www.cnblogs.com/dennisac/p/2408819.html
Copyright © 2011-2022 走看看