diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/Util.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/Util.java | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/main/java/cuchaz/enigma/Util.java b/src/main/java/cuchaz/enigma/Util.java index 1bcdb9ea..9445b2b4 100644 --- a/src/main/java/cuchaz/enigma/Util.java +++ b/src/main/java/cuchaz/enigma/Util.java | |||
| @@ -41,27 +41,6 @@ public class Util { | |||
| 41 | return result; | 41 | return result; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public static void closeQuietly(Closeable closeable) { | ||
| 45 | if (closeable != null) { | ||
| 46 | try { | ||
| 47 | closeable.close(); | ||
| 48 | } catch (IOException ex) { | ||
| 49 | // just ignore any further exceptions | ||
| 50 | } | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | public static void closeQuietly(JarFile jarFile) { | ||
| 55 | // silly library should implement Closeable... | ||
| 56 | if (jarFile != null) { | ||
| 57 | try { | ||
| 58 | jarFile.close(); | ||
| 59 | } catch (IOException ex) { | ||
| 60 | // just ignore any further exceptions | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | public static String readStreamToString(InputStream in) throws IOException { | 44 | public static String readStreamToString(InputStream in) throws IOException { |
| 66 | return CharStreams.toString(new InputStreamReader(in, "UTF-8")); | 45 | return CharStreams.toString(new InputStreamReader(in, "UTF-8")); |
| 67 | } | 46 | } |
| @@ -86,14 +65,4 @@ public class Util { | |||
| 86 | } | 65 | } |
| 87 | } | 66 | } |
| 88 | } | 67 | } |
| 89 | |||
| 90 | public static void writeClass(CtClass c) { | ||
| 91 | String name = Descriptor.toJavaName(c.getName()); | ||
| 92 | File file = new File(name + ".class"); | ||
| 93 | try (FileOutputStream out = new FileOutputStream(file)) { | ||
| 94 | out.write(c.toBytecode()); | ||
| 95 | } catch (IOException | CannotCompileException ex) { | ||
| 96 | throw new Error(ex); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | } | 68 | } |