Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
ClobToStringConvertor:
This class covert the CLOB into String.
import
java.io.IOException;
import java.io.Reader;
import java.sql.Clob;
import
java.sql.SQLException;
class ClobToStringConvertor
{
public static String
convertClobToString(Object clobToBeConverted,
int characterToRead)
throws ICCException {
Clob clob = (Clob) clobToBeConverted;
String val = null;
if (clob != null) {
Reader reader = null;
try {
reader = clob.getCharacterStream();
char chars[] = new char[characterToRead];
StringBuffer buf = new StringBuffer();
int count = 0;
do {
count = reader.read(chars);
if (count > 0) {
buf.append(chars, 0, count);
}
} while (count != -1);
val = buf.toString();
} catch (SQLException e) {
logger.error(e.getMessage());
} catch (IOException e) {
logger.error(e.getMessage());
}
}
return val;
}
}
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.