Examples of MimeTypeDetector


Examples of com.google.enterprise.connector.util.MimeTypeDetector

    FileSystemPropertyManager propertyManager =
        new TestFileSystemPropertyManager();
    PathParser pathParser = new PathParser(fileSystemTypeRegistry);
    TraversalContext traversalContext = new FakeTraversalContext();
    MimeTypeDetector.setTraversalContext(traversalContext);
    MimeTypeDetector mimeTypeDetector = new MimeTypeDetector();

    DocumentContext context = new DocumentContext(
        null, null, null, mimeTypeDetector, propertyManager,
        readAllStartPaths(config), null, null);
View Full Code Here

Examples of com.google.enterprise.connector.util.MimeTypeDetector

  public void setUp() throws Exception {
    FileSystemTypeRegistry fileSystemTypeRegistry = new FileSystemTypeRegistry(
        Collections.singletonList(new JavaFileSystemType()));
    TraversalContext traversalContext = new SimpleTraversalContext();
    MimeTypeDetector.setTraversalContext(traversalContext);
    MimeTypeDetector mimeTypeDetector = new MimeTypeDetector();
    PathParser pathParser = new PathParser(fileSystemTypeRegistry);
    FileSystemPropertyManager propertyManager =
        new TestFileSystemPropertyManager(false);
    DocumentContext context = new DocumentContext(null, null, null,
        mimeTypeDetector, propertyManager, null, null, null);
View Full Code Here

Examples of com.google.enterprise.connector.util.MimeTypeDetector

  }

  private DocumentContext makeContext(boolean pushAcls,
      boolean markAllDocumentsPublic) {
    MimeTypeDetector.setTraversalContext(new FakeTraversalContext());
    MimeTypeDetector mimeTypeDetector = new MimeTypeDetector();
    DocumentContext result = new DocumentContext(
        null, null, null, mimeTypeDetector,
        new TestFileSystemPropertyManager(pushAcls, markAllDocumentsPublic),
        null, null, null);
    return result;
View Full Code Here

Examples of com.google.enterprise.connector.util.MimeTypeDetector

  }

  private void fetchMimeType(ReadonlyFile<?> file) throws RepositoryException {
    if (file.isRegularFile()) {
      try {
        MimeTypeDetector mimeTypeDetector = context.getMimeTypeDetector();
        addProperty(SpiConstants.PROPNAME_MIMETYPE,
                    mimeTypeDetector.getMimeType(file.getName(), file));
      } catch (IOException e) {
        LOGGER.log(Level.WARNING, "Failed to determine MimeType for "
                   + file.getPath(), e);
      }
    }
View Full Code Here

Examples of com.google.enterprise.connector.util.MimeTypeDetector

  public void setUp() throws Exception {
    traversalContext = new SimpleTraversalContext();
    traversalContext.setSupportsInheritedAcls(true);

    MimeTypeDetector.setTraversalContext(traversalContext);
    mimeTypeDetector = new MimeTypeDetector();

    propertyManager = new TestFileSystemPropertyManager();
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.MimeTypeDetector

  public void testDigestContentHolderClobDocument() throws Exception {
    String clobContent = getClobContent();
    testCLOBDataScenarios(
        DigestContentHolder.getInstance(clobContent.getBytes(Charsets.UTF_8),
            new MimeTypeDetector()),
        clobContent);
  }
View Full Code Here

Examples of com.google.enterprise.connector.util.MimeTypeDetector

  }

  public void testDigestContentHolderBlobDocument() throws Exception {
    byte[] blobContent = getBlobContent();
    testBLOBDataScenarios(
        DigestContentHolder.getInstance(blobContent, new MimeTypeDetector()),
        blobContent);
  }
View Full Code Here

Examples of eu.medsea.mimeutil.detector.MimeTypeDetector

  /**
   * Process all extension to the extension-point defined by {@link #getExtensionPointID()}
   */
  public void processElement(IExtension extension, IConfigurationElement element) throws Exception
  {
    MimeTypeDetector detector = (MimeTypeDetector) element.createExecutableExtension("class");
    String detectorID = element.getAttribute("detectorID");
    String orderHintStr = element.getAttribute("orderHint");
    int orderHint = 7000;
    if (orderHintStr != null)
      orderHint = Integer.parseInt(orderHintStr);

    detector.setDetectorID(detectorID);
    detector.setOrderHint(orderHint);
    MimeTypeDetectorRegistry.sharedInstance().addMimeTypeDetector(detector);
  }
View Full Code Here

Examples of org.apache.any23.mime.MIMETypeDetector

        if (document.isEmpty()) {
            throw new IllegalArgumentException("No input document URL specified");
        }

        final DocumentSource documentSource = document.get(0);
        final MIMETypeDetector detector = new TikaMIMETypeDetector();
        final MIMEType mimeType = detector.guessMIMEType(
                documentSource.getDocumentURI(),
                documentSource.openInputStream(),
                MIMEType.parse(documentSource.getContentType())
        );
        System.out.println(mimeType);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.