char_ready_p.java 453 B

123456789101112131415161718192021
  1. package kawa.standard;
  2. public class char_ready_p {
  3. public static boolean ready (Object arg1)
  4. {
  5. try
  6. {
  7. if (arg1 instanceof java.io.InputStream)
  8. return ((java.io.InputStream) arg1).available () > 0;
  9. else if (arg1 instanceof java.io.Reader)
  10. return ((java.io.Reader)arg1).ready();
  11. else
  12. throw new ClassCastException("invalid argument to char-ready?");
  13. }
  14. catch (java.io.IOException ex)
  15. {
  16. return false;
  17. }
  18. }
  19. }