1 19 20 package org.netbeans.modules.search; 21 22 import java.io.ByteArrayOutputStream ; 23 import java.io.IOException ; 24 import java.io.ObjectOutputStream ; 25 import org.openidex.search.SearchType; 26 27 32 final class SearchCriterion implements java.io.Serializable { 33 34 private static final long serialVersionUID = 1190693501592921043L; 35 36 37 String searchTypeClassName; 38 39 String name; 40 41 byte[] criterionData; 42 43 53 SearchCriterion(SearchType searchType) throws IOException { 54 this.name = searchType.getName(); 55 searchTypeClassName = searchType.getClass().getName(); 56 57 58 ObjectOutputStream oos = null; 59 try { 60 ByteArrayOutputStream bos; 61 oos = new ObjectOutputStream (bos = new ByteArrayOutputStream (8192)); 62 oos.writeObject(searchType); 63 criterionData = bos.toByteArray(); 64 } finally { 65 if (oos != null) { 66 oos.close(); 67 } 68 } 69 } 70 71 72 public String toString() { 73 return name; 74 } 75 76 } 77 | Popular Tags |