fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // echo "тест тест" | iconv -f 'utf-8' -t 'windows-1251' | base64
  13.  
  14. byte[] decodedBytes = Base64.getDecoder().decode("0YLQtdGB0YIg0YLQtdGB0YIK");
  15. System.out.println(new String(decodedBytes) + "\n");
  16. System.out.println(new String(decodedBytes, "windows-1251") + "\n");
  17.  
  18.  
  19. final StringBuilder responseString = new StringBuilder();
  20.  
  21. final BufferedReader reader = new BufferedReader(
  22. new InputStreamReader(new ByteArrayInputStream(decodedBytes), "windows-1251"));
  23. String line;
  24. while ((line = reader.readLine()) != null) {
  25. responseString.append(line);
  26. }
  27. reader.close();
  28.  
  29. System.out.println(responseString.toString());
  30. }
  31. }
Success #stdin #stdout 0.12s 57672KB
stdin
Standard input is empty
stdout
тест тест


тест тест


тест тест