protected byte[] toBinary(final String convert) { return X_String.getBytes(convert); }
@Override protected ClassLoader initialValue() { if (X_Runtime.isDebug()) { X_Log.info("Maven compile scope: "+X_String.joinObjects(urls)); } return new URLClassLoader(urls, X_Maven.class.getClassLoader()); }; };
public synchronized void forwardTo(LineReader callback) { X_Log.debug(getClass(),getClass().getName(),"forwardingTo", callback.getClass().getName(),":", callback); if (b != null) {// not null only after we have started streaming callback.onStart(); for (String line : X_String.splitNewLine(b.toString())) { callback.onLine(line); } } delegates.give(callback); if (finished) { callback.onEnd(); } }
@Override public LocalArtifactResult loadLocalArtifact(String groupId, String artifactId, String classifier, String extension, String version) { Moment before = X_Time.now(); RepositorySystemSession session = this.session.get(); DefaultArtifact artifact = new DefaultArtifact( groupId,artifactId,classifier, X_String.isEmpty(extension) ? "jar" : extension, version); try { LocalArtifactRequest request = new LocalArtifactRequest(artifact, null, null); return session.getLocalRepositoryManager().find(session, request); } finally { if (X_Log.loggable(LogLevel.DEBUG)) { X_Log.debug("Resolved: " + artifact.toString() + " in " + X_Time.difference(before)); } } }
out.println("Max: "+toMetricSuffix(max) + " ["+maxPos+"]"); out.println("Min: "+toMetricSuffix(min) + " [" +minPos+"]"); out.println("First: "+toMetricSuffix(first)); out.println("Last: "+toMetricSuffix(last)); out.println("Mean: "+toMetricSuffix(avg)); double median = value.get((value.size()/2)).getTime(); out.println("Median: "+toMetricSuffix(median)); out.flush();
@Override public ArtifactResult loadArtifact(String groupId, String artifactId, String classifier, String extension, String version) { Moment before = X_Time.now(); RepositorySystem repoSystem = this.repoSystem.get(); RepositorySystemSession session = this.session.get(); DefaultArtifact artifact = new DefaultArtifact( groupId,artifactId,classifier, X_String.isEmpty(extension) ? "jar" : extension, version); try { ArtifactRequest request = new ArtifactRequest(artifact, remoteRepos(), null); return repoSystem.resolveArtifact(session, request); } catch (ArtifactResolutionException e) { X_Log.log(getClass(), getLogLevel(), "Resolved? ", e.getResult().isResolved(), e.getResult().getExceptions()); X_Log.log(getClass(), getLogLevel(), "Could not download " + artifact, e); throw X_Debug.rethrow(e); } finally { if (X_Log.loggable(LogLevel.DEBUG)) { X_Log.debug("Resolved: " + artifact.toString() + " in " + X_Time.difference(before)); } } }
@Override public void onSuccess(final IOMessage<String> t) { if (cancel) { if (X_Runtime.isDebug()) { X_Log.trace("Ignoring cancelled message", t.url(), t.body()); } return; } request.pending = false; request.statusCode = t.statusCode(); request.statusText = t.statusMessage(); if (deserializer == null) { assert X_String.isEmpty(t.body()) : "Non-null response without a " + "deserializer instance for "+url+"\n Response: "+t.body(); } else { result.set(deserializer.convert(t.body())); } if (handler != null) { handler.onSuccess(result.get()); } }