public class SMBResource extends ResourceSupport implements Resource
ATTRIBUTE_ARCHIVE, ATTRIBUTE_HIDDEN, ATTRIBUTE_SYSTEM
Constructor and Description |
---|
SMBResource(SMBResourceProvider provider,
String path) |
SMBResource(SMBResourceProvider provider,
String path,
jcifs.smb.NtlmPasswordAuthentication auth) |
SMBResource(SMBResourceProvider provider,
String parent,
String child) |
SMBResource(SMBResourceProvider provider,
String parent,
String child,
jcifs.smb.NtlmPasswordAuthentication auth) |
Modifier and Type | Method and Description |
---|---|
void |
createDirectory(boolean createParentWhenNotExists)
Creates the directory named by this abstract pathname, including any
necessary but nonexistent parent directories if flag "createParentWhenNotExists" is set to true.
|
void |
createFile(boolean createParentWhenNotExists)
Creates a new, empty file named by this abstract pathname if
and only if a file with this name does not yet exist.
|
boolean |
exists()
Tests whether the resource denoted by this abstract pathname
exists.
|
boolean |
getAttribute(short attribute)
return value of a specific attribute
|
InputStream |
getInputStream() |
int |
getMode() |
String |
getName()
Returns the name of the resource denoted by this abstract
pathname.
|
OutputStream |
getOutputStream(boolean append) |
String |
getParent()
Returns the pathname string of this abstract pathname's parent, or
null if this pathname does not name a parent directory. |
Resource |
getParentResource()
Returns the abstract pathname of this abstract pathname's parent,
or
null if this pathname does not name a parent
directory. |
String |
getPath()
Converts this abstract pathname into a pathname string.
|
Resource |
getRealResource(String realpath)
returns a resource that is relative to the current resource
|
ResourceProvider |
getResourceProvider() |
jcifs.smb.SmbFile |
getSmbFile() |
boolean |
isAbsolute()
Tests whether this abstract pathname is absolute.
|
boolean |
isArchive()
Tests whether the resource named by this abstract pathname is a archive
resource.
|
boolean |
isDirectory()
Tests whether the resource denoted by this abstract pathname is a
directory.
|
boolean |
isFile()
Tests whether the file denoted by this abstract pathname is a normal
file.
|
boolean |
isHidden()
Tests whether the resource named by this abstract pathname is a hidden
resource.
|
boolean |
isReadable()
Tests whether the application can read the resource denoted by this
abstract pathname.
|
boolean |
isSystem()
Tests whether the resource named by this abstract pathname is a system
resource.
|
boolean |
isWriteable()
Tests whether the application can modify the resource denoted by this
abstract pathname.
|
long |
lastModified()
Returns the time that the resource denoted by this abstract pathname was
last modified.
|
long |
length()
Returns the length of the resource denoted by this abstract pathname.
|
Resource[] |
listResources()
Returns an array of abstract pathnames denoting the files in the
directory denoted by this abstract pathname.
|
void |
moveTo(Resource dest)
Move/renames the file denoted by this abstract pathname.
|
void |
remove(boolean alsoRemoveChildren)
Deletes the resource denoted by this abstract pathname.
|
void |
setArchive(boolean value)
sets archive attribute of the resource
|
void |
setAttribute(short attribute,
boolean value)
sets a attribute on the resource if supported otherwise it will ign
|
void |
setHidden(boolean value)
sets hidden attribute of the resource
|
boolean |
setLastModified(long time)
Sets the last-modified time of the file or directory named by this
abstract pathname.
|
void |
setMode(int mode) |
boolean |
setReadable(boolean readable) |
void |
setSystem(boolean value)
sets system attribute of the resource
|
boolean |
setWritable(boolean writable) |
canRead, canWrite, copyFrom, copyTo, createNewFile, delete, equals, getAbsolutePath, getAbsoluteResource, getCanonicalPath, getCanonicalResource, getOutputStream, getReal, list, list, list, listResources, listResources, mkdir, mkdirs, renameTo, setReadOnly, toString
getClass, hashCode, notify, notifyAll, wait, wait, wait
canRead, canWrite, copyFrom, copyTo, createNewFile, delete, getAbsolutePath, getAbsoluteResource, getCanonicalPath, getCanonicalResource, getOutputStream, getReal, list, list, list, listResources, listResources, mkdir, mkdirs, renameTo, setReadOnly
public SMBResource(SMBResourceProvider provider, String path)
public SMBResource(SMBResourceProvider provider, String path, jcifs.smb.NtlmPasswordAuthentication auth)
public SMBResource(SMBResourceProvider provider, String parent, String child)
public SMBResource(SMBResourceProvider provider, String parent, String child, jcifs.smb.NtlmPasswordAuthentication auth)
public boolean isReadable()
Resource
isReadable
in interface Resource
true
if and only if the resource specified by this
abstract pathname exists and can be read by the
application; false
otherwisepublic boolean isWriteable()
Resource
isWriteable
in interface Resource
true
if and only if the resource system actually
contains a resource denoted by this abstract pathname and
the application is allowed to write to the resource;
false
otherwise.public void remove(boolean alsoRemoveChildren) throws IOException
Resource
remove
in interface Resource
IOException
- if the file doesn't exists or can't deletepublic boolean exists()
Resource
public String getName()
Resource
public String getParent()
Resource
null
if this pathname does not name a parent directory.
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
public Resource getParentResource()
Resource
null
if this pathname does not name a parent
directory.
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
getParentResource
in interface Resource
null
if this pathname
does not name a parentpublic Resource getRealResource(String realpath)
Resource
getRealResource
in interface Resource
public String getPath()
Resource
public boolean isAbsolute()
Resource
isAbsolute
in interface Resource
true
if this abstract pathname is absolute,
false
otherwisepublic boolean isDirectory()
Resource
isDirectory
in interface Resource
true
if and only if the file denoted by this
abstract pathname exists and is a directory;
false
otherwisepublic boolean isFile()
Resource
public boolean isHidden()
Resource
isHidden
in interface Resource
isHidden
in class ResourceSupport
true
if and only if the file denoted by this
abstract pathname is hiddenpublic boolean isArchive()
Resource
isArchive
in interface Resource
isArchive
in class ResourceSupport
true
if and only if the file denoted by this
abstract pathname is a archivepublic boolean isSystem()
Resource
isSystem
in interface Resource
isSystem
in class ResourceSupport
true
if and only if the file denoted by this
abstract pathname is a system resourcepublic long lastModified()
Resource
lastModified
in interface Resource
long
value representing the time the file was
last modified, measured in milliseconds since the epoch
(00:00:00 GMT, January 1, 1970), or 0L
if the
file does not exist or if an I/O error occurspublic long length()
Resource
public Resource[] listResources()
Resource
If this abstract pathname does not denote a directory, then this
method returns null
. Otherwise an array of
File
objects is returned, one for each file or directory in
the directory. Therefore if this pathname
is absolute then each resulting pathname is absolute; if this pathname
is relative then each resulting pathname will be relative to the same
directory.
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
listResources
in interface Resource
null
if this abstract pathname
does not denote a directory, or if an I/O error occurs.public boolean setLastModified(long time)
Resource
All platforms support file-modification times to the nearest second,
but some provide more precision. The argument will be truncated to fit
the supported precision. If the operation succeeds and no intervening
operations on the file take place, then the next invocation of the
method will return the (possibly
truncated) Resource.lastModified()
time
argument that was passed to this method.
setLastModified
in interface Resource
time
- The new last-modified time, measured in milliseconds since
the epoch (00:00:00 GMT, January 1, 1970)true
if and only if the operation succeeded;
false
otherwisepublic boolean setWritable(boolean writable)
setWritable
in interface Resource
public boolean setReadable(boolean readable)
setReadable
in interface Resource
public void createFile(boolean createParentWhenNotExists) throws IOException
Resource
createFile
in interface Resource
IOException
- If an I/O error occurredpublic void createDirectory(boolean createParentWhenNotExists) throws IOException
Resource
createDirectory
in interface Resource
createParentWhenNotExists
- throws Exception when can't create directoryIOException
public InputStream getInputStream() throws IOException
getInputStream
in interface Resource
IOException
public OutputStream getOutputStream(boolean append) throws IOException
getOutputStream
in interface Resource
IOException
public ResourceProvider getResourceProvider()
getResourceProvider
in interface Resource
public void setMode(int mode) throws IOException
setMode
in interface Resource
IOException
public void setHidden(boolean value) throws IOException
Resource
setHidden
in interface Resource
setHidden
in class ResourceSupport
IOException
- throwed when no access to change the value or the resource doesn't existspublic void setSystem(boolean value) throws IOException
Resource
setSystem
in interface Resource
setSystem
in class ResourceSupport
IOException
- throwed when no access to change the value or the resource doesn't existspublic void setArchive(boolean value) throws IOException
Resource
setArchive
in interface Resource
setArchive
in class ResourceSupport
IOException
- throwed when no access to change the value or the resource doesn't existspublic void setAttribute(short attribute, boolean value) throws IOException
Resource
setAttribute
in interface Resource
setAttribute
in class ResourceSupport
attribute
- wich attrbute (Resource.ATTRIBUTE_*)IOException
- throwed when no access to change the value,
when attributes are not supported or
the resource doesn't existspublic void moveTo(Resource dest) throws IOException
Resource
Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.
moveTo
in interface Resource
moveTo
in class ResourceSupport
dest
- The new abstract pathname for the named fileIOException
- throwed when operation not done sucessfullpublic boolean getAttribute(short attribute)
Resource
getAttribute
in interface Resource
getAttribute
in class ResourceSupport
public jcifs.smb.SmbFile getSmbFile()
Copyright © 2015 Lucee