/** * Get the (numeric) group IDs. * * @return The numeric user ID * @throws JSchException If a problem occurs while retrieving the group ID. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int getUId() throws JSchException, IOException { if (uid < 0) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -u", output); if (code != 0) { throw new FileSystemException( "Could not get the user id of the current user (error code: " + code + ")"); } uid = Integer.parseInt(output.toString().trim()); } return uid; }
/** * Get the (numeric) group IDs. * * @return The numeric user ID * @throws JSchException If a problem occurs while retrieving the group ID. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int getUId() throws JSchException, IOException { if (uid < 0) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -u", output); if (code != 0) { throw new FileSystemException( "Could not get the user id of the current user (error code: " + code + ")"); } uid = Integer.parseInt(output.toString().trim()); } return uid; }
/** * Get the (numeric) group IDs. * * @return The numeric user ID * @throws JSchException If a problem occurs while retrieving the group ID. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int getUId() throws JSchException, IOException { if (uid < 0) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -u", output); if (code != 0) { throw new FileSystemException( "Could not get the user id of the current user (error code: " + code + ")"); } uid = Integer.parseInt(output.toString().trim()); } return uid; }
/** * Get the (numeric) group IDs. * * @return The numeric user ID * @throws JSchException If a problem occurs while retrieving the group ID. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int getUId() throws JSchException, IOException { if (uid < 0) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -u", output); if (code != 0) { throw new FileSystemException("Could not get the user id of the current user (error code: " + code + ")"); } uid = Integer.parseInt(output.toString().trim()); } return uid; }
/** * Gets the (numeric) group IDs. * * @return the (numeric) group IDs. * @throws JSchException If a problem occurs while retrieving the group IDs. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int[] getGroupsIds() throws JSchException, IOException { if (groupsIds == null) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -G", output); if (code != 0) { throw new JSchException("Could not get the groups id of the current user (error code: " + code + ")"); } // Retrieve the different groups final String[] groups = output.toString().trim().split("\\s+"); final int[] groupsIds = new int[groups.length]; for (int i = 0; i < groups.length; i++) { groupsIds[i] = Integer.parseInt(groups[i]); } this.groupsIds = groupsIds; } return groupsIds; }
/** * Gets the (numeric) group IDs. * * @return the (numeric) group IDs. * @throws JSchException If a problem occurs while retrieving the group IDs. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int[] getGroupsIds() throws JSchException, IOException { if (groupsIds == null) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -G", output); if (code != 0) { throw new JSchException("Could not get the groups id of the current user (error code: " + code + ")"); } // Retrieve the different groups final String[] groups = output.toString().trim().split("\\s+"); final int[] groupsIds = new int[groups.length]; for (int i = 0; i < groups.length; i++) { groupsIds[i] = Integer.parseInt(groups[i]); } this.groupsIds = groupsIds; } return groupsIds; }
/** * Gets the (numeric) group IDs. * * @return the (numeric) group IDs. * @throws JSchException If a problem occurs while retrieving the group IDs. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int[] getGroupsIds() throws JSchException, IOException { if (groupsIds == null) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -G", output); if (code != 0) { throw new JSchException("Could not get the groups id of the current user (error code: " + code + ")"); } // Retrieve the different groups final String[] groups = output.toString().trim().split("\\s+"); final int[] groupsIds = new int[groups.length]; for (int i = 0; i < groups.length; i++) { groupsIds[i] = Integer.parseInt(groups[i]); } this.groupsIds = groupsIds; } return groupsIds; }
/** * Gets the (numeric) group IDs. * * @return the (numeric) group IDs. * @throws JSchException If a problem occurs while retrieving the group IDs. * @throws IOException if an I/O error is detected. * @since 2.1 */ public int[] getGroupsIds() throws JSchException, IOException { if (groupsIds == null) { final StringBuilder output = new StringBuilder(); final int code = executeCommand("id -G", output); if (code != 0) { throw new JSchException("Could not get the groups id of the current user (error code: " + code + ")"); } // Retrieve the different groups final String[] groups = output.toString().trim().split("\\s+"); final int[] groupsIds = new int[groups.length]; for (int i = 0; i < groups.length; i++) { groupsIds[i] = Integer.parseInt(groups[i]); } this.groupsIds = groupsIds; } return groupsIds; }