public boolean hasNext() throws IOException {
  dataInputStream.mark(1);
  int val=dataInputStream.read();
  dataInputStream.reset();
  return val != -1;
}

public boolean hasNext ( ) throws IOException { dataInputStream . mark ( 1 ) ; int val = dataInputStream . read ( ) ; dataInputStream . reset ( ) ; return val != - 1 ; }
checks if another objects is available by attempting to read another byte from the stream .
