Exemplo n.º 1
0
 public void writeTo(ObjectOutputStream out) throws java.io.IOException {
   checkBuild();
   out.writeObject(wordClasses);
   out.writeObject(wordClassMap);
   out.writeObject(skipHeader);
   out.writeObject(values);
   out.writeInt(interpretationCountBits);
   out.writeInt(interpretationLengthBits);
   out.writeInt(valueCountBits);
   out.writeInt(valuePointerBits);
   out.writeInt(wordClassBits);
   out.writeInt(wordClassCount);
   out.writeInt(maxFreeValueCount);
   int entryCount = entries.length;
   out.writeInt(entryCount);
   UNKNOWN.writeTo(out);
   UNKNOWN_WORD_UPPER.writeTo(out);
   UNKNOWN_WORD_LOWER.writeTo(out);
   CHAR.writeTo(out);
   NUMBER.writeTo(out);
   for (int i = 0; i < entryCount; i++) {
     out.writeInt(hashCodes[i]);
     entries[i].writeTo(out);
   }
 }
Exemplo n.º 2
0
  void readFrom(ObjectInputStream in) throws Exception {
    wordClasses = (WordClass[]) in.readObject();
    wordClassMap = (Map) in.readObject();
    skipHeader = (int[]) in.readObject();
    values = (AttributeValue[]) in.readObject();
    interpretationCountBits = in.readInt();
    interpretationLengthBits = in.readInt();
    valueCountBits = in.readInt();
    valuePointerBits = in.readInt();
    wordClassBits = in.readInt();
    wordClassCount = in.readInt();
    maxFreeValueCount = in.readInt();
    int entryCount = in.readInt();
    entries = new DictionaryEntry[entryCount];
    hashCodes = new int[entryCount];
    Runtime rt = Runtime.getRuntime();
    int i = 0;
    try {
      UNKNOWN = DictionaryEntry.readDictionaryEntryFrom(in);
      UNKNOWN_WORD_UPPER = DictionaryEntry.readDictionaryEntryFrom(in);
      UNKNOWN_WORD_LOWER = DictionaryEntry.readDictionaryEntryFrom(in);
      CHAR = DictionaryEntry.readDictionaryEntryFrom(in);
      NUMBER = DictionaryEntry.readDictionaryEntryFrom(in);

      for (i = 0; i < entryCount; i++) {
        hashCodes[i] = in.readInt();
        entries[i] = DictionaryEntry.readDictionaryEntryFrom(in);
      }
    } catch (OutOfMemoryError oem) {
      oem.printStackTrace();
      throw new Exception(oem.getMessage());
    }
    interpreterPool = new Stack();
    tokenizedInputExtensionPool = new Stack();
    checkBuild();
  }