daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class ByteArrayInputReset {
  2. public static void main(String[] args) throws UnsupportedEncodingException {
  3.     String tmp = "abc"; // - Проблема ТУТ
  4.     byte buf[] = tmp.getBytes();
  5.  
  6.     ByteArrayInputStream in = new ByteArrayInputStream(buf);
  7.  
  8.     for (int i = 0; i < 2 ; i++) {
  9.         int c;
  10.         while ((c=in.read()) !=-1){
  11.             if (i==0){
  12.                 System.out.print((char) c);
  13.             }else {
  14.                 System.out.print(Character.toUpperCase((char)c));
  15.             }
  16.         }
  17.         System.out.println();
  18.         in.reset();
  19.     }
  20. }
  21.  
  22. }
  23.    
  24. byte buf[] = tmp.getBytes("UTF-8");  - пробовал разные кодировки, не помогло
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top