congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IFileSource
Code IndexAdd Tabnine to your IDE (free)

How to use
IFileSource
in
com.documents4j.api

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

origin: documents4j/documents4j

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

@Override
protected void onSourceConsumed(File fetchedSource) {
  source.onConsumed(fetchedSource);
}
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);
}
origin: documents4j/documents4j

@Override
public void onConsumed(InputStream inputStream) {
  try {
    close(inputStream);
  } finally {
    fileSource.onConsumed(file);
  }
}
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);
  }
}
com.documents4j.apiIFileSource

Javadoc

A callback interface that provides files to be converted just-in-time.

Most used methods

  • getFile
    Invoked when the converter requests a file for conversion. If this callback throws an exception, the
  • onConsumed
    Called when the file was consumed and is not longer required by the converter. The file must not be

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • getContentResolver (Context)
  • findViewById (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JOptionPane (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • CodeWhisperer alternatives
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