/** {@inheritDoc} */ @Override public void close() throws IOException { is.close(); }
/** * Read some data from the given file with the given offset. * * @param path File path. * @param off Offset. * @param len Length. * @throws Exception If failed. */ private void read(IgfsPath path, int off, int len) throws Exception { IgfsInputStream is = igfsPrimary.open(path); is.readFully(off, new byte[len]); is.close(); }
/** {@inheritDoc} */ @Override public void handleFile(String strPath) throws Exception { IgfsPath path = new IgfsPath(strPath); IgfsInputStream in; try { in = fs.open(path); } catch (IgfsPathNotFoundException ex) { System.out.println("file " + path.toString() + " not exist: " + ex); throw ex; } catch (IgniteException ex) { System.out.println("open file " + path.toString() + " failed: " + ex); throw ex; } try { for (int i = 0; i < size / dataBufer.capacity(); i++) in.read(dataBufer.array()); } catch (IOException ex) { System.out.println("read file " + path.toString() + " failed: " + ex); throw ex; } finally { in.close(); } }
/** @throws Exception If failed. */ @Test public void testMultipleClose() throws Exception { IgniteFileSystem fs = igfsPrimary[0]; IgfsOutputStream out = fs.create(new IgfsPath("/primary/file"), false); out.close(); out.close(); IgfsInputStream in = fs.open(new IgfsPath("/primary/file")); in.close(); in.close(); IgfsMetrics m = fs.metrics(); assertEquals(0, m.filesOpenedForWrite()); assertEquals(0, m.filesOpenedForRead()); }
actIn.close();
total + ']'; is.close();
/** {@inheritDoc} */ @Override public void close() throws IOException { is.close(); }