code
stringlengths
73
34.1k
label
stringclasses
1 value
public static GridCoverage2D cut( GridCoverage2D raster, GridCoverage2D mask ) throws Exception { OmsCutOut cutDrain = new OmsCutOut(); cutDrain.inRaster = raster; cutDrain.inMask = mask; cutDrain.process(); return cutDrain.outRaster; }
java
private void addMessage(ValidationMessage<Origin> message) { if (message == null) { return; } if( null != defaultOrigin ) { message.addOrigin( defaultOrigin ); } this.messages.add(message); }
java
public int count(Severity severity) { int result = 0; if (severity == null) { return result; } for (ValidationMessage<Origin> message : messages) { if (severity.equals(message.getSeverity())) { result++; } } return result; }
java
public void removeMessage(String messageId) { Collection<ValidationMessage<Origin>> toRemove = new ArrayList<ValidationMessage<Origin>>(); for (ValidationMessage<Origin> message : messages) { if (messageId.equals(message.getMessageKey())) { toRemove.add(message); ...
java
public int compareTo( Object o ) { BoundablePair nd = (BoundablePair) o; if (distance < nd.distance) return -1; if (distance > nd.distance) return 1; return 0; }
java
double b( int i, double t ) { switch( i ) { case -2: return (((-t + 3) * t - 3) * t + 1) / 6; case -1: return (((3 * t - 6) * t) * t + 4) / 6; case 0: return (((-3 * t + 3) * t + 3) * t + 1) / 6; case 1: return (t * t * t) / 6; ...
java
private Coordinate p( int i, double t ) { double px = 0; double py = 0; for( int j = -2; j <= 1; j++ ) { Coordinate coordinate = pts.get(i + j); px += b(j, t) * coordinate.x; py += b(j, t) * coordinate.y; } return new Coordinate(px, py); }
java
public static void oddEvenSort( List<Double> listToBeSorted, List<Double> listThatFollowsTheSort ) { for( int i = 0; i < listToBeSorted.size() / 2; i++ ) { for( int j = 0; j + 1 < listToBeSorted.size(); j += 2 ) if (listToBeSorted.get(j) > listToBeSorted.get(j + 1)) { ...
java
protected double simpson() { double s = 0f; double st = 0f; double ost = 0f; double os = 0f; for( int i = 1; i < maxsteps; i++ ) { st = trapezoid(i); s = (4f * st - ost) / 3f; if (i > 5) { if (Math.abs(s - os) < accuracy * Ma...
java
protected double trapezoid( int n ) { double x = 0; double tnm = 0; double sum = 0; double del = 0; int it = 0; int j = 0; if (n == 1) { strapezoid = 0.5f * (upperlimit - lowerlimit) * (equation(lowerlimit) + equation(upperlimit));...
java
public static double[] tileLatLonBounds( int tx, int ty, int zoom, int tileSize ) { double[] bounds = tileBounds3857(tx, ty, zoom, tileSize); double[] mins = metersToLatLon(bounds[0], bounds[1]); double[] maxs = metersToLatLon(bounds[2], bounds[3]); return new double[]{mins[1], maxs[0], ...
java
public static double metersYToLatitude( double y ) { return Math.toDegrees(Math.atan(Math.sinh(y / EQUATORIALRADIUS))); }
java
public void addGeometryXYColumnAndIndex( String tableName, String geomColName, String geomType, String epsg, boolean avoidIndex ) throws Exception { String epsgStr = "4326"; if (epsg != null) { epsgStr = epsg; } String geomTypeStr = "LINESTRING"; if (geomT...
java
public BufferedImage getTile( int x, int y, int z ) throws Exception { try (PreparedStatement statement = connection.prepareStatement(SELECTQUERY)) { statement.setInt(1, z); statement.setInt(2, x); statement.setInt(3, y); ResultSet resultSet = statement.executeQue...
java
public static BufferedImage readGridcoverageImageForTile( AbstractGridCoverage2DReader reader, int x, int y, int zoom, CoordinateReferenceSystem resampleCrs ) throws IOException { double north = tile2lat(y, zoom); double south = tile2lat(y + 1, zoom); double west = tile2lon(x, zoom);...
java
public int[] convertToArray() { int[] p = new int[size]; for( int j = 0; j < height; ++j ) { for( int i = 0; i < width; ++i ) { p[(j * width) + i] = pixels[i][j]; } } return p; }
java
public void generatePixels( HashSet<Point> pix ) { // Reset all pixels to background for( int j = 0; j < height; ++j ) { for( int i = 0; i < width; ++i ) { pixels[i][j] = BACKGROUND; } } convertToPixels(pix); }
java
public void convertToPixels( HashSet<Point> pix ) { Iterator<Point> it = pix.iterator(); while( it.hasNext() ) { Point p = it.next(); pixels[p.x][p.y] = FOREGROUND; } }
java
public void generateForegroundEdge() { foregroundEdgePixels.clear(); Point p; for( int n = 0; n < height; ++n ) { for( int m = 0; m < width; ++m ) { if (pixels[m][n] == FOREGROUND) { p = new Point(m, n); for( int j = -1; j < 2; ...
java
public void generateBackgroundEdgeFromForegroundEdge() { backgroundEdgePixels.clear(); Point p, p2; Iterator<Point> it = foregroundEdgePixels.iterator(); while( it.hasNext() ) { p = new Point(it.next()); for( int j = -1; j < 2; ++j ) { for( int i =...
java
public String nextValue() throws IOException { Token tkn = nextToken(); String ret = null; switch (tkn.type) { case TT_TOKEN: case TT_EORECORD: ret = tkn.content.toString(); break; case TT_EOF: ret = null; ...
java
public String[] getLine() throws IOException { String[] ret = EMPTY_STRING_ARRAY; record.clear(); while (true) { reusableToken.reset(); nextToken(reusableToken); switch (reusableToken.type) { case TT_TOKEN: record.add(reusab...
java
Token nextToken(Token tkn) throws IOException { wsBuf.clear(); // resuse // get the last read char (required for empty line detection) int lastChar = in.readAgain(); // read the next char and set eol /* note: unfourtunately isEndOfLine may consumes a character silently. *...
java
private Token simpleTokenLexer(Token tkn, int c) throws IOException { for (;;) { if (isEndOfLine(c)) { // end of record tkn.type = TT_EORECORD; tkn.isReady = true; break; } else if (isEndOfFile(c)) { // end o...
java
private Token encapsulatedTokenLexer(Token tkn, int c) throws IOException { // save current line int startLineNumber = getLineNumber(); // ignore the given delimiter // assert c == delimiter; for (;;) { c = in.read(); if (c == '\\' && strategy.getUnicodeE...
java
protected int unicodeEscapeLexer(int c) throws IOException { int ret = 0; // ignore 'u' (assume c==\ now) and read 4 hex digits c = in.read(); code.clear(); try { for (int i = 0; i < 4; i++) { c = in.read(); if (isEndOfFile(c) || isEndO...
java
private boolean isEndOfLine(int c) throws IOException { // check if we have \r\n... if (c == '\r') { if (in.lookAhead() == '\n') { // note: does not change c outside of this method !! c = in.read(); } } return (c == '\n'); }
java
private WritableRaster skyviewfactor( WritableRaster pitWR, double res ) { /* * evalutating the normal vector (in the center of the square compound * of 4 pixel. */ normalVectorWR = normalVector(pitWR, res); WritableRaster skyviewFactorWR = CoverageUtilities.createW...
java
protected WritableRaster shadow( int x, int y, WritableRaster tmpWR, WritableRaster pitWR, double res, double[] normalSunVector, double[] inverseSunVector, double[] sunVector ) { int n = 0; double zcompare = -Double.MAX_VALUE; double dx = (inverseSunVector[0] * n); double dy ...
java
public boolean connectIfPossible( MonitoringPoint monitoringPoint ) { // check if the other point has this as related id if (ID == monitoringPoint.getRelatedID()) { pfafRelatedMonitoringPointsTable.put(monitoringPoint.getPfatstetterNumber().toString(), monitoringPoint); ...
java
public MonitoringPoint getRelatedMonitoringPoint( String pfafStetter ) { if (pfafStetter != null) { return pfafRelatedMonitoringPointsTable.get(pfafStetter); } else { Set<String> keySet = pfafRelatedMonitoringPointsTable.keySet(); for( String key : keySet ) { ...
java
public SimpleFeatureCollection toFeatureCollection( List<MonitoringPoint> monitoringPointsList ) { // create the feature type SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); // set the name b.setName("monitoringpoints"); // add a geometry property ...
java
public long skip(long n) throws IOException { long ret = pos + n; if (ret < 0) { ret = 0; pos = 0; } else if (ret > blob.size) { ret = blob.size; pos = blob.size; } else { pos = (int) ret; } return ret; }
java
public int read() throws IOException { byte b[] = new byte[1]; int n = blob.read(b, 0, pos, b.length); if (n > 0) { pos += n; return b[0]; } return -1; }
java
public int read(byte b[], int off, int len) throws IOException { if (off + len > b.length) { len = b.length - off; } if (len < 0) { return -1; } if (len == 0) { return 0; } int n = blob.read(b, off, pos, len); if (n > 0) { pos += n; return n; } return -1; }
java
public List<Rasterlite2Coverage> getRasterCoverages( boolean doOrder ) throws Exception { List<Rasterlite2Coverage> rasterCoverages = new ArrayList<Rasterlite2Coverage>(); String orderBy = " ORDER BY " + Rasterlite2Coverage.COVERAGE_NAME; if (!doOrder) { orderBy = ""; } ...
java
public void readDwgEndblkV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); bitPos = readObjectTailV15(data, bitPos); }
java
public static Filter getBboxFilter( String attribute, BoundingBox bbox ) throws CQLException { double w = bbox.getMinX(); double e = bbox.getMaxX(); double s = bbox.getMinY(); double n = bbox.getMaxY(); return getBboxFilter(attribute, w, e, s, n); }
java
public static Filter getBboxFilter( String attribute, double west, double east, double south, double north ) throws CQLException { if (attribute == null) { attribute = "the_geom"; } StringBuilder sB = new StringBuilder(); sB.append("BBOX("); sB.append(at...
java
public static Filter getIntersectsGeometryFilter( String geomName, Geometry geometry ) throws CQLException { Filter result = CQL.toFilter("INTERSECTS(" + geomName + ", " + geometry.toText() + " )"); return result; }
java
private double neigh_value(double x_cur, double x_min, double x_max, double r) { double ranval, zvalue, new_value; double work3, work2 = 0, work1 = 0; double x_range = x_max - x_min; // ------------ generate a standard normal random variate (zvalue) ------------------- // perturb cur...
java
private void calchillshade( WritableRaster pitWR, WritableRaster hillshadeWR, WritableRaster gradientWR, double dx ) { pAzimuth = Math.toRadians(pAzimuth); pElev = Math.toRadians(pElev); double[] sunVector = calcSunVector(); double[] normalSunVector = calcNormalSunVector(sunVector); ...
java
public static double getMeanSlope( List<ProfilePoint> points ) { double meanSlope = 0; int num = 0; for( int i = 0; i < points.size() - 1; i++ ) { ProfilePoint p1 = points.get(i); ProfilePoint p2 = points.get(i + 1); double dx = p2.progressive - p1.progressi...
java
public static double[] getLastVisiblePointData( List<ProfilePoint> profile ) { if (profile.size() < 2) { throw new IllegalArgumentException("A profile needs to have at least 2 points."); } ProfilePoint first = profile.get(0); double baseElev = first.getElevation(); Co...
java
private void checkMetagenomeSource(Origin origin, SourceFeature source) { List<Qualifier> metagenomeSourceQual = source.getQualifiers(Qualifier.METAGENOME_SOURCE_QUALIFIER_NAME); if(metagenomeSourceQual != null && !metagenomeSourceQual.isEmpty()) { Qualifier envSample = source.getSingleQualifier(Qualifier.ENVIR...
java
public void addFeaturePath( String featurePath, String filter ) { if (!featurePaths.contains(featurePath)) { featurePaths.add(featurePath); if (filter == null) { filter = ""; } featureFilter.add(filter); } }
java
public BufferedImage drawImageWithNewMapContent( ReferencedEnvelope ref, int imageWidth, int imageHeight, double buffer ) { MapContent content = new MapContent(); content.setTitle("dump"); if (forceCrs != null) { content.getViewport().setCoordinateReferenceSystem(forceCrs); ...
java
public void dumpPngImage( String imagePath, ReferencedEnvelope bounds, int imageWidth, int imageHeight, double buffer, int[] rgbCheck ) throws IOException { BufferedImage dumpImage = drawImageWithNewMapContent(bounds, imageWidth, imageHeight, buffer); boolean dumpIt = true; if (rgbCh...
java
public void dumpPngImageForScaleAndPaper( String imagePath, ReferencedEnvelope bounds, double scale, EPaperFormat paperFormat, Double dpi, BufferedImage legend, int legendX, int legendY, String scalePrefix, float scaleSize, int scaleX, int scaleY ) throws Exception { if (dpi == null) { ...
java
public double distance(Object pt1, Object pt2) { Object p = newCopy(pt1); subtract(p, pt2); return magnitude(p); }
java
private void makeCellsFlowReady( int iteration, GridNode pitfillExitNode, List<GridNode> cellsToMakeFlowReady, BitMatrix allPitsPositions, WritableRandomIter pitIter, float delta ) { iteration++; double exitElevation = pitfillExitNode.elevation; List<GridNode> connected = new ArrayL...
java
public void setStartCoordinates( List<Coordinate> coordinateList ) { generateTin(coordinateList); for( int i = 0; i < tinGeometries.length; i++ ) { Coordinate[] coordinates = tinGeometries[i].getCoordinates(); if (!tinCoordinateList.contains(coordinates[0])) { tin...
java
public void filterOnAllData( final ALasDataManager lasHandler ) throws Exception { final ConcurrentSkipListSet<Double> angleSet = new ConcurrentSkipListSet<Double>(); final ConcurrentSkipListSet<Double> distanceSet = new ConcurrentSkipListSet<Double>(); if (isFirstStatsCalculation) { ...
java
private void generateTin( List<Coordinate> coordinateList ) { pm.beginTask("Generate tin...", -1); DelaunayTriangulationBuilder b = new DelaunayTriangulationBuilder(); b.setSites(coordinateList); Geometry tinTriangles = b.getTriangles(gf); tinGeometries = new Geometry[tinTriangle...
java
public STRtree generateTinIndex( Double maxEdgeLength ) { double maxEdge = maxEdgeLength != null ? maxEdgeLength : 0.0; pm.beginTask("Creating tin indexes...", tinGeometries.length); final STRtree tinTree = new STRtree(tinGeometries.length); for( Geometry geometry : tinGeometries ) { ...
java
private Coordinate[] getOrderedNodes( Coordinate c, Coordinate coordinate1, Coordinate coordinate2, Coordinate coordinate3 ) { double d = distance3d(c, coordinate1, null); Coordinate nearest = coordinate1; Coordinate c2 = coordinate2; Coordinate c3 = coordinate3; double d2 = dis...
java
public void seek(long pos) throws IOException { int n = (int) (real_pos - pos); if (n >= 0 && n <= buf_end) { buf_pos = buf_end - n; } else { raf.seek(pos); buf_end = 0; buf_pos = 0; real_pos = raf.getFilePointer(); } }
java
@Override public final String readLine() throws IOException { String str = null; if (buf_end - buf_pos <= 0) { if (fillBuffer() < 0) { // return null if we are at the end and there is nothing to read return null; } } int lineend = -1; for (int i = buf_pos; i < buf_end; i++) { if (buffer[...
java
public static String checkSameName( List<String> strings, String string ) { int index = 1; for( int i = 0; i < strings.size(); i++ ) { if (index == 10000) { // something odd is going on throw new RuntimeException(); } String existingStr...
java
public static List<String> splitString( String string, int limit ) { List<String> list = new ArrayList<String>(); char[] chars = string.toCharArray(); boolean endOfString = false; int start = 0; int end = start; while( start < chars.length - 1 ) { int charCou...
java
@SuppressWarnings("resource") public static Scanner streamToScanner( InputStream stream, String delimiter ) { java.util.Scanner s = new java.util.Scanner(stream).useDelimiter(delimiter); return s; }
java
public static double[] stringToDoubleArray( String string, String separator ) { if (separator == null) { separator = ","; } String[] stringSplit = string.trim().split(separator); double[] array = new double[stringSplit.length]; for( int i = 0; i < array.length; i++ ) ...
java
public String getTextDescription() { StringBuilder builder = new StringBuilder(name); builder.append(" "); List<Location> locationList = new ArrayList<Location>(locations.getLocations()); Collections.sort(locationList, new LocationComparator(LocationComparator.START_LOCATION)); f...
java
public byte[] seal(byte[] plaintext) { final byte[] nonce = box.nonce(plaintext); final byte[] ciphertext = box.seal(nonce, plaintext); final byte[] combined = new byte[nonce.length + ciphertext.length]; System.arraycopy(nonce, 0, combined, 0, nonce.length); System.arraycopy(ciphertext, 0, combined,...
java
public Optional<byte[]> open(byte[] ciphertext) { if (ciphertext.length < SecretBox.NONCE_SIZE) { return Optional.empty(); } final byte[] nonce = Arrays.copyOfRange(ciphertext, 0, SecretBox.NONCE_SIZE); final byte[] x = Arrays.copyOfRange(ciphertext, SecretBox.NONCE_SIZE, ciphertext.length); r...
java
public void readDwgVertex3DV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getRawChar(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); int flags = ((Integer)v.get(1)).intValue(); this.flags = flags; v = DwgUtil.getBi...
java
public static void addPrj( String folder, String epsg ) throws Exception { OmsFileIterator fiter = new OmsFileIterator(); fiter.inFolder = folder; fiter.pCode = epsg; fiter.process(); }
java
@Execute public void process() throws Exception { if (!concatOr(outFlow == null, doReset)) { return; } checkNull(inFlow, inPit); RegionMap regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inPit); cols = regionMap.getCols(); rows = regionMap.g...
java
public static void fillProjectMetadata(Connection connection, String name, String description, String notes, String creationUser) throws Exception { Date creationDate = new Date(); if (name == null) { name = "project-" + ETimeUtilities.INSTANCE.TIME_FORMATTER_LOCAL.format(creationDate); ...
java
protected List<JavaFileObject> listClassesFromUrl(URL base, String packageName) throws IOException { //TODO this will only work with file:// not jar:// if (base == null) { throw new NullPointerException("base == null"); } List<JavaFileObject> list = new ArrayList<JavaFileOb...
java
public static int[] sliceByTime(CSTable table, int timeCol, Date start, Date end) { if (end.before(start)) { throw new IllegalArgumentException("end<start"); } if (timeCol < 0) { throw new IllegalArgumentException("timeCol :" + timeCol); } int s = -1; ...
java
public static AbstractTableModel getProperties(final CSProperties p) { return new AbstractTableModel() { @Override public int getRowCount() { return p.keySet().size(); } @Override public int getColumnCount() { return ...
java
public static String toArrayString(String[] arr) { StringBuilder b = new StringBuilder(); b.append('{'); for (int i = 0; i < arr.length; i++) { b.append(arr[i]); if (i < arr.length - 1) { b.append(','); } } b.append('}'); ...
java
public static Double[] getColumnDoubleValues(CSTable t, String columnName) { int col = columnIndex(t, columnName); if (col == -1) { throw new IllegalArgumentException("No such column: " + columnName); } List<Double> l = new ArrayList<Double>(); for (String[] s : t.row...
java
public static Date getDate(CSProperties p, String key) throws ParseException { String val = p.get(key).toString(); if (val == null) { throw new IllegalArgumentException(key); } String f = p.getInfo(key).get(KEY_FORMAT); DateFormat fmt = new SimpleDateFormat(f == null ...
java
public static int getInt(CSProperties p, String key) throws ParseException { String val = p.get(key).toString(); if (val == null) { throw new IllegalArgumentException(key); } return Integer.parseInt(val); }
java
public static void print(CSProperties props, PrintWriter out) { out.println(PROPERTIES + "," + CSVParser.printLine(props.getName())); for (String key : props.getInfo().keySet()) { out.println(" " + CSVParser.printLine(key, props.getInfo().get(key))); } out.println(); ...
java
public static void print(CSTable table, PrintWriter out) { out.println(TABLE + "," + CSVParser.printLine(table.getName())); for (String key : table.getInfo().keySet()) { out.println(CSVParser.printLine(key, table.getInfo().get(key))); } if (table.getColumnCount() < 1) { ...
java
public static void save(CSTable table, File file) throws IOException { PrintWriter w = new PrintWriter(file); print(table, w); w.close(); }
java
public static CSProperties properties(Reader r, String name) throws IOException { return new CSVProperties(r, name); }
java
public static CSProperties properties(Reader[] r, String name) throws IOException { CSVProperties p = new CSVProperties(r[0], name); for (int i = 1; i < r.length; i++) { CSVParser csv = new CSVParser(r[i], CSVStrategy.DEFAULT_STRATEGY); locate(csv, name, PROPERTIES, PROPERTIES1);...
java
public static void merge(CSProperties base, CSProperties overlay) { for (String key : overlay.keySet()) { if (base.getInfo(key).containsKey("public")) { base.put(key, overlay.get(key)); } else { throw new IllegalArgumentException("Not public: " + key); ...
java
public static Properties properties(CSProperties p) { Properties pr = new Properties(); pr.putAll(p); return pr; }
java
public static CSTable table(File file, String name) throws IOException { return new FileTable(file, name); }
java
public static CSTable table(String s, String name) throws IOException { return new StringTable(s, name); }
java
public static CSTable table(URL url, String name) throws IOException { return new URLTable(url, name); }
java
public static boolean columnExist(CSTable table, String name) { for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).startsWith(name)) { return true; } } return false; }
java
public static int columnIndex(CSTable table, String name) { for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).equals(name)) { return i; } } return -1; }
java
public static CSTable extractColumns(CSTable table, String... colNames) { int[] idx = {}; for (String name : colNames) { idx = add(idx, columnIndexes(table, name)); } if (idx.length == 0) { throw new IllegalArgumentException("No such column names: " + Arrays.toS...
java
private static void par_ief(CompList<?> t, int numproc) throws Exception { if (numproc < 1) { throw new IllegalArgumentException("numproc"); } final CountDownLatch latch = new CountDownLatch(t.list().size()); // final ExecutorService e = Executors.newFixedThreadPool(numproc); ...
java
public void addInput( String fieldName, String type, String description, String defaultValue, String uiHint ) { if (fieldName == null) { throw new IllegalArgumentException("field name is mandatory"); } if (type == null) { throw new IllegalArgumentException("field type is ...
java
public void addOutput( String fieldName, String type, String description, String defaultValue, String uiHint ) { if (fieldName == null) { throw new IllegalArgumentException("field name is mandatory"); } if (type == null) { throw new IllegalArgumentException("field type is...
java
public static String getPreference( String preferenceKey, String defaultValue ) { Preferences preferences = Preferences.userRoot().node(PREFS_NODE_NAME); String preference = preferences.get(preferenceKey, defaultValue); return preference; }
java
public static String getProcessPid( Session session, String userName, String grep1, String grep2 ) throws JSchException, IOException { String command = "ps aux | grep \"" + grep1 + "\" | grep -v grep"; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr...
java
public static void killProcessByPid( Session session, int pid ) throws Exception { String command = "kill -9 " + pid; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { return; } else { new Exception(remoteResponseS...
java
public static String getRunningDockerContainerId( Session session, String containerName ) throws JSchException, IOException { String command = "docker ps | grep " + containerName; String remoteResponseStr = launchACommand(session, command); if (remoteResponseStr.length() == 0) { retu...
java
private static String launchACommand( Session session, String command ) throws JSchException, IOException { Channel channel = session.openChannel("exec"); ((ChannelExec) channel).setCommand(command); channel.setInputStream(null); ((ChannelExec) channel).setErrStream(System.err); ...
java
public static String runShellCommand( Session session, String command ) throws JSchException, IOException { String remoteResponseStr = launchACommand(session, command); return remoteResponseStr; }
java
public static String runDemonShellCommand( Session session, String command ) throws JSchException, IOException { String remoteResponseStr = launchACommandAndExit(session, command); return remoteResponseStr; }
java
public static void downloadFile( Session session, String remoteFilePath, String localFilePath ) throws Exception { // exec 'scp -f rfile' remotely String command = "scp -f " + remoteFilePath; Channel channel = session.openChannel("exec"); ((ChannelExec) channel).setCommand(command); ...
java