Package ag.smaser.trip.filefilter
Class NativeConversion
- java.lang.Object
-
- ag.smaser.trip.filefilter.Conversion
-
- ag.smaser.trip.filefilter.NativeConversion
-
public class NativeConversion extends Conversion
Represents the state of a running file conversion using a JNI-based (native) method to access the file data.
-
-
Constructor Summary
Constructors Constructor Description NativeConversion(AdapterOutputType outputType, java.lang.String filename, long userdata)
Creates a new conversion object for the conversion of file data (e.g.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Used by the Connectivity Framework to close this Conversion object.java.io.InputStream
getInputStream()
Returns an input stream for the file data associated with this Conversion object.boolean
isLocalFile()
Returns true if the file to convert exists on the local file system.int
read(byte[] data, int offset, int count)
Read file data.-
Methods inherited from class ag.smaser.trip.filefilter.Conversion
getFileName, getOutputType, getUserData
-
-
-
-
Constructor Detail
-
NativeConversion
public NativeConversion(AdapterOutputType outputType, java.lang.String filename, long userdata)
Creates a new conversion object for the conversion of file data (e.g. provided in-memory or via a native socket).- Parameters:
outputType
- The format to convert the file tofilename
- The (fully qualified) name of the file to convertuserdata
- Opaque user data (usually a pointer) provided via JNI.
-
-
Method Detail
-
close
public void close()
Description copied from class:Conversion
Used by the Connectivity Framework to close this Conversion object. This method is invoked by the Connectivity Framework. A File Filter adapter implementation should not use it.- Overrides:
close
in classConversion
-
isLocalFile
public boolean isLocalFile()
Returns true if the file to convert exists on the local file system.- Specified by:
isLocalFile
in classConversion
-
read
public int read(byte[] data, int offset, int count) throws java.lang.Exception
Read file data.You must use either this method to access file data or the input stream. Do not use both; once you use the input stream this method will no longer return any data.
- Specified by:
read
in classConversion
- Parameters:
data
- Byte array to receive dataoffset
- Offset into the byte array at which data starts getting writtencount
- The number of bytes to read- Returns:
- The number of bytes actually read
- Throws:
java.lang.Exception
-
getInputStream
public java.io.InputStream getInputStream() throws java.lang.Exception
Returns an input stream for the file data associated with this Conversion object.You must use either this method to access file data or the read method. Do not use both; once you use the input stream, the read method will no longer return any data.
- Specified by:
getInputStream
in classConversion
- Returns:
- A new InputStream to the file data
- Throws:
java.lang.Exception
- IOException if the input stream could not be created
-
-