Package com.adobe.internal.io.stream
Class CroppedImageInputByteStream
java.lang.Object
com.adobe.internal.io.stream.CroppedImageInputByteStream
- All Implemented Interfaces:
InputByteStream
This class is used to crop an image input stream to specified bounds.
This particularly is helpful for those images which are very huge. Because we never
load the complete image in memory at any moment.
There are some methods which are either not supported or not follow the contract of
InputByteStream.
So, clients are recommended to read the javadocs of individual API's of this class before using them.-
Field Summary
Fields inherited from interface com.adobe.internal.io.stream.InputByteStream
EOF -
Constructor Summary
ConstructorsConstructorDescriptionCroppedImageInputByteStream(int bpc, int noc, InputStream decodedImage, int width, int height, int x1, int y1, int x2, int y2) Constructor to create an instance of this InputByteStream which reads subimage of dimension (x2-x1)*(y2-y1), of specified bits per component and number of components, from passedInputStream -
Method Summary
Modifier and TypeMethodDescriptionlongOnly for internal engineering use.voidclose()Closes this InputByteStream and releases any system resources associated with the stream.booleaneof()Only for internal engineering use.longOnly for internal engineering use.longlength()Only for internal engineering use.intread()Only for internal engineering use.intread(byte[] bytes) Only for internal engineering use.intread(byte[] bytes, int position, int length) Only for internal engineering use.seek(long position) Not supportedslice()Returns itself.slice(long begin, long length) Not supportedReturns an instance ofInputStreamwhich uses this stream only as back-end.intunget()Not supported
-
Constructor Details
-
CroppedImageInputByteStream
public CroppedImageInputByteStream(int bpc, int noc, InputStream decodedImage, int width, int height, int x1, int y1, int x2, int y2) throws IOException Constructor to create an instance of this InputByteStream which reads subimage of dimension (x2-x1)*(y2-y1), of specified bits per component and number of components, from passedInputStream- Parameters:
bpc- bits per component of imagenoc- number of componentsdecodedImage- image input streamwidth- image widthheight- image heightx1- lefty1- bottomx2- righty2- top- Throws:
IOException
-
-
Method Details
-
slice
Not supported- Specified by:
slicein interfaceInputByteStream- Parameters:
begin- Offset within the currentInputByteStreamto start the slice.length- The length of the slice.- Returns:
- A slice of the original
InputByteStream. - Throws:
IOException
-
slice
Returns itself.- Specified by:
slicein interfaceInputByteStream- Returns:
- A slice of the original
InputByteStream. - Throws:
IOException
-
read
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. Read the byte at the current position. If the current position is at or beyond the end of the underlying data return a-1. If not beyond the end of the underlying data the current position is incremented by 1.- Specified by:
readin interfaceInputByteStream- Returns:
- The byte at the current position or
-1if at or beyond EOF. - Throws:
IOException
-
read
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.- Specified by:
readin interfaceInputByteStream- Parameters:
bytes- The destination array.position- The offset in the byte array to put the first byte read.length- The number of bytes to read.- Throws:
IOException
-
read
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. Read an array of bytes starting at the current position. The position is incremented by the length of the array that has been read.- Specified by:
readin interfaceInputByteStream- Parameters:
bytes- The destination array.- Throws:
IOException
-
unget
Not supported- Specified by:
ungetin interfaceInputByteStream- Throws:
IOException
-
seek
Not supported- Specified by:
seekin interfaceInputByteStream- Parameters:
position- Where to set the current position.- Returns:
- This object.
- Throws:
IOException
-
getPosition
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. Get the current position.- Specified by:
getPositionin interfaceInputByteStream- Returns:
- The current position.
- Throws:
IOException
-
length
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. The maximum number of bytes that can be read from thisInputByteStream.- Specified by:
lengthin interfaceInputByteStream- Returns:
- Total number of bytes available in this
InputByteStream. - Throws:
IOException
-
bytesAvailable
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. The number of bytes available to be read from the current position.- Specified by:
bytesAvailablein interfaceInputByteStream- Returns:
- Number of bytes available from the current position in this
InputByteStream. - Throws:
IOException
-
eof
Description copied from interface:InputByteStreamOnly for internal engineering use. This api can change without notice. Is the current position of thisInputByteStreamat or beyond the end of the underlying data.- Specified by:
eofin interfaceInputByteStream- Returns:
- True if the current position is beyond the end of the underlying data, false otherwise.
- Throws:
IOException
-
close
Description copied from interface:InputByteStreamCloses this InputByteStream and releases any system resources associated with the stream. After this method is called then any further calls to this instance are errors.- Specified by:
closein interfaceInputByteStream- Throws:
IOException
-
toInputStream
Returns an instance ofInputStreamwhich uses this stream only as back-end. So, closing one of them will close the other also.- Specified by:
toInputStreamin interfaceInputByteStream- Returns:
- an InputStream that refers to the same underlying data
- Throws:
IOException
-