Changeset 8243 in josm for trunk/src/com/drew/metadata/jpeg
- Timestamp:
- 2015-04-21T00:42:50+02:00 (10 years ago)
- Location:
- trunk/src/com/drew/metadata/jpeg
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/drew/metadata/jpeg/JpegCommentReader.java
r8132 r8243 48 48 } 49 49 50 public void extract(@NotNull byte[] segmentBytes, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType)50 public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType) 51 51 { 52 JpegCommentDirectory directory = metadata.getOrCreateDirectory(JpegCommentDirectory.class); 52 for (byte[] segmentBytes : segments) { 53 JpegCommentDirectory directory = new JpegCommentDirectory(); 54 metadata.addDirectory(directory); 53 55 54 // The entire contents of the directory are the comment 55 directory.setString(JpegCommentDirectory.TAG_COMMENT, new String(segmentBytes)); 56 // The entire contents of the directory are the comment 57 directory.setString(JpegCommentDirectory.TAG_COMMENT, new String(segmentBytes)); 58 } 56 59 } 57 60 } -
trunk/src/com/drew/metadata/jpeg/JpegReader.java
r8132 r8243 63 63 } 64 64 65 public boolean canProcess(@NotNull byte[] segmentBytes, @NotNull JpegSegmentType segmentType)65 public void readJpegSegments(@NotNull Iterable<byte[]> segments, @NotNull Metadata metadata, @NotNull JpegSegmentType segmentType) 66 66 { 67 return true; 67 for (byte[] segmentBytes : segments) { 68 extract(segmentBytes, metadata, segmentType); 69 } 68 70 } 69 71 70 public void extract( @NotNull byte[] segmentBytes, @NotNull Metadata metadata, @NotNullJpegSegmentType segmentType)72 public void extract(byte[] segmentBytes, Metadata metadata, JpegSegmentType segmentType) 71 73 { 72 if (metadata.containsDirectory(JpegDirectory.class)) { 73 // If this directory is already present, discontinue this operation. 74 // We only store metadata for the *first* matching SOFn segment. 75 return; 76 } 77 78 JpegDirectory directory = metadata.getOrCreateDirectory(JpegDirectory.class); 74 JpegDirectory directory = new JpegDirectory(); 75 metadata.addDirectory(directory); 79 76 80 77 // The value of TAG_COMPRESSION_TYPE is determined by the segment type found … … 101 98 directory.setObject(JpegDirectory.TAG_COMPONENT_DATA_1 + i, component); 102 99 } 103 104 100 } catch (IOException ex) { 105 101 directory.addError(ex.getMessage());
Note:
See TracChangeset
for help on using the changeset viewer.