/[storm]/storm/org/nongnu/storm/util/ContentTypeIndexType.java
ViewVC logotype

Diff of /storm/org/nongnu/storm/util/ContentTypeIndexType.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by benja, Mon Apr 7 20:16:28 2003 UTC revision 1.2 by benja, Sat Apr 19 12:20:32 2003 UTC
# Line 50  public class ContentTypeIndexType implem Line 50  public class ContentTypeIndexType implem
50           *  XXX For real use, this should not block.           *  XXX For real use, this should not block.
51           */           */
52          public Set getBlocks(String contentType) throws IOException {          public Set getBlocks(String contentType) throws IOException {
53              byte[] key = contentType.getBytes("US-ASCII");              String key = contentType;
54              Collection mappings = db.get(key).block();              Collection mappings = db.get(key).block();
55    
56              Set result = new HashSet(mappings.size());              Set result = new HashSet(mappings.size());
57    
58              for(Iterator i=mappings.iterator(); i.hasNext();) {              for(Iterator i=mappings.iterator(); i.hasNext();) {
59                  IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();                  IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();
60                  if(!java.util.Arrays.equals(key, m.key))                  if(!key.equals(m.key))
61                      throw new Error("Key does not match");                      throw new Error("Key does not match");
62                  if(m.value.length != 0)                  if(!m.value.equals(""))
63                      throw new Error("Value does not match");                      throw new Error("Value does not match");
64                                    
65                  result.add(m.block);                  result.add(m.block);
# Line 70  public class ContentTypeIndexType implem Line 70  public class ContentTypeIndexType implem
70      }      }
71    
72      public Set getMappings(Block block) throws IOException {      public Set getMappings(Block block) throws IOException {
73          String ct = block.getId().getContentType();          String key = block.getId().getContentType();
74          byte[] key = ct.getBytes("US-ASCII");          String value = "";
         byte[] value = new byte[0];  
75    
76          IndexedPool.Mapping mapping = new IndexedPool.Mapping(block.getId(),          IndexedPool.Mapping mapping = new IndexedPool.Mapping(block.getId(),
77                                                                key, value);                                                                key, value);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26