/** * Returns the current window size of this PTY. * * @return a {@link WinSize} instance with information about the master side of the PTY, never * <code>null</code>. * @throws IOException in case obtaining the window size failed. */ public WinSize getWinSize() throws IOException { WinSize result = new WinSize(); if (JPty.getWinSize(m_fdMaster, result) < 0) { throw new IOException("Failed to get window size: " + JPty.errno()); } return result; }
/** * Sets the current window size of this PTY. * * @param winSize the {@link WinSize} instance to set on the master side of the PTY, cannot be * <code>null</code>. * @throws IllegalArgumentException in case the given argument was <code>null</code>. * @throws IOException in case obtaining the window size failed. */ public void setWinSize(WinSize winSize) throws IOException { if (winSize == null) { throw new IllegalArgumentException("WinSize cannot be null!"); } if (JPty.setWinSize(m_fdMaster, winSize) < 0) { throw new IOException("Failed to set window size: " + JPty.errno()); } }