/***** Code de MesExemples.com *******/ class FileSeparator { public static void main(String[] args) { String myFileSeparator = System.getProperty("file.separator"); System.out.println("Le Séperateur de fichier de ce Système est : " + myFileSeparator); } } |
A Voir sur le même Sujet
-
Java: Obtenir le parent d’un fichier
{filelink=7951} import java.io.File; import java.io.IOException; public class Fichier_P { public static void main(String[] argv) throws IOException { File fichier = new File(“c:test2test.txt”); // Obtenir le …
-
Java: Obtenir des informations sur un fichier
{filelink=7967} import java.io.File; public class Att_Fich { public static void main(String args[]) { File fichier = new File(“c:/test.txt”); boolean exist = fichier.exists(); // Le fichier …
-
Comment Obtenir le lien exacte d’un fichier
{filelink=861} import java.io.*; import java.net.*; public class URLFichier { public static void main(String args[]) throws MalformedURLException { File fichier = new File(“Test”); URL url = …
-
Obtenir la taille d’un fichier en octet, en KB et en MB
{filelink=7946} import java.io.File; public class Taille_Fichier { public static void main(String[] args) { File fichier = new File(“D:/fichier.txt”); long taille = fichier.length(); // Taille en …
-
Java: Obtenir les attributs d’un Noeud
{filelink=8355} /***** Code de MesExemples.com *******/ /** * @(#)ExempleAttributNoeud.java * * * @author *sakoba(java.mesexemples.com) @version 1.00 2013/7/4 */ import org.w3c.dom.Attr; import org.w3c.dom.Element; public class ExempleAttributNoeud …
-
Java: Obtenir la valeur de l’attribut nommé d’un élément donné*
{filelink=8370} /***** Code de MesExemples.com *******/ import org.w3c.dom.Attr;import org.w3c.dom.Element;public class Utils { /** * Retutns the value of the named attribute of the given * element. If there is no such attribute, returns null. * * @param element element * @param name name * @return value */ public static String getAttributeValue(Element element, String name) { Attr attribute = element.getAttributeNode(name); if(attribute == null) { return null; } else { return attribute.getValue(); } }} Code testé avec le fichier XML Suivant Sakoba Adams Rappel Ne m’oubliez pas ce week-end!
-
Obtenir des information sur un fichier ou répertoire
{filelink=109} import java.io.*; import java.util.*; /** * Information sur le statut d’un fichier */ public class FileInfo { public static void statut(String nomFichier) throws IOException …
-
Obténir en heure le temps écoulé
{filelink=6321} public class TempsEcouleHeure { public static void main(String[] argv) throws Exception { long debut = System.currentTimeMillis(); Thread.sleep(2000); // Obtenir le temps en milliseconds long …
-
Comparer la date de modification de deux fichiers
{filelink=5542} import java.io.File; public class CompareDatesModifFichier { // Comparer l’ancienneté des deux fichiers public static void main(String[] args) { // Obtenir la date de modification …
-
Java-Applet: Obtenir la couleur de fond d’une Applet
{filelink=600} /***** Code de MesExemples.com *******/ import java.applet.Applet; import java.awt.Graphics; import java.net.URL; public class applet extends Applet { public void paint(Graphics g) { // obtenir …
-
Obtenir le temps écoulé en minute
{filelink=6320} public class TempseEcouleMin { public static void main(String[] argv) throws Exception { long debut = System.currentTimeMillis(); Thread.sleep(1000); // Obtenir le temps écoulé en milliseconds …
-
Obténir le temps écoulé en seconde
{filelink=6319} public class TempsEcouleSec { public static void main(String[] argv) throws Exception { long debut = System.currentTimeMillis(); Thread.sleep(2000); //Obtenir le temps écoulés en milliseconds long …
-
Java: Utiliser la classe ‘QName’ pour obtenir un attribut
{filelink=8362} /***** Code de MesExemples.com *******/ /** * @(#)ExempleQName_Attribut.java * * * @author *sakoba(java.mesexemples.com) @version 1.00 2013/7/4 */ import javax.xml.namespace.QName; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import …
-
Java: Lister seulement un type de fichier d’un dossier
{filelink=125} import java.io.*; /** * Simulation de la commande ls de linux en définissant les extensions à lister */ public class LsRep2 { public static …
-
Java XML: Obtenir le premier enfant d’un élément*
{filelink=8450} /***** Code de MesExemples.com *******/ /** * @(#)XMLPremierEnfant.java * * * @author *sakoba(java.mesexemples.com) @version 1.00 2013/7/5 */ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public …
Cet article Java-source: Obtenir le séparateur de fichier du système d’exploitation est apparu en premier sur .