Outils pour utilisateurs

Outils du site


informatique:java:tips

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
informatique:java:tips [05/03/2013 21:29] – [Convert a Java OutputStream to an InputStream] cyrilleinformatique:java:tips [16/06/2023 10:02] (Version actuelle) – [Swing] cyrille
Ligne 10: Ligne 10:
   * [[http://download.oracle.com/javase/tutorial/uiswing/components/table.html|How to Use Swing JTables]] (binding, cell editors, ...)   * [[http://download.oracle.com/javase/tutorial/uiswing/components/table.html|How to Use Swing JTables]] (binding, cell editors, ...)
   * About [[/informatique/java/tips/Drag & Drop|Drag & Drop]]   * About [[/informatique/java/tips/Drag & Drop|Drag & Drop]]
-  * Plein d'effets visuels avec Swing par Romain Guy: [[http://jroller.com/gfx/page/Archives]]+  * Plein d'effets visuels avec Swing par Romain Guy: <del>[[http://jroller.com/gfx/page/Archives]]</del>
 ===== CVS Format ===== ===== CVS Format =====
  
   * [[http://opencsv.sourceforge.net/]]: opencsv is a very simple csv (comma-separated values) parser library for Java. It was developed because all of current csv parsers I've come across don't have commercial-friendly licenses.   * [[http://opencsv.sourceforge.net/]]: opencsv is a very simple csv (comma-separated values) parser library for Java. It was developed because all of current csv parsers I've come across don't have commercial-friendly licenses.
 +
 +===== Read input from console =====
 +
 +Read console input using **java.io.Console** instance - //Don't work in Eclipse IDE//.
 +<code java>
 +private static void usingConsoleReader()
 +{
 +  Console  console = System.console();
 +  if (console != null)
 +  {
 +     String inputString = console.readLine("Name: ");
 +     System.out.println("Name entered : " + inputString);
 +  }
 +}
 +</code>
 +
 +Read console input using **BufferedReader** instance
 +<code java>
 +private static void usingBufferedReader()
 +{
 +  BufferedReader bufferRead = new BufferedReader( new InputStreamReader( System.in ) );
 +  String inputString = bufferRead.readLine();
 +  System.out.println( inputString );
 +}
 +</code>
 +
 +Read console input using **Scanner** instance
 +<code java>
 +private static void usingScanner()
 +{
 +  Scanner scanIn = new Scanner( System.in );
 +  String inputString = scanIn.nextLine();
 +  scanIn.close();           
 +  System.out.println(inputString);
 +}
 +</code>
 +
 +===== Process Input Stream Reader =====
 +
 +<code java>
 +import java.io.BufferedReader;
 +import java.io.IOException;
 +import java.io.InputStream;
 +import java.io.InputStreamReader;
 +import java.net.InetAddress;
 +import java.net.UnknownHostException;
 +import java.io.*;
 + 
 +public class Traceroute {
 + public static void main(String[] args){
 +  Runtime t = Runtime.getRuntime();
 +  try {
 +   Process p = t.exec("traceroute  "+args[0]);
 +   //Process p = t.exec("ping -w 1 "+args[0]);
 +   InputStream i = p.getInputStream();
 +   InputStreamReader r = new InputStreamReader(i);
 +   BufferedReader re = new BufferedReader(r);
 +   int m =0;
 +   while(true){
 +    String content = re.readLine();
 +    System.out.println(content);
 +    if(content == null){
 +     break;
 +    }
 +   }
 +   re.close();
 +   r.close();
 +  } catch (IOException e) {
 +    e.printStackTrace();
 +  }
 + }
 +}
 +
 +</code>
  
 ===== Convert a Java OutputStream to an InputStream ===== ===== Convert a Java OutputStream to an InputStream =====
Ligne 66: Ligne 140:
  
 Communication série avec Java Communication série avec Java
 +
 +  * http://www.java-samples.com/showtutorial.php?tutorialid=11
 +  * http://christophej.developpez.com/tutoriel/java/javacomm/
  
  
  
informatique/java/tips.1362515376.txt.gz · Dernière modification : 05/03/2013 21:29 de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki