//threshold = lm.getRuntimeThreshold(threshold);
if (length >= threshold && attachmentDir != null) {
// Get the file accessor
FileAccessor fileAccessor = lm.create(attachmentDir);
OutputStream fos = fileAccessor.getOutputStream();
//Copy the bytes into the file
ByteArrayInputStream is = new ByteArrayInputStream(b, off, length);
BufferUtils.inputStream2OutputStream(is, fos);
fos.close();
// Delete this temp file on exit
lm.deleteOnExit(fileAccessor.getFile());
lm.deleteOnTimeInterval(DELETE_TIME, fileAccessor.getFile());
// Create the OMText node from the datahandler
DataHandler dh = fileAccessor.getDataHandler(null);
omText = factory.createOMText(dh, isOptimize);
}
}
if (omText == null) {
omText = factory.createOMText(Base64Utils.encode(b, off, length));