Clears any exception that is currently being thrown.
| Category: | Exception |
| Applies to: | Java object |
/* Java code */
public class a
{
public void m() throws NullPointerException
{
throw new NullPointerException();
}
} /* DATA step code */
data _null_;
length e 8;
dcl javaobj j('a');
rc = j.callvoidmethod('m');
/* Check for exception. Value is returned in variable 'e' */
rc = j.exceptioncheck(e);
if (e) then
put 'exception';
else
put 'no exception';
/* Clear the exception and check it again */
rc = j.exceptionclear( );
rc = j.exceptioncheck(e);
if (e) then
put 'exception';
else
put 'no exception';
run;exception no exception
DataInputStream,
which enables you to pass a FileInputStream to
the constructor. The wrapper is necessary because the constructor
actually takes an InputStream, which
is the parent of FileInputStream, and
the current method lookup is not robust enough to perform the superclass
lookup.
/* Java code */
public class myDataInputStream extends java.io.DataInputStream
{
myDataInputStream(java.io.FileInputStream fi)
{
super(fi);
}
}DataInputStream for
an external file and read the file until the end-of-file is reached.
The EXCEPTIONCHECK method is used to determine when the readInt method
throws an EOFException, which enables
you to end the input loop.
/* DATA step code */
data _null_;
length d e 8;
dcl javaobj f("java/io/File", "c:\temp\binint.txt");
dcl javaobj fi("java/io/FileInputStream", f);
dcl javaobj di("myDataInputStream", fi);
do while(1);
di.callIntMethod("readInt", d);
di.ExceptionCheck(e);
if (e) then
leave;
else
put d=;
end;
run;