| [Java] fichier image -> InputStream par marianne31 |
vendredi 29 juillet 2005 à 14:28:50 |
File monfichier = new File (path,"photo1.gif") ; FileImageInputStream fi = new FileImageInputStream(monfichier) ; byte[] b = new byte[xxx]; fi.read(b) ; InputStream in = new ByteArrayInputStream(b) ;
Configuration: Mac OS X Logiciel de développement : Webobjects 5.2 avec Java
Salut
tu peux utiliser la classe ByteBuffer pour récupérer les octets, cette classe possède une méthode qui te retourne un array avec les octets récupérés http://java.sun.com/j2se/1.4.2/docs/api/java/nio/ByteBuffer.html Chouba, Pochard d'assaut .. |
|
Merci j'ai réussi a trouver
il y a une méthode qui permet de récupérer la taille du fichier int taille = (int)monfichier.length() * 8 ; byte[] b = new byte[taille]; fi.read(b) ; InputStream in = new ByteArrayInputStream(b) ; a+
|
Salut!
Dans quel but crées-tu un InputStream sur une Image? HackTrack |
ok mais dans ta méthode juste un petit truc le fi correspond à quel variable car je ne vois pas du tout |
| 26/03 15h40 | Javascript : Date modification fichier image | Programmation | 30/03 10h32 | 1 |
| 13/05 09h57 | [Java] Fichier binaire | Programmation | 18/05 11h04 | 3 |
| 24/03 08h35 | JAVA fichier portable | Programmation | 24/03 13h28 | 3 |
| 02/03 22h04 | [Java] Fichier | Programmation | 04/03 17h07 | 4 |