CommonUtils.java 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package pub.vie.excel.common.utils;
  2. import java.io.Closeable;
  3. import java.io.IOException;
  4. /**
  5. * @Descrption :
  6. * @Author: zoujie
  7. * @Date: 2020-4-14
  8. */
  9. public class CommonUtils {
  10. public static void close(Closeable... closeables){
  11. if(closeables != null && closeables.length > 0){
  12. for (Closeable closeable : closeables) {
  13. try {
  14. if(closeable != null) {
  15. closeable.close();
  16. }
  17. } catch (IOException e) {
  18. e.printStackTrace();
  19. }
  20. }
  21. }
  22. }
  23. public static boolean isBlank(CharSequence cs){
  24. int strLen;
  25. if (cs != null && (strLen = cs.length()) != 0) {
  26. for(int i = 0; i < strLen; ++i) {
  27. if (!Character.isWhitespace(cs.charAt(i))) {
  28. return false;
  29. }
  30. }
  31. return true;
  32. } else {
  33. return true;
  34. }
  35. }
  36. public static boolean arrayEmpty(Object[] objects) {
  37. return objects == null || objects.length < 1;
  38. }
  39. }