List of usage examples for java.util Vector Vector
public Vector()
From source file:Main.java
private static String[] filter(String[] p_array, boolean p_includeComments) { String[] result = p_array;/*from w w w . j a v a2 s . c o m*/ if (!p_includeComments) { Vector v = new Vector(); for (int i = 0; i < p_array.length; i++) { String s = p_array[i]; if (s.indexOf("<!--") < 0) { v.addElement(s); } } result = new String[v.size()]; for (int i = 0; i < v.size(); i++) { result[i] = (String) v.elementAt(i); } } return result; }
From source file:Main.java
/** * Equivalent to {@code new Vector<T>()}. * //w w w . j a v a2 s .c om * @param <T> see {@link Vector#Vector()}. * * @return {@code new Vector<T>()} */ public static <T> Vector<T> newVector() { return new Vector<T>(); }
From source file:Main.java
public static Vector<String> readXMLNode222(String xmlFile, String xpath) { try {/*w w w . j a v a 2s . c o m*/ XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); // XPathExpression xPathExpression = // xPath.compile("/history"); File xmlDocument = new File(xmlFile); InputSource inputSource = new InputSource(new FileInputStream(xmlDocument)); // String root = xPath.evaluate("/", inputSource); NodeList nodes = (NodeList) xPath.evaluate(xpath, inputSource, XPathConstants.NODESET); Vector<String> vector = new Vector<String>(); for (int x = 0; x < nodes.getLength(); x++) { vector.add(nodes.item(x).getTextContent()); } return vector; } catch (Exception ex) { ex.printStackTrace(); return new Vector(); } }
From source file:Main.java
/** * Vector of child elements of an element *///from w ww. j a v a 2s. c o m public static Vector<Element> childElements(Element el) { Vector<Element> res = new Vector<Element>(); NodeList nodes = el.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node nd = nodes.item(i); if (nd instanceof Element) { Element eg = (Element) nd; res.addElement(eg); } } return res; }
From source file:Main.java
public static Vector emptyIfNull(Vector v) { return v == null ? new Vector() : v; }
From source file:Main.java
/** * @param context/*from w w w. j a va 2 s . c o m*/ * this method is used for retrieving email accounts of device * @return */ public static String[] getAccount(Context context) { final AccountManager accountManager = AccountManager.get(context); final Account[] accounts = accountManager.getAccounts(); final Vector<String> accountVector = new Vector<String>(); for (int i = 0; i < accounts.length; i++) { if (!accountVector.contains(accounts[i].name) && isValidEmail(accounts[i].name)) { accountVector.addElement(accounts[i].name); } } final String accountArray[] = new String[accountVector.size()]; return accountVector.toArray(accountArray); }
From source file:Main.java
public static Vector<String> split(String s, char sep) { if (s == null) { return null; }//from w w w . j a va2 s .c om Vector v = new Vector<String>(); while (s.length() != 0) { int pos = s.indexOf(sep); if (pos >= 0) { v.add(s.substring(0, pos)); s = s.substring(pos + 1, s.length()); if (s.length() == 0) { v.add(""); // letztes (leeres) Element hinter letztem Trennzeichen } } else if (s.length() > 0) { v.add(s); s = ""; } } return v; }
From source file:Main.java
/** * Extracts attribute values from tag string. * //from w ww. j av a 2 s.c o m * @param tag * whole tag name * @return A vector with all attribute values * @deprecated use TagClass.getAttrList() instead */ public static Vector getAttributeValues(String tag) { Vector values = new Vector(); int start = tag.indexOf('='); int end; while (start != -1) { start = tag.indexOf('"', start + 1); end = tag.indexOf('"', start + 1); if ((start == -1) || (end == -1)) { break; } values.addElement(tag.substring(start + 1, end).intern()); start = tag.indexOf('=', end + 1); } return values; }
From source file:localization.split.java
public static Vector<String> readzipfile(String filepath) { Vector<String> v = new Vector<String>(); byte[] buffer = new byte[1024]; String outputFolder = filepath.substring(0, filepath.lastIndexOf(".")); System.out.println(outputFolder); try {/* w ww. j a v a2s. c om*/ File folder = new File(outputFolder); if (!folder.exists()) { folder.mkdir(); } ZipInputStream zis = new ZipInputStream(new FileInputStream(filepath)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFolder + "\\" + fileName); v.addElement(newFile.getAbsolutePath()); FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); ze = zis.getNextEntry(); } zis.closeEntry(); zis.close(); } catch (Exception e) { } return v; }
From source file:MainClass.java
public static PKCS10CertificationRequest generateRequest(KeyPair pair) throws Exception { GeneralNames subjectAltName = new GeneralNames(new GeneralName(GeneralName.rfc822Name, "test@test.test")); Vector oids = new Vector(); Vector values = new Vector(); oids.add(X509Extensions.SubjectAlternativeName); values.add(new X509Extension(false, new DEROctetString(subjectAltName))); X509Extensions extensions = new X509Extensions(oids, values); Attribute attribute = new Attribute(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest, new DERSet(extensions)); return new PKCS10CertificationRequest("SHA256withRSA", new X500Principal("CN=Requested Test Certificate"), pair.getPublic(), new DERSet(attribute), pair.getPrivate()); }