Tabnine Logo
X_Util
Code IndexAdd Tabnine to your IDE (free)

How to use
X_Util
in
xapi.util

Best Java code snippets using xapi.util.X_Util (Showing top 15 results out of 315)

origin: net.wetheinter/xapi-dev-api

@Override
public boolean hasNext() {
 try {
  next = reader.readLine();
  if (next == null) {
   reader.close();
   return false;
  }
  return true;
 }catch(IOException e) {
  throw X_Util.rethrow(e);
 }
}
origin: net.wetheinter/xapi-core-collect

@Override
public boolean findRemove(E value, boolean all) {
 ListIterator<E> iter = list.listIterator();
 boolean removed = false;
 while (iter.hasNext()) {
  E next = iter.next();
  if (X_Util.equal(next, value)) {
   iter.remove();
   if (!all)
    return true;
   removed = true;
  }
 }
 return removed;
}
origin: net.wetheinter/xapi-core-io

 @Override
 public void onError(final Throwable e) {
  final Throwable unwrapped = X_Util.unwrap(e);
  if (unwrapped instanceof UnknownHostException) {
   failure[0] = true;
  } else if (unwrapped instanceof SocketException) {
   failure[0] = true;
  } else {
   e.printStackTrace();
   X_Util.rethrow(e);
  }
 }
});
origin: net.wetheinter/xapi-core-io

 } catch (final Throwable t) {
  X_Log.error("Error invoking IO callback on",callback,"for request",url, t);
  callback.onError(X_Util.unwrap(t));
 callback.onError(X_Util.unwrap(t));
} finally {
 request.connectionThread = null;
origin: net.wetheinter/xapi-dev-api

 @Override
 public Iterator<String> iterator() {
  try {
   // reader is closed by StringReader
   BufferedReader reader = new BufferedReader(new InputStreamReader(open()));
   return new StringReader(reader);
  } catch (IOException e) {
   throw X_Util.rethrow(e);
  }
 }
};
origin: net.wetheinter/xapi-core-process

protected <T> void callback(Future<T> future, ReceivesValue<T> receiver) {
 try {
  receiver.set(future.get());
  return;
 } catch (InterruptedException e) {
  debug(e);
  Thread.interrupted();
 } catch (ExecutionException e) {
  debug(e);
  throw X_Util.rethrow(X_Util.unwrap(e));
 }
}
origin: net.wetheinter/xapi-core-api

@Override
public boolean equals(Object obj) {
 if (obj == this)return true;
 if (obj instanceof Pair){
  Pair<?, ?> that = (Pair<?, ?>) obj;
  if (X_Util.equal(x, that.get0())){
   return X_Util.equal(y, that.get1());
  }
 }
 if (obj instanceof Entry){
  Entry<?, ?> that = (Entry<?, ?>) obj;
  if (X_Util.equal(x, that.getKey())){
   return X_Util.equal(y, that.getValue());
  }
 }
 return false;
}
origin: net.wetheinter/xapi-dev-maven

@Override
public Model loadPomString(String pomString) throws XmlPullParserException {
 try {
  return new MavenXpp3Reader().read(new StringReader(pomString));
 } catch (IOException ignored) {
  throw X_Util.rethrow(ignored);
 }
}
origin: net.wetheinter/xapi-gwt-collect

@Override
public final boolean contains(final E value) {
 for (final E e : forEach()) {
  if (X_Util.equal(value, e)) {
   return true;
  }
 }
 return false;
}
origin: net.wetheinter/xapi-dev-api

static ResourceCollection fromUrl(URL url, String pkg) {
 String path = url.toExternalForm();
 File file;
 boolean jarUrl = path.startsWith("jar:");
 if (jarUrl) path = path.substring("jar:".length());
 boolean fileUrl = path.startsWith("file:");
 if (fileUrl) path = path.substring("file:".length());
 boolean jarFile = path.contains(".jar!");
 if (jarFile) path = path.substring(0, path.indexOf(".jar!") + ".jar".length());
 if (!(file = new java.io.File(path)).exists()) {
  path = path.replace("%20", " ");
  if (!(file = new java.io.File(path)).exists()) {
   //should be impossible since we get these urls from classloader
   throw X_Util.rethrow(new FileNotFoundException());
  }
 }
 try {
  //TODO getOrMake; use an InitWithParamMap
  if (url.getProtocol().equals("jar")) {
   return new ResourceCollection(pkg, ((JarURLConnection)url.openConnection()).getJarFile());
  }
  assert url.getProtocol().equals("file") : "ResourceCollection only handles url and file protocols";
  if (jarFile) {
   return new ResourceCollection(pkg, new JarFile(file));
  }
  return new ResourceCollection(file);
 }catch (IOException e) {
  throw X_Util.rethrow(e);
 }
}
origin: net.wetheinter/xapi-core-process

public boolean ifNext(K position) {
 if (equal(todo[this.position], position)) {
  bump();
  return true;
 }
 return false;
}
origin: net.wetheinter/xapi-core-ui-autoui

protected <X> X create(Class<? extends X> renderer) {
 try {
  return renderer.newInstance();
 } catch (InstantiationException e) {
  throw X_Debug.rethrow(e.getCause() == null ? e : e.getCause());
 } catch (IllegalAccessException e) {
  throw X_Util.rethrow(e);
 }
}
origin: net.wetheinter/xapi-gwt-collect

@Override
public final int indexOf(final E value) {
 for (int i = 0, m = size(); i < m; i++) {
  if (X_Util.equal(getValue(i), value)) {
   return i;
  }
 }
 return -1;
}
origin: net.wetheinter/xapi-dev-api

public static synchronized File getXApiHome() {
  // We purposely don't cache this value so users can change it at runtime.
  String loc = X_Properties.getProperty(X_Namespace.PROPERTY_XAPI_HOME);
  try {
   if (loc == null) {
    // use a temporary directory instead
    File f = File.createTempFile("xapi", "home");
    loc = f.getAbsolutePath();
    X_Properties.setProperty(X_Namespace.PROPERTY_XAPI_HOME, loc);
    return f;
   }
   File home = new File(loc);
   if (!home.exists()) {
    X_Log.info("XApi home @ "+home.getCanonicalPath()+" does not exist.");
    if (home.mkdirs()) {
     X_Log.info("Successfully created home directory");
    } else {
     X_Log.warn("Unable to create home directory; using temp file.");
     X_Properties.setProperty(X_Namespace.PROPERTY_XAPI_HOME, null);
     return getXApiHome();
    }
   }
   return home;
  } catch (Throwable e) {
   throw X_Util.rethrow(e);
  }
 }
origin: net.wetheinter/xapi-gwt-collect

@Override
public final boolean findRemove(final E value, final boolean all) {
 boolean removed = false;
 for (int i = 0, m = size(); i < m; i++) {
  final E next = getValue(i);
  if (X_Util.equal(next, value)) {
   remove(i--);
   if (!all) {
    return true;
   }
   removed = true;
  }
 }
 return removed;
}
xapi.utilX_Util

Javadoc

Generic purpose utility methods; this class has no fields, no

Most used methods

  • rethrow
  • equal
  • unwrap

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now