KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openlaszlo > media > PNG


1 /******************************************************************************
2  * PNG.java
3  * ****************************************************************************/

4
5 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
6 * Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
7 * Use is subject to license terms. *
8 * J_LZ_COPYRIGHT_END *********************************************************/

9
10 package org.openlaszlo.media;
11
12 import java.io.InputStream JavaDoc;
13 import java.io.IOException JavaDoc;
14 import java.io.DataInputStream JavaDoc;
15
16 /**
17  * PNG
18  */

19 public class PNG {
20     static public boolean is(InputStream JavaDoc str) throws IOException JavaDoc {
21
22         final int magic = 0x89504e47; // 137 PNG
23

24         DataInputStream JavaDoc ds = new DataInputStream JavaDoc(str);
25         return (ds.readInt() == magic);
26     }
27 }
28
Popular Tags