Tabnine Logo
IFileSource.getFile
Code IndexAdd Tabnine to your IDE (free)

How to use
getFile
method
in
com.documents4j.api.IFileSource

Best Java code snippets using com.documents4j.api.IFileSource.getFile (Showing top 4 results out of 315)

origin: documents4j/documents4j

@Override
protected File fetchSource() {
  return source.getFile();
}
origin: documents4j/documents4j

@Override
public InputStream getInputStream() {
  file = fileSource.getFile();
  try {
    FileInputStream fileInputStream = new FileInputStream(file);
    fileInputStream.getChannel().lock(0L, Long.MAX_VALUE, true);
    return fileInputStream;
  } catch (FileNotFoundException e) {
    throw new FileSystemInteractionException(String.format("Could not find file %s", file), e);
  } catch (IOException e) {
    throw new FileSystemInteractionException(String.format("Could not read file %s", file), e);
  }
}
origin: documents4j/documents4j

@Test(timeout = DEFAULT_CONVERSION_TIMEOUT)
public void testFileSourceToFileConsumerFuture() throws Exception {
  File source = validFile(true), target = makeTarget(true);
  IFileSource fileSource = mock(IFileSource.class);
  when(fileSource.getFile()).thenReturn(source);
  IFileConsumer fileConsumer = mock(IFileConsumer.class);
  assertTrue(getConverter().convert(fileSource).as(validInputType()).to(target, fileConsumer).as(validTargetType()).schedule().get());
  assertTrue(source.exists());
  assertTrue(target.exists());
  verify(fileSource, times(1)).getFile();
  verify(fileSource, times(1)).onConsumed(source);
  verifyNoMoreInteractions(fileSource);
  verify(fileConsumer, times(1)).onComplete(target);
  verifyNoMoreInteractions(fileConsumer);
}
origin: documents4j/documents4j

@Test(timeout = DEFAULT_CONVERSION_TIMEOUT)
public void testFileSourceToFileConsumerExecute() throws Exception {
  File source = validFile(true), target = makeTarget(true);
  IFileSource fileSource = mock(IFileSource.class);
  when(fileSource.getFile()).thenReturn(source);
  IFileConsumer fileConsumer = mock(IFileConsumer.class);
  assertTrue(getConverter().convert(fileSource).as(validInputType()).to(target, fileConsumer).as(validTargetType()).execute());
  assertTrue(source.exists());
  assertTrue(target.exists());
  verify(fileSource, times(1)).getFile();
  verify(fileSource, times(1)).onConsumed(source);
  verifyNoMoreInteractions(fileSource);
  verify(fileConsumer, times(1)).onComplete(target);
  verifyNoMoreInteractions(fileConsumer);
}
com.documents4j.apiIFileSourcegetFile

Javadoc

Invoked when the converter requests a file for conversion. If this callback throws an exception, the conversion will be marked as unsuccessful and the exception is rethrown on any invocation of the resulting future's java.util.concurrent.Future#get() method.

Popular methods of IFileSource

  • onConsumed
    Called when the file was consumed and is not longer required by the converter. The file must not be

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JCheckBox (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now