X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=src%2Fde%2Fj32%2Futil%2FUtil.java;h=bbf5295469b929776849c0ac933c21656beb6b3e;hb=e4126a1787b7045a53f6074e9ef15681c9f5fde4;hp=db43919e14ea2568253b061de5ab109321c234d0;hpb=276d9a69fa796728169c2992921a1e4bd875f549;p=jpim.git diff --git a/src/de/j32/util/Util.java b/src/de/j32/util/Util.java index db43919..bbf5295 100644 --- a/src/de/j32/util/Util.java +++ b/src/de/j32/util/Util.java @@ -6,39 +6,38 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.Iterator; -public class Util { +public class Util +{ - public static E nonnull(E ob) - { - if (ob == null) - throw new NullPointerException(); - return ob; - } + public static E nonnull(E ob) + { + if (ob == null) throw new NullPointerException(); + return ob; + } - public static void transfer(InputStream is, OutputStream os) - throws IOException - { - byte[] buffer = new byte[16384]; - int len = -1; - while ((len = is.read(buffer)) != -1) - os.write(buffer, 0, len); - } + public static void transfer(InputStream is, OutputStream os) + throws IOException + { + byte[] buffer = new byte[16384]; + int len = -1; + while ((len = is.read(buffer)) != -1) + os.write(buffer, 0, len); + } - public static void nothrowClose(Closeable c) - { - if (c != null) { - try { - c.close(); - } - catch (IOException e) {} - } - } - - public static E first(Iterable i) - { - Iterator it = i.iterator(); - if (it.hasNext()) - return it.next(); - return null; - } + public static void nothrowClose(Closeable c) + { + if (c != null) { + try { + c.close(); + } + catch (IOException e) {} + } + } + + public static E first(Iterable i) + { + Iterator it = i.iterator(); + if (it.hasNext()) return it.next(); + return null; + } }