\begin{slide}{Die Klasse \texttt{File}}

liefert Abstraktion f�r Datei oder Verzeichnis (-Namen):

Pfad $=$ [Pr�fix] (Dir Sep)$^*$ Name
\begin{itemize} \parskip 0pt \itemsep 0pt
\item
  Unix: Pr�fix = \verb|/|, Sep = \verb|/|
\item
  Windows: Pr�fix = \verb|A:| usw., Sep = \verb|\|
\end{itemize}

\begin{verbatim}
class File {
    File (String path);
    File (File parent, String child);
    String getName ();
    File getParentFile ();
}
\end{verbatim}


\end{slide}

\begin{slide}{System-unabh�ngige Pfade}

Schnittstelle:
\begin{verbatim}
interface FileSystem {
    char getSeparator();
    String normalize(String path);
}
\end{verbatim}
Implementierung:
\begin{verbatim}
class UnixFileSystem implements FileSystem {
    char getSeparator () { return '/'; }
    String normalize(String path) { .. }
}
\end{verbatim}
  
\end{slide}

\begin{slide}{File-Eigenschaften}

\begin{verbatim}
class File { ..
    boolean exists ();
    boolean canWrite ();
    boolean canRead ();

    boolean isFile ();
    boolean isDirectory ();

    long length ();    
}
\end{verbatim}


\end{slide}
