Package jcifs.smb

Examples of jcifs.smb.SmbFile


  public String check()
    throws ManifoldCFException
  {
    getSession();
    String serverURI = smbconnectionPath;
    SmbFile server = null;
    try
    {
      server = new SmbFile(serverURI,pa);
    }
    catch (MalformedURLException e1)
    {
      return "Malformed URL: '"+serverURI+"': "+e1.getMessage();
    }
    try
    {
      // check to make sure it's a server or a folder
      int type = getFileType(server);
      if (type==SmbFile.TYPE_SERVER || type==SmbFile.TYPE_SHARE
        || type==SmbFile.TYPE_FILESYSTEM)
      {
        try
        {
          server.connect();
          if (!server.exists())
            return "Server or path does not exist";
        }
        catch (java.net.SocketTimeoutException e)
        {
          return "Timeout connecting to server: "+e.getMessage();
View Full Code Here


  protected String mapToIdentifier(String path)
    throws IOException
  {
    String smburi = smbconnectionPath;
    String uri = smburi + path + "/";
    return getFileCanonicalPath(new SmbFile(uri,pa));
  }
View Full Code Here

        file = toSMB(file);

        //System.out.println(file);
        try
        {
            SmbFile f = new SmbFile(file, getAuth());

            if(f.exists() && f.isDirectory())
            {
                cleanSmbDir(file);
            }

            f.delete();
        }
        catch(Exception ex)
        {
            Log.debug("Removal failed (" + ex + ").");
View Full Code Here

    private void cleanSmbDir(String dir) throws Exception
    {
        dir = toSMB(dir);

        SmbFile f2 = new SmbFile(dir, getAuth());
        String[] tmp = f2.list();

        if(tmp == null)
        {
            return;
        }

        for(int i = 0; i < tmp.length; i++)
        {
            SmbFile f3 = new SmbFile(dir + tmp[i], getAuth());

            if(f3.isDirectory())
            {
                //System.out.println(dir);
                cleanSmbDir(dir + tmp[i]);
                f3.delete();
            }
            else
            {
                //System.out.println(dir+tmp[i]);
                f3.delete();
            }
        }
    }
View Full Code Here

                dirName = dirName + "/";
            }

            dirName = toSMB(dirName);

            SmbFile f = new SmbFile(dirName, getAuth());
            f.mkdir();

            fireDirectoryUpdate();

            return true;
        }
View Full Code Here

            {
                tmp = tmp + "/";
            }

            //Log.debug("tmp: " + tmp);
            SmbFile f = new SmbFile(tmp, getAuth());
            f.list();

            pwd = tmp;

            //Log.debug("pwd: " + pwd);
            //System.out.println("chdir: " + getPWD());
View Full Code Here

        try
        {
            //Log.debug("sortLs: trying");
            chdirNoRefresh(getPWD());

            SmbFile fx = new SmbFile(pwd, getAuth());

            //System.out.println(pwd);
            //if(fx == null) System.out.println("Smb: fx null");
            SmbFile[] f = fx.listFiles();

            //Log.debug("sortLs: file is there and listed");
            //if(f == null) System.out.println("Smb: f null");
            files = new String[f.length];
            size = new String[f.length];
View Full Code Here

            //System.out.println("downloadDir: " + dir + "," + out);
            fileCount = 0;
            shortProgress = true;
            baseFile = StringUtils.getDir(dir);

            SmbFile f2 = new SmbFile(dir, getAuth());
            String[] tmp = f2.list();

            if(tmp == null)
            {
                return;
            }

            File fx = new File(out);
            fx.mkdir();

            for(int i = 0; i < tmp.length; i++)
            {
                tmp[i] = tmp[i].replace('\\', '/');

                //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]);
                SmbFile f3 = new SmbFile(dir + tmp[i], getAuth());

                if(f3.isDirectory())
                {
                    if(!tmp[i].endsWith("/"))
                    {
                        tmp[i] = tmp[i] + "/";
                    }
View Full Code Here

            if(tmp == null)
            {
                return;
            }

            SmbFile fx = new SmbFile(dir, getAuth());
            fx.mkdir();

            for(int i = 0; i < tmp.length; i++)
            {
                tmp[i] = tmp[i].replace('\\', '/');
View Full Code Here

            boolean outflag = false;

            if(outfile.startsWith("smb://"))
            {
                outflag = true;
                out = new BufferedOutputStream(new SmbFileOutputStream(new SmbFile(outfile,
                                                                                   getAuth())));
            }
            else
            {
                out = new BufferedOutputStream(new FileOutputStream(outfile));
            }

            //System.out.println("out: " + outfile + ", in: " + file);
            if(file.startsWith("smb://"))
            {
                in = new BufferedInputStream(new SmbFile(file, getAuth()).getInputStream());
            }
            else
            {
                in = new BufferedInputStream(new FileInputStream(file));
            }
View Full Code Here

TOP

Related Classes of jcifs.smb.SmbFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.