Pārlūkot izejas kodu

Merge pull request #50 from csmith/master

Add @WillClose annotations.
pull/51/head
Greg Holmes 9 gadus atpakaļ
vecāks
revīzija
d2327bc81b

+ 4
- 2
src/com/dmdirc/util/io/StreamIgnorer.java Parādīt failu

27
 import java.io.InputStream;
27
 import java.io.InputStream;
28
 import java.io.InputStreamReader;
28
 import java.io.InputStreamReader;
29
 
29
 
30
+import javax.annotation.WillClose;
31
+
30
 /**
32
 /**
31
  * Stream reader to read, but ignore a stream.
33
  * Stream reader to read, but ignore a stream.
32
  */
34
  */
38
     /**
40
     /**
39
      * Create a new Stream Ignorer that discards output.
41
      * Create a new Stream Ignorer that discards output.
40
      *
42
      *
41
-     * @param stream The stream to ignore
43
+     * @param stream The stream to ignore, closed once {@link #run} is called.
42
      */
44
      */
43
-    StreamIgnorer(final InputStream stream) {
45
+    StreamIgnorer(@WillClose final InputStream stream) {
44
         super("StreamIgnorer");
46
         super("StreamIgnorer");
45
 
47
 
46
         this.stream = stream;
48
         this.stream = stream;

+ 3
- 1
src/com/dmdirc/util/io/StreamUtils.java Parādīt failu

26
 import java.io.IOException;
26
 import java.io.IOException;
27
 import java.io.InputStream;
27
 import java.io.InputStream;
28
 
28
 
29
+import javax.annotation.WillClose;
30
+
29
 /**
31
 /**
30
  * Utilities for dealing with streams.
32
  * Utilities for dealing with streams.
31
  *
33
  *
37
     private StreamUtils() {
39
     private StreamUtils() {
38
     }
40
     }
39
 
41
 
40
-    public static void readStream(final InputStream inputStream) {
42
+    public static void readStream(@WillClose final InputStream inputStream) {
41
         new StreamIgnorer(inputStream).run();
43
         new StreamIgnorer(inputStream).run();
42
     }
44
     }
43
 
45
 

Notiek ielāde…
Atcelt
Saglabāt