private void processMemoryScan(final ScannerIOMetadata metadata){
  if (!isError && (metadata instanceof TwainIOMetadata)) {
    try {
      TwainIOMetadata twaindata=(TwainIOMetadata)metadata;
      TwainTransfer.MemoryTransfer.Info info=twaindata.getMemory();
      byte[] twainbuf=info.getBuffer();
      int width=info.getWidth();
      int height=info.getHeight();
      int bpr=info.getBytesPerRow();
      ImageData imageData=new ImageData(width,height,bpr,twainbuf);
      if (generationMode == ScanModeConstants.SCAN_MODE_MEMORY_SERIALIZED) {
        saveMemoryBlockSerialized(imageData,new File(path,prefix + "-serialize" + memoryBlockTotal+ ".data"));
      }
 else       if (generationMode == ScanModeConstants.SCAN_MODE_MEMORY_JPG_BLOCKS) {
        saveMemoryBlockJPG(imageData,new File(path,prefix + "-block" + memoryBlockTotal+ ".jpg"),(float)1.0);
      }
      imageData=null;
      memoryHeight+=height;
      memoryWidth=width;
      memoryBlockTotal++;
      if (metadata.isState(TwainConstants.STATE_TRANSFERRING)) {
        if (generationMode == ScanModeConstants.SCAN_MODE_MEMORY_SERIALIZED) {
          composePageSerialized(new File(path,prefix + "-page" + numPage+ ".png"));
        }
 else         if (generationMode == ScanModeConstants.SCAN_MODE_MEMORY_JPG_BLOCKS) {
          composePageJPG(new File(path,prefix + "-page" + numPage+ ".png"));
        }
        memoryBlockProcessed=memoryBlockTotal;
        memoryHeight=0;
        memoryRow=0;
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
      endProcess(true,false);
    }
  }
}

private void processMemoryScan ( final ScannerIOMetadata metadata ) { if ( ! isError && ( metadata instanceof TwainIOMetadata ) ) { try { TwainIOMetadata twaindata = ( TwainIOMetadata ) metadata ; TwainTransfer . MemoryTransfer . Info info = twaindata . getMemory ( ) ; byte [ ] twainbuf = info . getBuffer ( ) ; int width = info . getWidth ( ) ; int height = info . getHeight ( ) ; int bpr = info . getBytesPerRow ( ) ; ImageData imageData = new ImageData ( width , height , bpr , twainbuf ) ; if ( generationMode == ScanModeConstants . SCAN_MODE_MEMORY_SERIALIZED ) { saveMemoryBlockSerialized ( imageData , new File ( path , prefix + "-serialize" + memoryBlockTotal + ".data" ) ) ; } else if ( generationMode == ScanModeConstants . SCAN_MODE_MEMORY_JPG_BLOCKS ) { saveMemoryBlockJPG ( imageData , new File ( path , prefix + "-block" + memoryBlockTotal + ".jpg" ) , ( float ) 1.0 ) ; } imageData = null ; memoryHeight += height ; memoryWidth = width ; memoryBlockTotal ++ ; if ( metadata . isState ( TwainConstants . STATE_TRANSFERRING ) ) { if ( generationMode == ScanModeConstants . SCAN_MODE_MEMORY_SERIALIZED ) { composePageSerialized ( new File ( path , prefix + "-page" + numPage + ".png" ) ) ; } else if ( generationMode == ScanModeConstants . SCAN_MODE_MEMORY_JPG_BLOCKS ) { composePageJPG ( new File ( path , prefix + "-page" + numPage + ".png" ) ) ; } memoryBlockProcessed = memoryBlockTotal ; memoryHeight = 0 ; memoryRow = 0 ; } } catch ( Exception e ) { e . printStackTrace ( ) ; endProcess ( true , false ) ; } } }
procesa el escaneo de un bloque de memoria
