List of usage examples for java.lang String copyValueOf
public static String copyValueOf(char data[])
From source file:MainProgram.MainProgram.java
public static boolean testPennStateAccount(boolean pennStateCorrect) throws InterruptedException { String passwordString = String.copyValueOf(MainFrameProgram.pennPassField.getPassword()); pennStateCorrect = WebDriver_Registration.testConnection(MainFrameProgram.pennIDTextField.getText(), passwordString);/*from w ww .jav a 2 s . c om*/ return pennStateCorrect; }
From source file:edu.utah.bmi.ibiomes.cli.CLIUtils.java
/** * Connect to iBIOMES/* w ww .j a v a2s.c o m*/ * @param password Password * @return Connection * @throws IOException * @throws CompressorException */ public static IRODSConnector getConnection(String username, String password, String server) throws IOException, JargonException, CompressorException { IRODSEnvironmentFile envFile = null; IRODSConnector cnx = null; Console objConsole = System.console(); if (objConsole == null) { System.err.println("Console Object is not available."); System.exit(1); } System.out.println("Authentication... "); try { envFile = IRODSEnvironmentFile.instance(); } catch (IOException e) { System.out.println("IRODS user info file not found!"); System.out.println("Make sure your .irodsEnv file exists in $HOME/.irods or $IBIOMES_HOME"); System.exit(1); } //while login fails while (cnx == null) { //retrieve iRODS password if (password == null) { if (username == null) username = envFile.getIrodsUserName(); System.out.println("iBIOMES password for " + username + ":"); char[] pwdArray = objConsole.readPassword(); password = String.copyValueOf(pwdArray); } //try to connect to iRODS system using default settings try { cnx = new IRODSConnector(username, password, server); try { //try to login IRODSAccessObjectFactory aoFactory = cnx.getFileSystem().getIRODSAccessObjectFactory(); aoFactory.getUserAO(cnx.getAccount()); } catch (JargonException exc) { System.out.println("\nLogin failed. Try again."); cnx = null; } } catch (IOException ioe) { System.out.println("\nCould not find login info..."); cnx = null; } catch (AuthenticationException ae) { System.out.println("\nLogin failed. Try again."); cnx = null; } password = null; } System.out.println("Authentication successful!"); return cnx; }
From source file:com.app.blockydemo.content.Script.java
public void setNextName() { String value = String.copyValueOf(name.toCharArray()); int pos = 0;// w ww . j a va 2 s . c o m boolean cont = true; while (cont) { cont = false; for (Script script : ProjectManager.getInstance().getCurrentSprite().getScriptList()) { if (script.getName().equals(value)) { cont = true; ++pos; value = String.copyValueOf(name.toCharArray()) + pos; } } } name = value; }
From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.ProvidedClassesCompleter.java
@Override public int indexOfStartCharacter(char[] line) { final String text = String.copyValueOf(line); final Matcher matcher = LAST_DOLLAR_CURLYBRACE.matcher(text); if (matcher.find()) { final int beginIndex = matcher.start(); final Matcher variableMatcher = LAST_VARIABLE.matcher(text); if (variableMatcher.find(beginIndex)) { return variableMatcher.start() - 1; }//ww w.j av a2 s . co m } return -1; }
From source file:com.codenjoy.dojo.tetris.model.TetrisFigure.java
private void performRotate() { char newRows[][] = new char[getWidth()][rows.length]; int newX = rows.length - centerY - 1; int newY = getLeft(); for (int y = 0; y < rows.length; y++) { String row = rows[y];/* www .j a v a 2s . c om*/ for (int x = 0; x < row.length(); x++) { char c = row.charAt(x); int shiftedX = x - centerX; int shiftedY = y - centerY; newRows[shiftedX + newY][-shiftedY + newX] = c; } } String[] rows = new String[newRows.length]; for (int i = 0; i < newRows.length; i++) { rows[i] = String.copyValueOf(newRows[i]); } parseRows(rows); centerX = newX; centerY = newY; }
From source file:com.jkovacic.rclient.RexecApache.java
/** * Executes a remote command over the r* daemon * /*from ww w . j a v a 2 s .c om*/ * @param processor - a class that will process the command's outputs * @param command to be executed remotely * * @return output of the command * * @throws RException if it fails */ public CliOutput exec(ICliProcessor processor, String command) throws RException { CliOutput retVal = null; // check of input parameters if (null == command || 0 == command.length()) { throw new RException("Nothing to execute"); } // is connection established? if (null == rexecContext) { throw new RException("Connection to rexec service not established"); } // connection is established, try to exec the command remotely try { rexecContext.rexec(cred.getUsername(), String.copyValueOf(cred.getPassword()), command, true); } catch (IOException ex) { throw new RException("Command execution failed"); } // ... and process its output try { retVal = processor.process(rexecContext.getOutputStream(), rexecContext.getInputStream(), rexecContext.getErrorStream()); } catch (CliException ex) { throw new RException("Could not process output streams"); } // processor.process returns when the remote process is terminated // The library does not support exit code retVal.exitCode = CliOutput.EXITCODE_NOT_SET; return retVal; }
From source file:mitm.common.security.certificate.GenerateKeyPairs.java
private String bytesToHex(byte[] bytes) throws IOException { String hex = String.copyValueOf(Hex.encodeHex(bytes)); return FixedWidthReader.fixedWidth(hex, WIDTH); }
From source file:de.juwimm.cms.http.HttpClientWrapper.java
/** * /* w w w .j a va 2 s . c o m*/ * @param testUrlString * destination * @param userName * for authentication at testUrlString NOT for proxy * @param password * for authentication at testUrlString NOT for proxy * @throws HttpException */ public void testAndConfigureConnection(String testUrlString, String userName, String password) throws HttpException { URL testURL = null; try { testURL = new URL(testUrlString); } catch (MalformedURLException exe1) { throw new HttpException( HttpMessages.getString("HttpClientWrapper.testConnectionFailed", testUrlString, "\n")); } DlgUsernamePassword dlg = new DlgUsernamePassword(); if ((getHttpProxyUser() == null || "".equalsIgnoreCase(getHttpProxyUser())) && getHttpProxyPassword() == null || "".equalsIgnoreCase(getHttpProxyPassword())) { dlg.getTxtUsername().setText(System.getProperty("user.name")); } else { dlg.getTxtUsername().setText(getHttpProxyUser()); } dlg.getTxtPassword().setText(getHttpProxyPassword()); // dlg.getTxtNTDomain().setText(httpProxyNTDomain); // try no auth, base auth, ntlm auth with user giving username and // password until successful while (true) { try { testAndConfigureConnectionTryInvoke(testURL, userName, password); // save password only if connect successful saveProperties(dlg.getCboSave().isSelected()); break; } catch (URIException exe) { // http-Error-Code: 407 = Proxy Authentication Required if (exe.getReasonCode() == 407) { // ask user for user and password dlg.setVisible(true); if (dlg.isCanceled()) { throw new HttpException( HttpMessages.getString("HttpClientWrapper.noProxyWhereNeededExeption")); } setHttpProxyUser(dlg.getTxtUsername().getText()); setHttpProxyPassword(String.copyValueOf(dlg.getTxtPassword().getPassword())); // httpProxyNTDomain = dlg.getTxtNTDomain().getText(); } else { throw new HttpException(HttpMessages.getString("HttpClientWrapper.testConnectionFailed", testURL.getHost(), exe.getMessage())); } } } log.debug("finished test"); }
From source file:edu.utah.bmi.ibiomes.cli.CLIUtils.java
/** * Connect to iRODS using parameters given in command-line interface. * @return Connection object/*from w w w . j a v a 2 s. c om*/ * @throws IOException * @throws JargonException */ public static IRODSConnector getConnectionFromCLI() throws IOException, JargonException { Console objConsole = System.console(); if (objConsole == null) { System.err.println("Console Object is not available."); System.exit(1); } BufferedReader in = new BufferedReader(new InputStreamReader(System.in, "UTF-8")); System.out.println("Host:"); String host = in.readLine(); System.out.println("Port [1247]:"); String iPort = in.readLine(); int port = 1247; if (iPort != null && iPort.length() > 0) port = Integer.parseInt(iPort); System.out.println("Zone:"); String zone = in.readLine(); System.out.println("Default resource:"); String server = in.readLine(); System.out.println("Username:"); String userName = in.readLine(); //retrieve iRODS password System.out.println("Password:"); char[] pwdArray = objConsole.readPassword(); String password = String.copyValueOf(pwdArray); IRODSConnector cnx = new IRODSConnector(host, port, userName, password, "", zone, server); try { //try to login IRODSAccessObjectFactory aoFactory = cnx.getFileSystem().getIRODSAccessObjectFactory(); aoFactory.getUserAO(cnx.getAccount()); System.out.println("\nConnected! (" + cnx.getAccount().toURI(false) + ")"); } catch (JargonException exc) { System.out.println("Login info: " + cnx.getAccount().getUserName() + "@" + cnx.getAccount().getHost() + ":" + cnx.getAccount().getPort() + ")."); System.out.println("Login failed. Try again."); cnx = null; } return cnx; }