ByteArrayFileInputStream extends InputStream { @Override public void close() throws IOException { try { if (_fileInputStream != null) { _fileInputStream.close(); } } finally { _data = null; _fileInputStream = null; if (_deleteOnClose && (_file != null)) { _file.delete(); } _file = null; } } ByteArrayFileInputStream(File file, int threshold);  ByteArrayFileInputStream(
		File file, int threshold, boolean deleteOnClose); @Override int available(); @Override void close(); File getFile(); @Override void mark(int readLimit); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] bytes); @Override int read(byte[] bytes, int offset, int length); @Override void reset(); @Override long skip(long skip);  }
@Test public void testClose() throws Exception { ByteArrayFileInputStream byteArrayFileInputStream = new ByteArrayFileInputStream(_testFile, 512); byteArrayFileInputStream.read(); byteArrayFileInputStream.close(); Assert.assertNull(_dataField.get(byteArrayFileInputStream)); Assert.assertNull(_fileField.get(byteArrayFileInputStream)); Assert.assertNull(_fileInputStreamField.get(byteArrayFileInputStream)); Assert.assertTrue(_testFile.exists()); byteArrayFileInputStream = new ByteArrayFileInputStream( _testFile, 512, true); byteArrayFileInputStream.close(); Assert.assertNull(_dataField.get(byteArrayFileInputStream)); Assert.assertNull(_fileField.get(byteArrayFileInputStream)); Assert.assertNull(_fileInputStreamField.get(byteArrayFileInputStream)); Assert.assertFalse(_testFile.exists()); byteArrayFileInputStream.close(); }