Class PrincetonObjectDictionaryFile

    • Field Detail

      • _file

        private java.io.File _file
      • _in

        private java.io.ObjectInputStream _in
      • _out

        private java.io.ObjectOutputStream _out
    • Constructor Detail

      • PrincetonObjectDictionaryFile

        public PrincetonObjectDictionaryFile()
      • PrincetonObjectDictionaryFile

        public PrincetonObjectDictionaryFile​(java.lang.String path,
                                             POS pos,
                                             DictionaryFileType fileType)
    • Method Detail

      • openStreams

        public void openStreams()
                         throws java.io.IOException
        Open the input and output streams.
        Throws:
        java.io.IOException
      • openOutputStream

        private void openOutputStream()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • openInputStream

        private void openInputStream()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getInputStream

        public java.io.ObjectInputStream getInputStream()
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getOutputStream

        public java.io.ObjectOutputStream getOutputStream()
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • canRead

        public boolean canRead()
      • canWrite

        public boolean canWrite()
      • readObject

        public java.lang.Object readObject()
                                    throws java.io.IOException,
                                           java.lang.ClassNotFoundException
        Description copied from interface: ObjectDictionaryFile
        Read and deserialize an object from the file
        Specified by:
        readObject in interface ObjectDictionaryFile
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • writeObject

        public void writeObject​(java.lang.Object obj)
                         throws java.io.IOException
        Description copied from interface: ObjectDictionaryFile
        Serialize and write an object ot the file.
        Specified by:
        writeObject in interface ObjectDictionaryFile
        Throws:
        java.io.IOException
      • openFile

        protected void openFile​(java.io.File path)
                         throws java.io.IOException
        Here we try to be intelligent about opening streams. If the file does not already exist, we assume that we are going to be creating it and writing to it, otherwise we assume that we are going to be reading from it. If you want the other stream open, you must do it explicitly by calling openStreams.
        Specified by:
        openFile in class AbstractDictionaryFile
        Throws:
        java.io.IOException