Changeset 1947


Ignore:
Timestamp:
12/19/06 14:42:43 (13 years ago)
Author:
curtis
Message:

Change debugging logic to call new FormatReader.debug(String) method.
Currently the debug method merely calls System.out.println, but the advantage
is that we could later change the output destination, writing to a log file on
disk, or use a logger class.

Location:
trunk/loci/formats
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FormatReader.java

    r1945 r1947  
    3939 
    4040  // -- Constants -- 
    41  
    42   /** Debugging level. 1=basic, 2=extended, 3=everything. */ 
    43   protected static final int DEBUG_LEVEL = 1; 
    4441 
    4542  /** Default thumbnail width and height. */ 
     
    8986  protected static boolean debug = false; 
    9087 
     88  /** Debugging level. 1=basic, 2=extended, 3=everything. */ 
     89  protected static int debugLevel = 1; 
     90 
    9191  // -- Fields -- 
    9292 
     
    165165      return isThisType(buf); 
    166166    } 
    167     catch (IOException e) { return false; } 
     167    catch (IOException exc) { return false; } 
     168  } 
     169 
     170  /** Issues a debugging statement. */ 
     171  protected void debug(String s) { 
     172    // NB: could use a logger class or other means of output here, if desired 
     173    String name = getClass().getName(); 
     174    String prefix = "loci.formats.in."; 
     175    if (name.startsWith(prefix)) name = name.substring(prefix.length()); 
     176    System.out.println(System.currentTimeMillis() + ": " + name + ": " + s); 
    168177  } 
    169178 
     
    503512          else if (args[i].equals("-fast")) fastBlit = true; 
    504513          else if (args[i].equals("-debug")) debug = true; 
     514          else if (args[i].equals("-level")) { 
     515            try { 
     516              debugLevel = Integer.parseInt(args[++i]); 
     517            } 
     518            catch (Exception exc) { } 
     519          } 
    505520          else if (args[i].equals("-range")) { 
    506521            try { 
     
    508523              end = Integer.parseInt(args[++i]); 
    509524            } 
    510             catch (Exception e) { } 
     525            catch (Exception exc) { } 
    511526          } 
    512527          else if (args[i].equals("-series")) { 
     
    514529              series = Integer.parseInt(args[++i]); 
    515530            } 
    516             catch (Exception e) { } 
     531            catch (Exception exc) { } 
    517532          } 
    518533          else if (args[i].equals("-map")) map = args[++i]; 
     
    525540      } 
    526541    } 
     542    if (debug) System.out.println("Debugging at level " + debugLevel); 
    527543    if (id == null) { 
    528544      String className = reader.getClass().getName(); 
  • trunk/loci/formats/in/AVIReader.java

    r1943 r1947  
    184184  /** Initializes the given AVI file. */ 
    185185  protected void initFile(String id) throws FormatException, IOException { 
    186     if (debug) System.out.println("calling AVIReader.initFile(" + id + ")"); 
     186    if (debug) debug("initFile(" + id + ")"); 
    187187    super.initFile(id); 
    188188    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/AliconaReader.java

    r1943 r1947  
    152152  /** Initializes the given Alicona file. */ 
    153153  protected void initFile(String id) throws FormatException, IOException { 
    154     if (debug) System.out.println("calling AliconaReader.initFile(" + id + ")"); 
     154    if (debug) debug("initFile(" + id + ")"); 
    155155    super.initFile(id); 
    156156    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/AndorReader.java

    r1943 r1947  
    129129      metadata.put("Number of colors", 
    130130        "" + DataTools.bytesToInt(header, pos, 4, little)); 
    131       if (debug) { 
    132         System.out.println("bytes for 'number of colors'"); 
    133         for (int i=pos; i<pos+4; i++) { System.out.print(header[i] + " "); } 
    134         System.out.println(); 
     131      if (debug && debugLevel >= 2) { 
     132        debug("bytes for 'number of colors'"); 
     133        StringBuffer sb = new StringBuffer(); 
     134        for (int i=pos; i<pos+4; i++) sb.append(header[i] + " "); 
     135        debug(sb.toString()); 
    135136      } 
    136137      pos += 4; 
    137       if (debug) { 
    138         System.out.println("bytes for color and comment flags"); 
    139         for (int i=pos; i<pos+16; i++) { System.out.print(header[i] + " "); } 
    140         System.out.println(); 
     138      if (debug && debugLevel >= 2) { 
     139        debug("bytes for color and comment flags"); 
     140        StringBuffer sb = new StringBuffer(); 
     141        for (int i=pos; i<pos+16; i++) sb.append(header[i] + " "); 
     142        debug(sb.toString()); 
    141143      } 
    142144      pos += 8;  // color flags 
     
    199201 
    200202      for (int i=1; i<=10; i++) { 
    201         if (debug) { 
    202           System.out.println("bytes for dimension " + i + " name"); 
    203           for (int j=pos; j<pos+64; j++) { System.out.print(header[j] + " "); } 
    204           System.out.println(); 
    205           System.out.println("remainder of MM_DIM_INFO bytes for dim. " +i); 
    206           for (int j=pos+64; j<pos+100; j++) { 
    207             System.out.print(header[j] + " "); 
    208           } 
    209           System.out.println(); 
     203        if (debug && debugLevel >= 2) { 
     204          debug("bytes for dimension " + i + " name"); 
     205          StringBuffer sb = new StringBuffer(); 
     206          for (int j=pos; j<pos+64; j++) sb.append(header[j] + " "); 
     207          debug(sb.toString()); 
     208          debug("remainder of MM_DIM_INFO bytes for dim. " + i); 
     209          sb.setLength(0); 
     210          for (int j=pos+64; j<pos+100; j++) sb.append(header[j] + " "); 
     211          debug(sb.toString()); 
    210212        } 
    211213 
  • trunk/loci/formats/in/BMPReader.java

    r1943 r1947  
    239239  /** Initializes the given BMP file. */ 
    240240  protected void initFile(String id) throws FormatException, IOException { 
    241     if (debug) System.out.println("calling BMPReader.initFile(" + id + ")"); 
     241    if (debug) debug("initFile(" + id + ")"); 
    242242    super.initFile(id); 
    243243    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/BaseTiffReader.java

    r1943 r1947  
    829829  /** Initializes the given TIFF file. */ 
    830830  protected void initFile(String id) throws FormatException, IOException { 
    831     if (debug) { 
    832       System.out.println("calling BaseTiffReader.initFile(" + id + ")"); 
    833     } 
     831    if (debug) debug("initFile(" + id + ")"); 
    834832    super.initFile(id); 
    835833    channelMinMax = null; 
  • trunk/loci/formats/in/BioRadReader.java

    r1943 r1947  
    168168  /** Initializes the given IPLab file. */ 
    169169  protected void initFile(String id) throws FormatException, IOException { 
    170     if (debug) System.out.println("calling BioRadReader.initFile(" + id + ")"); 
     170    if (debug) debug("initFile(" + id + ")"); 
    171171    super.initFile(id); 
    172172    in = new RandomAccessStream(getMappedId(id)); 
     
    380380    } 
    381381 
    382     if (debug && DEBUG_LEVEL >= 2) { 
    383       System.out.println(numLuts + " color table" + 
    384         (numLuts == 1 ? "" : "s") + " present."); 
     382    if (debug && debugLevel >= 2) { 
     383      debug(numLuts + " color table" + (numLuts == 1 ? "" : "s") + " present."); 
    385384    } 
    386385 
  • trunk/loci/formats/in/CBZip2InputStream.java

    r1615 r1947  
    5353 * An input stream that decompresses from the BZip2 format (without the file 
    5454 * header chars) to be read as any other stream. 
    55  * 
    5655 */ 
    5756public class CBZip2InputStream extends InputStream implements BZip2Constants { 
  • trunk/loci/formats/in/DeltavisionReader.java

    r1943 r1947  
    224224  /** Initializes the given Deltavision file. */ 
    225225  protected void initFile(String id) throws FormatException, IOException { 
    226     if (debug) { 
    227       System.out.println("calling DeltavisionReader.initFile(" + id + ")"); 
    228     } 
     226    if (debug) debug("initFile(" + id + ")"); 
    229227    super.initFile(id); 
    230228 
  • trunk/loci/formats/in/DicomReader.java

    r1943 r1947  
    243243  /** Initializes the given DICOM file. */ 
    244244  protected void initFile(String id) throws FormatException, IOException { 
    245     if (debug) System.out.println("calling DicomReader.initFile(" + id + ")"); 
     245    if (debug) debug("initFile(" + id + ")"); 
    246246    super.initFile(id); 
    247247    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/EPSReader.java

    r1943 r1947  
    170170  /** Initializes the given EPS file. */ 
    171171  protected void initFile(String id) throws FormatException, IOException { 
    172     if (debug) System.out.println("calling EPSReader.initFile(" + id + ")"); 
     172    if (debug) debug("initFile(" + id + ")"); 
    173173    super.initFile(id); 
    174174    in = new BufferedReader(new FileReader(getMappedId(id))); 
  • trunk/loci/formats/in/GIFReader.java

    r1943 r1947  
    219219  /** Initializes the given GIF file. */ 
    220220  protected void initFile(String id) throws FormatException, IOException { 
    221     if (debug) System.out.println("calling GIFReader.initFile(" + id + ")"); 
     221    if (debug) debug("initFile(" + id + ")"); 
    222222    super.initFile(id); 
    223223 
  • trunk/loci/formats/in/GatanReader.java

    r1943 r1947  
    155155  /** Initializes the given Gatan file. */ 
    156156  protected void initFile(String id) throws FormatException, IOException { 
    157     if (debug) System.out.println("calling GatanReader.initFile(" + id + ")"); 
     157    if (debug) debug("initFile(" + id + ")"); 
    158158    super.initFile(id); 
    159159    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/ICSReader.java

    r1943 r1947  
    198198  /** Initializes the given ICS file. */ 
    199199  protected void initFile(String id) throws FormatException, IOException { 
    200     if (debug) System.out.println("calling ICSReader.initFile(" + id + ")"); 
     200    if (debug) debug("initFile(" + id + ")"); 
    201201    super.initFile(id); 
    202202 
  • trunk/loci/formats/in/IPLabReader.java

    r1943 r1947  
    161161  /** Initializes the given IPLab file. */ 
    162162  protected void initFile(String id) throws FormatException, IOException { 
    163     if (debug) System.out.println("calling IPLabReader.initFile(" + id + ")"); 
     163    if (debug) debug("initFile(" + id + ")"); 
    164164    super.initFile(id); 
    165165    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/IPWReader.java

    r1943 r1947  
    193193  /** Initializes the given IPW file. */ 
    194194  protected void initFile(String id) throws FormatException, IOException { 
    195     if (debug) System.out.println("calling IPWReader.initFile(" + id + ")"); 
     195    if (debug) debug("initFile(" + id + ")"); 
    196196    if (noPOI) throw new FormatException(NO_POI_MSG); 
    197197    currentId = id; 
     
    469469  } 
    470470 
    471   /** Debugging utility method. */ 
    472   public static final void print(int depth, String s) { 
     471  /** Debugging helper method. */ 
     472  protected void print(int depth, String s) { 
    473473    StringBuffer sb = new StringBuffer(); 
    474474    for (int i=0; i<depth; i++) sb.append("  "); 
    475475    sb.append(s); 
    476     System.out.println(sb.toString()); 
     476    debug(sb.toString()); 
    477477  } 
    478478 
  • trunk/loci/formats/in/ImageIOReader.java

    r1943 r1947  
    115115  /** Initializes the given file. */ 
    116116  public void initFile(String id) throws FormatException, IOException { 
    117     if (debug) System.out.println("calling ImageIOReader.initFile(" + id + ")"); 
     117    if (debug) debug("initFile(" + id + ")"); 
    118118    super.initFile(id); 
    119119 
  • trunk/loci/formats/in/ImageJReader.java

    r1943 r1947  
    139139  /** Initializes the given file. */ 
    140140  protected void initFile(String id) throws FormatException, IOException { 
    141     if (debug) System.out.println("calling ImageJReader.initFile(" + id + ")"); 
     141    if (debug) debug("initFile(" + id + ")"); 
    142142    super.initFile(id); 
    143143 
  • trunk/loci/formats/in/ImarisReader.java

    r1943 r1947  
    6969  /** Initializes the given Imaris file. */ 
    7070  protected void initFile(String id) throws FormatException, IOException { 
    71     if (debug) System.out.println("calling ImarisReader.initFile(" + id + ")"); 
     71    if (debug) debug("initFile(" + id + ")"); 
    7272    super.initFile(id); 
    7373    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/ImarisTiffReader.java

    r1943 r1947  
    108108  /* @see BaseTiffReader#initFile(String) */ 
    109109  protected void initFile(String id) throws FormatException, IOException { 
    110     if (debug) { 
    111       System.out.println("calling ImarisTiffReader.initFile(" + id + ")"); 
    112     } 
     110    if (debug) debug("initFile(" + id + ")"); 
    113111    super.initFile(id); 
    114112    super.initMetadata(); 
  • trunk/loci/formats/in/LIFReader.java

    r1943 r1947  
    189189  /** Initializes the given LIF file. */ 
    190190  protected void initFile(String id) throws FormatException, IOException { 
    191     if (debug) System.out.println("calling LIFReader.initFile(" + id + ")"); 
     191    if (debug) debug("initFile(" + id + ")"); 
    192192    super.initFile(id); 
    193193    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/LegacyPictReader.java

    r1943 r1947  
    107107  /** Initializes the given PICT file. */ 
    108108  protected void initFile(String id) throws FormatException, IOException { 
    109     if (debug) { 
    110       System.out.println("calling LegacyPictReader.initFile(" + id + ")"); 
    111     } 
     109    if (debug) debug("initFile(" + id + ")"); 
    112110    super.initFile(id); 
    113111    sizeX[0] = openImage(id, 0).getWidth(); 
  • trunk/loci/formats/in/LegacyQTReader.java

    r1943 r1947  
    157157    throws FormatException, IOException 
    158158  { 
    159     if (debug) { 
    160       System.out.println("calling LegacyQTReader.initFile(" + id + ")"); 
    161     } 
     159    if (debug) debug("initFile(" + id + ")"); 
    162160    if (tools == null) { 
    163161      tools = new LegacyQTTools(); 
  • trunk/loci/formats/in/LegacyZVIReader.java

    r1943 r1947  
    138138    } 
    139139 
    140     if (debug) System.out.println("Reading image #" + no + "..."); 
     140    if (debug) debug("Reading image #" + no + "..."); 
    141141 
    142142    ZVIBlock zviBlock = (ZVIBlock) blockList.elementAt(no); 
     
    154154  /** Initializes the given ZVI file. */ 
    155155  protected void initFile(String id) throws FormatException, IOException { 
    156     if (debug) { 
    157       System.out.println("calling LegacyZVIReader.initFile(" + id + ")"); 
    158     } 
     156    if (debug) debug("initFile(" + id + ")"); 
    159157    super.initFile(id); 
    160158    in = new RandomAccessFile(getMappedId(id), "r"); 
     
    217215      pos = header + ZVI_MAGIC_BLOCK_1.length; 
    218216 
    219       if (debug) System.err.println("Found potential image block: " + header); 
     217      if (debug) debug("Found potential image block: " + header); 
    220218 
    221219      // these byte don't matter 
     
    368366      ZVIBlock zviBlock = new ZVIBlock(theZ, theC, theT, width, height, 
    369367        alwaysOne, bytesPerPixel, pixType, bitDepth, pos); 
    370       if (debug) System.out.println(zviBlock); 
     368      if (debug) debug(zviBlock.toString()); 
    371369 
    372370      // perform some checks on the header info 
  • trunk/loci/formats/in/LeicaReader.java

    r1943 r1947  
    221221  /** Initializes the given Leica file. */ 
    222222  protected void initFile(String id) throws FormatException, IOException { 
    223     if (debug) System.out.println("calling LeicaReader.initFile(" + id + ")"); 
     223    if (debug) debug("initFile(" + id + ")"); 
    224224    String idLow = id.toLowerCase(); 
    225225    if (idLow.endsWith("tif") || idLow.endsWith("tiff")) { 
  • trunk/loci/formats/in/MNGReader.java

    r1943 r1947  
    142142  /** Initializes the given MNG file. */ 
    143143  protected void initFile(String id) throws FormatException, IOException { 
    144     if (debug) System.out.println("calling MNGReader.initFile(" + id + ")"); 
     144    if (debug) debug("initFile(" + id + ")"); 
    145145    super.initFile(id); 
    146146    in = new RandomAccessStream(id); 
  • trunk/loci/formats/in/MRCReader.java

    r1943 r1947  
    124124  /** Initializes the given MRC file. */ 
    125125  public void initFile(String id) throws FormatException, IOException { 
    126     if (debug) System.out.println("calling MRCReader.initFile(" + id + ")"); 
     126    if (debug) debug("initFile(" + id + ")"); 
    127127    super.initFile(id); 
    128128    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/ND2Reader.java

    r1943 r1947  
    197197  /** Initializes the given ND2 file. */ 
    198198  protected void initFile(String id) throws FormatException, IOException { 
    199     if (debug) System.out.println("calling ND2Reader.initFile(" + id + ")"); 
     199    if (debug) debug("initFile(" + id + ")"); 
    200200    if (noJAI) throw new FormatException(NO_JAI_MSG); 
    201201    super.initFile(id); 
  • trunk/loci/formats/in/NikonReader.java

    r1943 r1947  
    181181  /* @see BaseTiffReader#initFile(String) */ 
    182182  protected void initFile(String id) throws FormatException, IOException { 
    183     if (debug) System.out.println("calling NikonReader.initFile(" + id + ")"); 
     183    if (debug) debug("initFile(" + id + ")"); 
    184184    close(); 
    185185    currentId = id; 
  • trunk/loci/formats/in/OIBReader.java

    r1943 r1947  
    254254  /** Initializes the given OIB file. */ 
    255255  protected void initFile(String id) throws FormatException, IOException { 
    256     if (debug) System.out.println("calling OIBReader.initFile(" + id + ")"); 
     256    if (debug) debug("initFile(" + id + ")"); 
    257257    if (noPOI) throw new FormatException(NO_POI_MSG); 
    258258    currentId = id; 
     
    617617  } 
    618618 
    619   /** Debugging utility method. */ 
    620   public static final void print(int depth, String s) { 
     619  /** Debugging helper method. */ 
     620  protected void print(int depth, String s) { 
    621621    StringBuffer sb = new StringBuffer(); 
    622622    for (int i=0; i<depth; i++) sb.append("  "); 
    623623    sb.append(s); 
    624     System.out.println(sb.toString()); 
     624    debug(sb.toString()); 
    625625  } 
    626626 
  • trunk/loci/formats/in/OIFReader.java

    r1943 r1947  
    223223  /** Initializes the given OIF file. */ 
    224224  protected void initFile(String id) throws FormatException, IOException { 
    225     if (debug) System.out.println("calling OIFReader.initFile(" + id + ")"); 
     225    if (debug) debug("initFile(" + id + ")"); 
    226226     
    227227    // check to make sure that we have the OIF file 
  • trunk/loci/formats/in/OMEXMLReader.java

    r1943 r1947  
    201201  /** Initializes the given OME-XML file. */ 
    202202  protected void initFile(String id) throws FormatException, IOException { 
    203     if (debug) System.out.println("calling OMEXMLReader.initFile(" + id + ")"); 
     203    if (debug) debug("initFile(" + id + ")"); 
    204204    close(); 
    205205    currentId = id; 
  • trunk/loci/formats/in/OpenlabRawReader.java

    r1943 r1947  
    139139  /** Initializes the given RAW file. */ 
    140140  protected void initFile(String id) throws FormatException, IOException { 
    141     if (debug) { 
    142       System.out.println("calling OpenlabRawReader.initFile(" + id + ")"); 
    143     } 
     141    if (debug) debug("initFile(" + id + ")"); 
    144142    super.initFile(id); 
    145143    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/OpenlabReader.java

    r1943 r1947  
    372372  /** Initialize the given Openlab LIFF file. */ 
    373373  protected void initFile(String id) throws FormatException, IOException { 
    374     if (debug) System.out.println("calling OpenlabReader.initFile(" + id + ")"); 
     374    if (debug) debug("initFile(" + id + ")"); 
    375375    super.initFile(id); 
    376376    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/PerkinElmerReader.java

    r1943 r1947  
    165165  /** Initializes the given PerkinElmer file. */ 
    166166  protected void initFile(String id) throws FormatException, IOException { 
    167     if (debug) { 
    168       System.out.println("calling PerkinElmerReader.initFile(" + id + ")"); 
    169     } 
     167    if (debug) debug("initFile(" + id + ")"); 
    170168    super.initFile(id); 
    171169 
  • trunk/loci/formats/in/PictReader.java

    r1943 r1947  
    180180  /** Initializes the given PICT file. */ 
    181181  protected void initFile(String id) throws FormatException, IOException { 
    182     if (debug) System.out.println("calling PictReader.initFile(" + id + ")"); 
     182    if (debug) debug("initFile(" + id + ")"); 
    183183    super.initFile(id); 
    184184    in = new RandomAccessStream(getMappedId(id)); 
     
    223223    int w = DataTools.bytesToInt(stuff, 6, 2, little); 
    224224    int h = DataTools.bytesToInt(stuff, 8, 2, little); 
    225     if (debug) { 
    226       System.out.println("PictReader.getDimensions: " + w + " x " + h); 
    227     } 
     225    if (debug) debug("getDimensions: " + w + " x " + h); 
    228226    return new Dimension(h, w); 
    229227  } 
     
    233231    // handles case when we call this method directly, instead of 
    234232    // through initFile(String) 
    235     if (debug) System.out.println("PictReader.open"); 
     233    if (debug) debug("open"); 
    236234 
    237235    strips = new Vector(); 
     
    287285 
    288286      if (debug) { 
    289         System.out.println("PictReader.openBytes: 8-bit data, " + width + 
    290           " x " + height + ", length=" + data.length + "x" + data[0].length); 
     287        debug("openBytes: 8-bit data, " + width + " x " + height + 
     288          ", length=" + data.length + "x" + data[0].length); 
    291289      } 
    292290      return ImageTools.makeImage(data, width, height); 
     
    318316 
    319317      if (debug) { 
    320         System.out.println("PictReader.openBytes: 24-bit data, " + width + 
    321           " x " + height + ", length=" + data.length + "x" + data[0].length); 
     318        debug("openBytes: 24-bit data, " + width + " x " + height + 
     319          ", length=" + data.length + "x" + data[0].length); 
    322320      } 
    323321      return ImageTools.makeImage(data, width, height); 
     
    341339 
    342340      if (debug) { 
    343         System.out.println("PictReader.openBytes: 32-bit data, " + width + 
    344           " x " + height + ", length=" + data.length + "x" + data[0].length); 
     341        debug("openBytes: 32-bit data, " + width + " x " + height + 
     342          ", length=" + data.length + "x" + data[0].length); 
    345343      } 
    346344      return ImageTools.makeImage(data, width, height); 
     
    369367 
    370368      if (debug) { 
    371         System.out.println("PictReader.openBytes: 16-bit data, " + 
    372           width + " x " + height + ", length=" + data.length); 
     369        debug("openBytes: 16-bit data, " + width + " x " + height + 
     370          ", length=" + data.length); 
    373371      } 
    374372      return ImageTools.makeImage(data, width, height, 3, true); 
     
    380378  /** Loop through the remainder of the file and find relevant opcodes. */ 
    381379  private boolean driveDecoder() throws FormatException { 
    382     if (debug) System.out.println("PictReader.driveDecoder"); 
     380    if (debug) debug("driveDecoder"); 
    383381    int opcode; 
    384382 
     
    433431  /** Handles the opcodes in the PICT file. */ 
    434432  private boolean drivePictDecoder(int opcode) throws FormatException { 
    435     if (debug) System.out.println("PictReader.drivePictDecoder"); 
     433    if (debug) debug("drivePictDecoder"); 
    436434 
    437435    switch (opcode) { 
     
    462460  /** Handles bitmap and pixmap opcodes of PICT format. */ 
    463461  private void handlePackBits(int opcode) throws FormatException { 
    464     if (debug) System.out.println("PictReader.handlePackBits(" + opcode + ")"); 
     462    if (debug) debug("handlePackBits(" + opcode + ")"); 
    465463    if (opcode == PICT_9A) { 
    466464      // special case 
     
    477475  /** Extract the image data in a PICT bitmap structure. */ 
    478476  private void handleBitmap(int opcode) throws FormatException { 
    479     if (debug) System.out.println("PictReader.handleBitmap(" + opcode + ")"); 
     477    if (debug) debug("handleBitmap(" + opcode + ")"); 
    480478    int row; 
    481479    byte[] buf;  // raw byte buffer for data from file 
     
    554552  /** Extracts the image data in a PICT pixmap structure. */ 
    555553  private void handlePixmap(int opcode) throws FormatException { 
    556     if (debug) System.out.println("PictReader.handlePixmap(" + opcode + ")"); 
     554    if (debug) debug("handlePixmap(" + opcode + ")"); 
    557555    int pixelSize; 
    558556    int compCount; 
     
    665663  { 
    666664    if (debug) { 
    667       System.out.println("PictReader.handlePixmap(" + 
    668         rBytes + ", " + pixelSize + ", " + compCount + ")"); 
     665      debug("handlePixmap(" + rBytes + ", " + 
     666        pixelSize + ", " + compCount + ")"); 
    669667    } 
    670668    int rawLen; 
     
    703701    if (!compressed) { 
    704702      if (debug) { 
    705         System.out.println("Pixel data is uncompressed (pixelSize=" + 
    706           pixelSize + ")."); 
     703        debug("Pixel data is uncompressed (pixelSize=" + pixelSize + ")."); 
    707704      } 
    708705      buf = new byte[bufSize]; 
     
    728725    else { 
    729726      if (debug) { 
    730         System.out.println("Pixel data is compressed (pixelSize=" + 
     727        debug("Pixel data is compressed (pixelSize=" + 
    731728          pixelSize + "; compCount=" + compCount + ")."); 
    732729      } 
     
    806803  { 
    807804    if (debug) { 
    808       System.out.println("PictReader.expandPixels(" + bitSize + ", " + 
     805      debug("expandPixels(" + bitSize + ", " + 
    809806        ib.length + ", " + ob.length + ", " + outLen + ")"); 
    810807    } 
     
    886883  /** PackBits variant that outputs an int array. */ 
    887884  private void unpackBits(byte[] ib, int[] ob) { 
    888     if (debug) { 
    889       System.out.println("PictReader.unpackBits(" + ib + ", " + ob + ")"); 
    890     } 
     885    if (debug) debug("unpackBits(" + ib + ", " + ob + ")"); 
    891886    int i = 0; 
    892887    int o = 0; 
  • trunk/loci/formats/in/QTReader.java

    r1943 r1947  
    318318    { 
    319319      if (debug) { 
    320         System.out.println("Unsupported codec (" + 
    321           code + "); using QTJava reader"); 
     320        debug("Unsupported codec (" + code + "); using QTJava reader"); 
    322321      } 
    323322      doLegacy = true; 
     
    499498    { 
    500499      if (debug) { 
    501         System.out.println("Unsupported codec (" + 
    502           code + "); using QTJava reader"); 
     500        debug("Unsupported codec (" + code + "); using QTJava reader"); 
    503501      } 
    504502      doLegacy = true; 
     
    557555  /** Initializes the given QuickTime file. */ 
    558556  protected void initFile(String id) throws FormatException, IOException { 
    559     if (debug) System.out.println("calling QTReader.initFile(" + id + ")"); 
     557    if (debug) debug("initFile(" + id + ")"); 
    560558    super.initFile(id); 
    561559    in = new RandomAccessStream(id); 
     
    659657      // to read the file; otherwise we will fail gracefully. 
    660658 
    661       if (DEBUG) { 
    662         System.out.println("Failed to find the QuickTime resource fork. " + 
     659      if (debug) { 
     660        debug("Failed to find the QuickTime resource fork. " + 
    663661          "Attempting to proceed using only the data fork."); 
    664662      } 
     
    721719 
    722720      if (atomSize < 0) { 
    723         System.out.println("Invalid atom size : " + atomSize); 
     721        System.err.println("QTReader: invalid atom size: " + atomSize); 
    724722      } 
    725723 
    726724      if (debug) { 
    727         System.out.println("seeking to " + offset + "; atomType=" + atomType + 
    728           "; atomSize=" + atomSize); 
     725        debug("Seeking to " + offset + 
     726          "; atomType=" + atomType + "; atomSize=" + atomSize); 
    729727      } 
    730728 
     
    889887  /** Debugging method; prints information on an atom. */ 
    890888  public void print(int depth, long size, String type, byte[] data) { 
    891     for (int i=0; i<depth; i++) System.out.print(" "); 
    892     System.out.print(type + " : [" + size + "]\n"); 
     889    StringBuffer sb = new StringBuffer(); 
     890    for (int i=0; i<depth; i++) sb.append(" "); 
     891    sb.append(type + " : [" + size + "]"); 
     892    debug(sb.toString()); 
    893893  } 
    894894 
  • trunk/loci/formats/in/SDTReader.java

    r1943 r1947  
    199199  /** Initializes the given SDT file. */ 
    200200  protected void initFile(String id) throws FormatException, IOException { 
    201     if (debug) System.out.println("calling SDTReader.initFile(" + id + ")"); 
     201    if (debug) debug("initFile(" + id + ")"); 
    202202    super.initFile(id); 
    203203    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/SlidebookReader.java

    r1943 r1947  
    131131  /** Initializes the given Slidebook file. */ 
    132132  protected void initFile(String id) throws FormatException, IOException { 
    133     if (debug) { 
    134       System.out.println("calling SlidebookReader.initFile(" + id + ")"); 
    135     } 
     133    if (debug) debug("initFile(" + id + ")"); 
    136134    super.initFile(id); 
    137135    in = new RandomAccessStream(getMappedId(id)); 
  • trunk/loci/formats/in/ZeissLSMReader.java

    r1943 r1947  
    154154  /** Initializes the given Zeiss LSM file. */ 
    155155  protected void initFile(String id) throws FormatException, IOException { 
    156     if (debug) { 
    157       System.out.println("calling ZeissLSMReader.initFile(" + id + ")"); 
    158     } 
     156    if (debug) debug("initFile(" + id + ")"); 
    159157    super.initFile(id); 
    160158    channels = 0; 
  • trunk/loci/formats/in/ZeissZVIReader.java

    r1943 r1947  
    330330  /** Initializes the given ZVI file. */ 
    331331  protected void initFile(String id) throws FormatException, IOException { 
    332     if (debug) { 
    333       System.out.println("calling ZeissZVIReader.initFile(" + id + ")"); 
    334     } 
     332    if (debug) debug("initFile(" + id + ")"); 
    335333 
    336334    if (noPOI || needLegacy) { 
     
    815813  } 
    816814 
    817   /** Debugging utility method. */ 
    818   public static final void print(int depth, String s) { 
     815  /** Debugging helper method. */ 
     816  protected void print(int depth, String s) { 
    819817    StringBuffer sb = new StringBuffer(); 
    820818    for (int i=0; i<depth; i++) sb.append("  "); 
    821819    sb.append(s); 
    822     System.out.println(sb.toString()); 
     820    debug(sb.toString()); 
    823821  } 
    824822 
Note: See TracChangeset for help on using the changeset viewer.