Guest User

Untitled

a guest
Aug 10th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  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"); - пробовал разные кодировки, не помогло
Add Comment
Please, Sign In to add comment