Android Programming Press on the image to return to the main documentation page.

SMB

This library is based on
JCIFS library.
It provides access to Microsoft Windows network file system.
See this tutorial.

JCIFS and therefore also this library is licensed under the GNU Lesser General Public License.
http://www.gnu.org/licenses/lgpl.html
A copy of the Lesser General Public License is in the provided archive.

Copyright 2013 Anywhere Software

List of types:

SMB
SMBFile

SMB

This library is based on JCIFS library.
It provides access to Microsoft Windows network file system.
See this tutorial.

Permissions:

android.permission.INTERNET

Events:

DownloadCompleted (Url As String, RemoteFile As String, Success As Boolean)
UploadCompleted (Url As String, RemoteFile As String, Success As Boolean)
DeleteCompleted (Url As String, RemoteFile As String, Success As Boolean)
ListCompleted (Url As String, Success As Boolean, Entries() As SMBFile)
MakeDirCompleted (Url As String, RemoteFile As String, Success As Boolean)
RenameCompleted (Url As String, DestRemoteFile As String, Success As Boolean)
CopyCompleted (DestUrl As String, DestRemoteFile As String, Success As Boolean)
FreeSpaceCompleted (Url As String, RemoteFile As String, Size As Long, Success As Boolean)

Members:


  CopyFile (SrcUrl As String, SrcRemoteFile As String, DestUrl As String, DestRemoteFile As String)

  DeleteFile (Url As String, RemoteFile As String)

  DownloadFile (Url As String, RemoteFile As String, LocalDir As String, LocalFile As String)

  DownloadFile2 (Url As String, RemoteFile As String, out As java.io.OutputStream, Close As Boolean)

  GetDiskFreeSpace (Url As String, RemoteFile As String)

  Initialize (EventName As String)

  Initialize2 (EventName As String, Properties As Map)

  ListFiles (Url As String, FilterPattern As String)

  MakeDir (Url As String, RemoteFile As String)

  RenameFile (Url As String, SrcRemoteFile As String, DestRemoteFile As String)

  SetCredentials (Username As String, Password As String, Domain As String)

  UploadFile (LocalDir As String, LocalFile As String, Url As String, RemoteFile As String)

  UploadFile2 (In As java.io.InputStream, Url As String, RemoteFile As String)

  Version As Double [read only]

Members description:

CopyFile (SrcUrl As String, SrcRemoteFile As String, DestUrl As String, DestRemoteFile As String)
This method will copy the source file or directory specified to the destination specified.
The CopyCompleted event will be raised when the process completes.
Example: SMB1.Copy("smb://USER-PC/", "1.jpg", "smb://USER-PC/", "2.jpg")
DeleteFile (Url As String, RemoteFile As String)
This method will delete the file or directory specified by this SmbFile.
If the target is a directory, the contents of the directory will be deleted as well.
If a file within the directory or it's sub-directories is marked read-only, the read-only status will be removed and the file will be deleted.
The DeleteCompleted event will be raised when the process completes.
Example: SMB1.DeleteFile("smb://USER-PC/", "1.jpg")
DownloadFile (Url As String, RemoteFile As String, LocalDir As String, LocalFile As String)
Downloads a remote file and stores it in the specified path.
The DownloadCompleted event will be raised when the process completes.
Example: SMB1.DownloadFile("smb://USER-PC/Users/Public/", "1.jpg", File.DirRootExternal, "1.jpg")
DownloadFile2 (Url As String, RemoteFile As String, out As java.io.OutputStream, Close As Boolean)
Similar to DownloadFile. Expects an OutputStream instead of the local file.
If Close is True then the OutputStream is closed on completion.
GetDiskFreeSpace (Url As String, RemoteFile As String)
This method returns the free disk space in bytes of the drive on which the directory or file resides.
The FreeSpaceCompleted event will be raised when the process completes.
Example: SMB1.GetDiskFreeSpace("smb://USER-PC/", "")
Initialize (EventName As String)
Initializes the object.
Initialize2 (EventName As String, Properties As Map)
Initializes the object and sets the specified map of properties as explained on this page:
SMB properties
ListFiles (Url As String, FilterPattern As String)
Lists all files and folders in the given remote path.
FilterPattern - DOS filter pattern. Pass an empty string to list all files and folders.
The ListCompleted event will be raised when the process completes.
Example: SMB1.ListFiles("smb://USER-PC/Users/Public/", "*.jpg")
MakeDir (Url As String, RemoteFile As String)
This method Creates a directory with the path specified by and creating any parent directories that do not exist.
The MakeDirCompleted event will be raised when the process completes.
Example: SMB1.MakeDir("smb://USER-PC/Users/Public/", "NewDir")
RenameFile (Url As String, SrcRemoteFile As String, DestRemoteFile As String)
This method will rename the file or directory specified.
The RenameCompleted event will be raised when the process completes.
Example: SMB1.Rename("smb://USER-PC/", "1.jpg", "2.jpg)
SetCredentials (Username As String, Password As String, Domain As String)
Sets the credentials that should be used to make the connection.
UploadFile (LocalDir As String, LocalFile As String, Url As String, RemoteFile As String)
Uploads a local file.
The UploadCompleted event will be raised when the process completes.
Example: SMB1.UploadFile(File.DirRootExternal, "1.jpg", "smb://USER-PC/", "1.jpg")
UploadFile2 (In As java.io.InputStream, Url As String, RemoteFile As String)
Similar to UploadFile. Expects an InputStream instead of the local file.
Version As Double [read only]
Returns the version of the library.

SMBFile

Stores the metadata for a file or folder entry retrieved by calling SMB.ListFiles.

Events:

None

Members:


  CanRead As Boolean

  CanWrite As Boolean

  Directory As Boolean [read only]

  IsHidden As Boolean

  IsInitialized As Boolean

  LastModified As Long [read only]

  Name As String [read only]

  Parent As String [read only]

  Size As Long [read only]

Members description:

CanRead As Boolean
Returns True if the file can be read.
CanWrite As Boolean
Returns True if the file is not marked read-only.
Directory As Boolean [read only]
Returns true if this entry is a directory.
IsHidden As Boolean
Returns True if the file is marked as hidden
IsInitialized As Boolean
LastModified As Long [read only]
Returns the last modified date.
Example: DateTime.Date(File.LastModified)
Name As String [read only]
Gets the file name.
Parent As String [read only]
Returns the Url of the file parent.
Size As Long [read only]
Returns the file size.
Top