AW: [jcifs] create directory hierarchy - mkdirs()
Klemens.Dickbauer.extern at HVBSystems.com
Klemens.Dickbauer.extern at HVBSystems.com
Thu Mar 14 18:13:37 EST 2002
Hi Michael!
so, as i understand you, SmbFile will just support api functions that can be
directly mapped into the cifs/smb protocol?
~klemens
> -----Ursprüngliche Nachricht-----
> Von: Michael B Allen [SMTP:mballen at erols.com]
> Gesendet am: Mittwoch, 13. März 2002 21:24
> An: Dickbauer, Klemens (ext.)
> Cc: jcifs at lists.samba.org
> Betreff: Re: [jcifs] create directory hierarchy - mkdirs()
>
> On Wed, 13 Mar 2002 20:38:22 +0100
> Klemens.Dickbauer.extern at HVBSystems.com wrote:
>
> > Hi!
> >
> > afaik the api of SmbFile should be relatively close to the one of
> > java.io.File.
> > there a method 'mkdirs()' exists to create a full directory hierarchy at
> > once. since
> > i'm doing an abstraction class for both File and SmbFile a
> mkdirs()-method
> > in SmbFile
> > as well seems appropriate and handy for me.
> > i tried to implement one, but using a recursive (very easy ;) descent to
> a
> > file that exists
> > might be quite ineffective (and not stable), so there might be a better
> > solution of delegating
> > to some lower-level cifs call.
>
> No, there's no SMB specific function for this. You would have to do
> something like you have done.
>
> Mike
>
> > sorry, i'm quite new and unknowing of this SMB stuff (-:
> >
> > greetz,
> > ~klemens
> >
> > --
> > kdi at msk-informatik . at
> >
> >
> > p.s.: my try:
> > --
> > /**
> > * Creates a directory hierarchy by creating each required directory
> > * given by the path of <code>SmbFile</code>. It uses the
> > * <code>mkdir()</code>-method of this class.
> > *
> > * @throws SmbException
> > */
> > public void mkdirs() throws SmbException {
> > if( canonicalPath == null ) {
> > throw new SmbException( SmbException.ERRDOS,
> > SmbException.ERRnoaccess );
> > }
> > Log.println( Log.WARNINGS, "smb create directory hierarchy
> warning",
> > " directoryName=" + uncPath );
> >
> > // check if parent directory exists and call recursively if not
> > SmbFile parentFile = null;
> > try {
> > parentFile = new SmbFile(this.getParent());
> > }
> > catch (MalformedURLException e) {
> > Log.println(Log.EXCEPTIONS, "smb create dircetory hierarchy
> > exception",
> > " directoryName=" + parentFile.uncPath);
> > throw new SmbException(SmbException.ERRRAP, "Could not
> create "
> > + parentFile.uncPath);
> > }
> > catch (java.net.UnknownHostException e) {
> > Log.println(Log.EXCEPTIONS, "smb create dircetory hierarchy
> > exception"
> > + ": UnknownHostException: " +
> e.getLocalizedMessage(),
> > " directoryName=" + parentFile.uncPath);
> > throw new SmbException(SmbException.ERRRAP, "Could not
> create "
> > + parentFile.uncPath
> > + ": UnknownHostException: " +
> > e.getLocalizedMessage());
> > }
> > if (!parentFile.exists()) {
> > parentFile.mkdirs();
> > }
> > this.mkdir();
> > }
> >
>
>
> --
> May The Source be with you.
>
More information about the jcifs
mailing list