SmbFile server = new SmbFile("smb://server/"); String[] shares = server.list();
/** * create a smb File * Please call isSMB() before using this class * @throws MalformedURLException */ public SmbFile getSmbFile() throws MalformedURLException { if (!isSMB()) throw new MalformedURLException(); final String url = unescape(this.toNormalform(true)); return new SmbFile(url); }
public SmbRandomAccessFile( String url, String mode, int shareAccess ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url, "", null, shareAccess ), mode ); } public SmbRandomAccessFile( SmbFile file, String mode )
/** * Instance a SmbFileOutputStream object using spicified SmbAuthenticator. * The authentication information in URL will be ignored. * * @param url * @param authenticator * @param append */ public SmbFileOutputStream( String url, SmbExtendedAuthenticator authenticator, boolean append ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url, authenticator ), append ); } // SmbAuthenticator<<
/** * Creates an {@link java.io.InputStream} for reading bytes from a file on * an SMB server addressed by the <code>url</code> parameter. See {@link * jcifs.smb.SmbFile} for a detailed description and examples of the smb * URL syntax. * * @param url An smb URL string representing the file to read from */ public SmbFileInputStream( String url ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url )); }
/** * @param url * @param tc * context to use * @throws SmbException * @throws MalformedURLException */ @SuppressWarnings ( "resource" ) public SmbFileInputStream ( String url, CIFSContext tc ) throws SmbException, MalformedURLException { this(new SmbFile(url, tc), 0, SmbConstants.O_RDONLY, SmbConstants.DEFAULT_SHARING, true); }
/** * @param url * @param tc * context to use * @throws SmbException * @throws MalformedURLException */ @SuppressWarnings ( "resource" ) public SmbFileInputStream ( String url, CIFSContext tc ) throws SmbException, MalformedURLException { this(new SmbFile(url, tc), 0, SmbConstants.O_RDONLY, SmbConstants.DEFAULT_SHARING, true); }
/** * Creates an {@link java.io.InputStream} for reading bytes from a file on * an SMB server addressed by the <code>url</code> parameter. See {@link * jcifs.smb.SmbFile} for a detailed description and examples of the smb * URL syntax. * * @param url An smb URL string representing the file to read from */ public SmbFileInputStream( String url ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url )); }
public SmbRandomAccessFile( String url, String mode, int shareAccess ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url, "", null, shareAccess ), mode ); } public SmbRandomAccessFile( SmbFile file, String mode )
/** * Creates an {@link java.io.InputStream} for reading bytes from a file on * an SMB server addressed by the <code>url</code> parameter. See {@link * jcifs.smb.SmbFile} for a detailed description and examples of the smb * URL syntax. * * @param url An smb URL string representing the file to read from */ public SmbFileInputStream( String url ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url )); }
public SmbRandomAccessFile( String url, String mode, int shareAccess ) throws SmbException, MalformedURLException, UnknownHostException { this( new SmbFile( url, "", null, shareAccess ), mode ); } public SmbRandomAccessFile( SmbFile file, String mode )
public URLConnection openConnection( URL u ) throws IOException { // >>SmbAuthenticator // return new SmbFile( u ); return new SmbFile( u, Config.getOpneConnectionAuthenticator() ); // SmbAuthenticator<< } protected void parseURL( URL u, String spec, int start, int limit ) {
@Override public URLConnection openConnection ( URL u ) throws IOException { if ( log.isDebugEnabled() ) { log.debug("Opening file " + u); } return new SmbFile(u, getTransportContext()); }
@Override public URLConnection openConnection ( URL u ) throws IOException { if ( log.isDebugEnabled() ) { log.debug("Opening file " + u); } return new SmbFile(u, getTransportContext()); }
public boolean ping() { log.log(Level.FINE, "pinging " + host); try { winrm().ping(); SmbFile test = new SmbFile(encodeForSmb("C:\\"), authentication); test.connect(); return true; } catch (Exception e) { log.log(Level.WARNING, "Failed to verify connectivity to Windows slave", e); return false; } }
private void copySlaveJar(PrintStream logger, SmbFile remoteRoot) throws IOException { // copy slave.jar logger.println("Copying slave.jar"); copyStreamAndClose(Hudson.getInstance().getJnlpJars("slave.jar").getURL().openStream(), new SmbFile(remoteRoot,"slave.jar").getOutputStream()); }
/** * @param fe * @return * @throws MalformedURLException */ @Override protected SmbResource adapt ( FileEntry e ) throws MalformedURLException { return new SmbFile(getParent(), e.getName(), false, e.getType(), SmbConstants.ATTR_READONLY | SmbConstants.ATTR_DIRECTORY, 0L, 0L, 0L, 0L); } }
private void copySlaveJar(PrintStream logger, SmbFile remoteRoot) throws IOException { // copy slave.jar logger.println("Copying slave.jar"); copyStreamAndClose(Hudson.getInstance().getJnlpJars("slave.jar").getURL().openStream(), new SmbFile(remoteRoot,"slave.jar").getOutputStream()); }
public void pullUp(String from, String to) throws IOException, InterruptedException { SmbFile src = $(from); SmbFile dst = $(to); for (SmbFile e : src.listFiles()) { e.renameTo(new SmbFile(dst,e.getName())); } src.delete(); }
public void pullUp(String from, String to) throws IOException, InterruptedException { SmbFile src = $(from); SmbFile dst = $(to); for (SmbFile e : src.listFiles()) { e.renameTo(new SmbFile(dst,e.getName())); } src.delete(); }