File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed
pg/src/main/java/org/bouncycastle/apache/bzip2 Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,11 @@ public CBZip2InputStream(InputStream zStream)
140140 beginBlock ();
141141 }
142142
143+ public void close () throws IOException
144+ {
145+ implClose (true );
146+ }
147+
143148 public int read ()
144149 throws IOException
145150 {
@@ -186,7 +191,7 @@ private void beginBlock()
186191 throw new IOException ("Stream CRC error" );
187192 }
188193
189- bsFinishedWithStream ();
194+ // TODO If not a LeaveOpen stream, should we check that we are at the end of stream here?
190195 streamEnd = true ;
191196 return ;
192197 }
@@ -250,22 +255,16 @@ private void endBlock()
250255 streamCRC = Integers .rotateLeft (streamCRC , 1 ) ^ blockFinalCRC ;
251256 }
252257
253- private void bsFinishedWithStream ()
258+ private void implClose ( boolean closeInput ) throws IOException
254259 {
255- try
260+ if ( this . bsStream != null )
256261 {
257- if (this . bsStream != null )
262+ if (closeInput )
258263 {
259- if (this .bsStream != System .in )
260- {
261- this .bsStream .close ();
262- this .bsStream = null ;
263- }
264+ this .bsStream .close ();
264265 }
265- }
266- catch (IOException ioe )
267- {
268- //ignore
266+
267+ this .bsStream = null ;
269268 }
270269 }
271270
You can’t perform that action at this time.
0 commit comments