Package org.maltparserx.core.io.dataformat

Examples of org.maltparserx.core.io.dataformat.DataFormatException


          writer.close();
        }
        writer = null;
      }
    }   catch (IOException e) {
      throw new DataFormatException("Could not close the output file. ", e);
    }
  }
View Full Code Here


    try {
      if (graphReaderClass != null) {
        this.graphReaderClass = graphReaderClass.asSubclass(org.maltparserx.core.syntaxgraph.reader.SyntaxGraphReader.class);
      }
    } catch (ClassCastException e) {
      throw new DataFormatException("The class '"+graphReaderClass.getName()+"' is not a subclass of '"+org.maltparserx.core.syntaxgraph.reader.SyntaxGraphReader.class.getName()+"'. ", e);
    }
  }
View Full Code Here

        reader.open(f.findURL(inputFile), inputCharSet);
      }
      reader.setDataFormatInstance(inputDataFormatInstance);
      reader.setOptions(readerOptions);
    } catch (InstantiationException e) {
      throw new DataFormatException("The data reader '"+syntaxGraphReader.getName()+"' cannot be initialized. ", e);
    } catch (IllegalAccessException e) {
      throw new DataFormatException("The data reader '"+syntaxGraphReader.getName()+"' cannot be initialized. ", e);
    }  
  }
View Full Code Here

  public void open(String fileName, String charsetName) throws MaltChainedException {
    try {
      open(new OutputStreamWriter(new FileOutputStream(fileName),charsetName));
    } catch (FileNotFoundException e) {
      throw new DataFormatException("The output file '"+fileName+"' cannot be found.", e);
    } catch (UnsupportedEncodingException e) {
      throw new DataFormatException("The character encoding set '"+charsetName+"' isn't supported.", e);
   
  }
View Full Code Here

      if (os == System.out || os == System.err) {
        closeStream = false;
      }
      open(new OutputStreamWriter(os, charsetName));
    } catch (UnsupportedEncodingException e) {
      throw new DataFormatException("The character encoding set '"+charsetName+"' isn't supported.", e);
    }
  }
View Full Code Here

      try {
        writer.write(SENTENCE_SEPARATOR);
        writer.flush();
      } catch (IOException e) {
        close();
        throw new DataFormatException("Could not write to the output file. ", e);
      }
    }
  }
View Full Code Here

          writeElement(node);
        }
        writer.write(CLOSING_BRACKET);
      }
    } catch (IOException e) {
      throw new DataFormatException("Could not write to the output file. ", e);
    }
  }
View Full Code Here

          writeElement(node, depth + 1);
        }
        writer.write("\n" + getIndentation(depth) + CLOSING_BRACKET);
      }
    } catch (IOException e) {
      throw new DataFormatException("Could not write to the output file. ", e);
    }
  }
View Full Code Here

    String[] argv;
    try {
      argv = optionString.split("[_\\p{Blank}]");
    } catch (PatternSyntaxException e) {
      throw new DataFormatException("Could not split the bracket writer option '"+optionString+"'. ", e);
    }
    for (int i=0; i < argv.length-1; i++) {
      if(argv[i].charAt(0) != '-') {
        throw new DataFormatException("The argument flag should start with the following character '-', not with "+argv[i].charAt(0));
      }
      if(++i>=argv.length) {
        throw new DataFormatException("The last argument does not have any value. ");
      }
      switch(argv[i-1].charAt(1)) {
      case 'f':
        if (argv[i].equals("p")) {
          format = PennWriterFormat.PRETTY;
        } else if (argv[i].equals("p")) {
          format = PennWriterFormat.DEFAULT;
        }
        break;
      default:
        throw new DataFormatException("Unknown bracket writer option: '"+argv[i-1]+"' with value '"+argv[i]+"'. ");   
      }
    } 
  }
View Full Code Here

          writer.close();
        }
        writer = null;
      }
    }   catch (IOException e) {
      throw new DataFormatException("Could not close the output file. ", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.io.dataformat.DataFormatException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.