这样行不行?- 把String变成一个char[]
- 把这个char[]wrap成一个java.io.InputStream

解决方案 »

  1.   

    ByteArrayInputStream bais = new ByteArrayInputStream(str.getBytes());
      

  2.   

    FileOutputStream xmlStringOut = null;
    try{
       xmlStringOut = new FileOutputStream("name");
    }catch(FileNotFoundException e){
      System.out.println("You have to create a file");
    }
    String s = "EQWRQWRWQ";
    try{
       xmlStringOut.write(s.getBytes());
    }catch(IOException e){}