Changeset 6395


Ignore:
Timestamp:
05/26/10 20:05:14 (9 years ago)
Author:
melissa
Message:

Read tags into a byte array, so that non-String tags are preserved. See  omero:2437.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/in/IPLabReader.java

    r6329 r6395  
    207207    LOGGER.info("Reading tags"); 
    208208 
    209     String tag = in.readString(4); 
     209    byte[] tagBytes = new byte[4]; 
     210    in.read(tagBytes); 
     211    String tag = new String(tagBytes); 
    210212    while (!tag.equals("fini") && in.getFilePointer() < in.length() - 4) { 
    211213      int size = in.readInt(); 
     
    351353        store.setImageDescription(notes, 0); 
    352354      } 
    353       else if (tag.charAt(0) == (char) 0x1a && tag.charAt(1) == (char) 0xd9 && 
    354         tag.charAt(2) == (char) 0x8b && tag.charAt(3) == (char) 0xef) 
     355      else if (tagBytes[0] == 0x1a && tagBytes[1] == (byte) 0xd9 && 
     356        tagBytes[2] == (byte) 0x8b && tagBytes[3] == (byte) 0xef) 
    355357      { 
    356358        int units = in.readInt(); 
     
    390392 
    391393      if (in.getFilePointer() + 4 <= in.length()) { 
    392         tag = in.readString(4); 
     394        in.read(tagBytes); 
     395        tag = new String(tagBytes); 
    393396      } 
    394397      else { 
  • trunk/components/bio-formats/src/loci/formats/in/IPLabReader.java

    r6329 r6395  
    207207    LOGGER.info("Reading tags"); 
    208208 
    209     String tag = in.readString(4); 
     209    byte[] tagBytes = new byte[4]; 
     210    in.read(tagBytes); 
     211    String tag = new String(tagBytes); 
    210212    while (!tag.equals("fini") && in.getFilePointer() < in.length() - 4) { 
    211213      int size = in.readInt(); 
     
    351353        store.setImageDescription(notes, 0); 
    352354      } 
    353       else if (tag.charAt(0) == (char) 0x1a && tag.charAt(1) == (char) 0xd9 && 
    354         tag.charAt(2) == (char) 0x8b && tag.charAt(3) == (char) 0xef) 
     355      else if (tagBytes[0] == 0x1a && tagBytes[1] == (byte) 0xd9 && 
     356        tagBytes[2] == (byte) 0x8b && tagBytes[3] == (byte) 0xef) 
    355357      { 
    356358        int units = in.readInt(); 
     
    390392 
    391393      if (in.getFilePointer() + 4 <= in.length()) { 
    392         tag = in.readString(4); 
     394        in.read(tagBytes); 
     395        tag = new String(tagBytes); 
    393396      } 
    394397      else { 
Note: See TracChangeset for help on using the changeset viewer.