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

How to use
getInputStream
method
in
com.documents4j.api.IInputStreamSource

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

origin: documents4j/documents4j

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

@Override
public File getFile() {
  inputStream = inputStreamSource.getInputStream();
  try {
    FileOutputStream fileOutputStream = new FileOutputStream(tempStorage);
    fileOutputStream.getChannel().lock();
    try {
      ByteStreams.copy(inputStream, fileOutputStream);
      return tempStorage;
    } finally {
      // Note: This will implicitly release the file lock.
      Closeables.close(fileOutputStream, true);
    }
  } catch (IOException e) {
    throw new FileSystemInteractionException(String.format("Could not write stream to file %s", tempStorage), e);
  }
}
origin: documents4j/documents4j

@Test(timeout = DEFAULT_CONVERSION_TIMEOUT)
public void testInputStreamSourceToInputStreamConsumerFuture() throws Exception {
  File source = validFile(true);
  InputStream inputStream = spy(new FileInputStream(source));
  IInputStreamSource inputStreamSource = mock(IInputStreamSource.class);
  when(inputStreamSource.getInputStream()).thenReturn(inputStream);
  OutputStream outputStream = mock(OutputStream.class);
  IInputStreamConsumer inputStreamConsumer = mock(IInputStreamConsumer.class);
  doAnswer(new CloseStreamAnswer()).when(inputStreamConsumer).onComplete(any(InputStream.class));
  assertTrue(getConverter().convert(inputStreamSource).as(validInputType()).to(inputStreamConsumer).as(validTargetType()).schedule().get());
  assertTrue(source.exists());
  verify(inputStreamSource, times(1)).getInputStream();
  verify(inputStreamSource, times(1)).onConsumed(any(InputStream.class));
  verify(inputStream, never()).close();
  inputStream.close();
  verify(inputStreamConsumer, times(1)).onComplete(any(InputStream.class));
  verifyNoMoreInteractions(inputStreamConsumer);
  verify(outputStream, never()).close();
}
origin: documents4j/documents4j

@Test(timeout = DEFAULT_CONVERSION_TIMEOUT)
public void testInputStreamSourceToInputStreamConsumerExecute() throws Exception {
  File source = validFile(true);
  InputStream inputStream = spy(new FileInputStream(source));
  IInputStreamSource inputStreamSource = mock(IInputStreamSource.class);
  when(inputStreamSource.getInputStream()).thenReturn(inputStream);
  OutputStream outputStream = mock(OutputStream.class);
  IInputStreamConsumer inputStreamConsumer = mock(IInputStreamConsumer.class);
  doAnswer(new CloseStreamAnswer()).when(inputStreamConsumer).onComplete(any(InputStream.class));
  assertTrue(getConverter().convert(inputStreamSource).as(validInputType()).to(inputStreamConsumer).as(validTargetType()).execute());
  assertTrue(source.exists());
  verify(inputStreamSource, times(1)).getInputStream();
  verify(inputStreamSource, times(1)).onConsumed(any(InputStream.class));
  verify(inputStream, never()).close();
  inputStream.close();
  verify(inputStreamConsumer, times(1)).onComplete(any(InputStream.class));
  verifyNoMoreInteractions(inputStreamConsumer);
  verify(outputStream, never()).close();
}
com.documents4j.apiIInputStreamSourcegetInputStream

Javadoc

Invoked when the converter requests a new input stream with data 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 IInputStreamSource

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

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • putExtra (Intent)
  • getContentResolver (Context)
  • String (java.lang)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JLabel (javax.swing)
  • Top Sublime Text 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