/** Test the data using a detector. * @param data the data we are testing. * @return if we have a match. */ private boolean testDetector(final ByteBuffer data) { final String detectorClassName = new String(this.match.getTest().array()).trim(); try { final Class<?> detectorClass = classForName(detectorClassName); final Object detectorObject = detectorClass.getDeclaredConstructor().newInstance(); final Method processMethod = detectorClass.getDeclaredMethod("process", byte[].class, //$NON-NLS-1$ Integer.TYPE, Integer.TYPE, Long.TYPE, Character.TYPE, String.class, Map.class); final String[] types = (String[]) processMethod.invoke(detectorObject, data.array(), Integer.valueOf(this.match.getOffset()), Integer.valueOf(this.match.getLength()), Long.valueOf(this.match.getBitmask()), Character.valueOf(this.match.getComparator()), this.match.getMimeType(), this.match.getProperties()); if (types != null && types.length > 0) { // the match object has no mime type set, so set from the detector class processing this.match.setMimeType(types[0]); return true; } } catch (final Throwable e) { java.util.logging.Logger.getLogger("es.gob.afirma").warning(e.toString()); //$NON-NLS-1$ } return false; }
match.setMimeType(types[0]);
match.setMimeType(types[0]);
match.setMimeType(finalValue); log.debug("characters(): setting mimetype to '" + finalValue + "'"); } else if (isExtension) {
this.match.setMimeType(this.finalValue);
match.setMimeType(finalValue); log.debug("characters(): setting mimetype to '" + finalValue + "'"); } else if (isExtension) {
clone.setExtension(this.extension); clone.setLength(this.length); clone.setMimeType(this.mimeType); clone.setOffset(this.offset);
clone.setExtension(extension); clone.setLength(length); clone.setMimeType(mimeType); clone.setOffset(offset);
clone.setExtension(extension); clone.setLength(length); clone.setMimeType(mimeType); clone.setOffset(offset);