public class CopyInputStreamBuffer extends FilterInputStream
in
Constructor and Description |
---|
CopyInputStreamBuffer(InputStream inputStream,
File tempFile)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closeCompleteStream()
Close the original stream and the copy (which will deleted)
|
InputStream |
getInputStream()
Returns copied input stream
|
static File |
getTempFile(String tempDir,
String filePrefix,
String fileSuffix)
Create a temporary file.
|
boolean |
isClosed()
Indicate whether the stream was closed
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
available, mark, markSupported, reset, skip
public CopyInputStreamBuffer(InputStream inputStream, File tempFile) throws FileNotFoundException
inputStream
- The input stream to copytempFile
- The file to copy the stream toFileNotFoundException
- in case the temporary file does not existpublic static File getTempFile(String tempDir, String filePrefix, String fileSuffix) throws IOException
tempDir
- Path to temp directoryfilePrefix
- Prefix string of temp filefileSuffix
- Suffix string of temp fileIOException
- Threw when a file does not createdpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
public void closeCompleteStream()
public InputStream getInputStream() throws IOException
IOException
- Thrown when an exception occurredpublic boolean isClosed()
true
when the stream was already closedpublic int read() throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b) throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
IOException
Copyright © 2019 Communote team. All rights reserved.