@Test(expected = ProcessOpenException.class) public void openWriteThrowsIfProcessDoesntExist() throws IOException { Files.createDirectories(procRoot); Integer pid = 3551; assertFalse(Files.exists(procRoot.resolve(pid + ""))); provider.openWrite(pid); }
@Override public SeekableByteChannel openWrite(int pid) throws ProcessOpenException { Path memFile = createPathToProcessMemoryFile(pid); try { return Files.newByteChannel(memFile, StandardOpenOption.WRITE); } catch (IOException ex) { String message = String.format( "Failed to open process %d for writing! See getCause()!", pid ); throw new ProcessOpenException(message, ex); } }
FileMemoryProvider implements ReadableMemoryProvider, WritableMemoryProvider { @Override public SeekableByteChannel openWrite(int pid) throws ProcessOpenException { Path memFile = createPathToProcessMemoryFile(pid); try { return Files.newByteChannel(memFile, StandardOpenOption.WRITE); } catch (IOException ex) { String message = String.format( "Failed to open process %d for writing! See getCause()!", pid ); throw new ProcessOpenException(message, ex); } } }
FileMemoryProvider implements ReadableMemoryProvider, WritableMemoryProvider { @Override public SeekableByteChannel openWrite(int pid) throws ProcessOpenException { Path memFile = createPathToProcessMemoryFile(pid); try { return Files.newByteChannel(memFile, StandardOpenOption.WRITE); } catch (IOException ex) { String message = String.format( "Failed to open process %d for writing! See getCause()!", pid ); throw new ProcessOpenException(message, ex); } } FileMemoryProvider(Path procRoot); }
FileMemoryProvider implements ReadableMemoryProvider, WritableMemoryProvider { @Override public SeekableByteChannel openWrite(int pid) throws ProcessOpenException { Path memFile = createPathToProcessMemoryFile(pid); try { return Files.newByteChannel(memFile, StandardOpenOption.WRITE); } catch (IOException ex) { String message = String.format( "Failed to open process %d for writing! See getCause()!", pid ); throw new ProcessOpenException(message, ex); } } FileMemoryProvider(Path procRoot); @Override SeekableByteChannel openRead(int pid); @Override SeekableByteChannel openWrite(int pid); }
FileMemoryProvider implements ReadableMemoryProvider, WritableMemoryProvider { @Override public SeekableByteChannel openWrite(int pid) throws ProcessOpenException { Path memFile = createPathToProcessMemoryFile(pid); try { return Files.newByteChannel(memFile, StandardOpenOption.WRITE); } catch (IOException ex) { String message = String.format( "Failed to open process %d for writing! See getCause()!", pid ); throw new ProcessOpenException(message, ex); } } FileMemoryProvider(Path procRoot); @Override SeekableByteChannel openRead(int pid); @Override SeekableByteChannel openWrite(int pid);  }