Changeset 6154


Ignore:
Timestamp:
04/20/10 16:34:14 (10 years ago)
Author:
curtis
Message:

Create only one codec per instance of NativeND2Reader.
This change avoids a problem where a new ServiceFactory
was initialized every time openBytes is called.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/NativeND2Reader.java

    r6118 r6154  
    7878  private boolean isJPEG; 
    7979 
     80  /** Codec to use when decompressing pixel data. */ 
     81  private Codec codec; 
     82 
    8083  /** Whether or not the pixel data is losslessly compressed. */ 
    8184  private boolean isLossless; 
     
    148151 
    149152    if (isJPEG || isLossless) { 
    150       Codec codec = isJPEG ? new JPEG2000Codec() : new ZlibCodec(); 
     153      if (codec == null) codec = createCodec(isJPEG); 
    151154      byte[] t = codec.decompress(in, options); 
    152155      int effectiveX = getSizeX() + scanlinePad; 
     
    175178      ts.clear(); 
    176179      isJPEG = isLossless = false; 
     180      codec = null; 
    177181      numSeries = 0; 
    178182      tsT.clear(); 
     
    13201324  } 
    13211325 
     1326  private Codec createCodec(boolean isJPEG) { 
     1327    return isJPEG ? new JPEG2000Codec() : new ZlibCodec(); 
     1328  } 
     1329 
    13221330} 
Note: See TracChangeset for help on using the changeset viewer.