Getting the image width or height

Hi all,

currently reading in a png and trying to get the width / height of the image.

Is there anyway to do this dynamicly, cause eventually i've loads of images that need to be processed.

What i try is the following.

public static Image ReadInImage(URI u) throws IOException {

   FileInputStream FIS = new FileInputStream( new File(u.getPath() ) );
   byte[] b = new byte[8192];
   int readIn;
   int bytesAvailable = FIS.available();
   ByteBuffer byteBuffer = ByteBuffer.allocate( bytesAvailable );
   while ( (readIn = ) != -1 )

   Image img = new Image();
   return img;

again thanks in advance,