public void produceImage() throws IOException, ImageFormatException{
Stream stream = new Stream(){
@Override
public void Flush(){
Util.throwException(new NotSupportedException());
}
@Override
public int Read(byte[] bytes, int off, int len){
try{
int count = input.read(bytes, off, len);
if( count < 0 ){
return 0;
}
return count;
}catch(IOException ex){
throw new RuntimeException(ex);
}
}
@Override
public long Seek(long arg0, SeekOrigin arg1){
Util.throwException(new NotSupportedException());
return 0;
}
@Override
public void SetLength(long arg0){
Util.throwException(new NotSupportedException());
}
@Override
public void Write(byte[] arg0, int arg1, int arg2){
Util.throwException(new NotSupportedException());
}
@Override
public boolean get_CanRead(){
return true;
}
@Override
public boolean get_CanSeek(){
return false;
}
@Override
public boolean get_CanWrite(){
return true;
}
@Override
public long get_Length(){
try{
return input.available();
}catch(IOException ex){
throw new RuntimeException(ex);
}
}
@Override
public long get_Position(){
Util.throwException(new NotSupportedException());
return 0;
}
@Override
public void set_Position(long arg0){
Util.throwException(new NotSupportedException());
}
};
try{
Bitmap bitmap = new Bitmap(stream);