Examples of IOException


Examples of java.io.IOException

    HttpConnection connection = new HttpConnection();
    try {
      connection.socket = TimedSocket.getSocket(address, port, timeout);
      connection.socket.setSoTimeout(timeout);
    } catch (InterruptedIOException e) {
      throw new IOException("timeout during connect: "+e.getMessage());
    }
    return connection;
  }
View Full Code Here

Examples of java.io.IOException

   *
   * @return an InputStream or null if no connection is established
   * @exception IOException if an I/O error occurs when creating the stream
   */
  public InputStream getInputStream() throws IOException {
    if (socket == null) throw new IOException("not conected");
    return socket.getInputStream();
  }
View Full Code Here

Examples of java.io.IOException

   *
   * @return an OutputStream or null if no connection is established
   * @exception IOException if an I/O error occurs when creating the stream
   */
  public OutputStream getOutputStream() throws IOException {
    if (socket == null) throw new IOException("not conected");
    return socket.getOutputStream();
  }
View Full Code Here

Examples of java.io.IOException

      int writeMode = getWriteMode();
      Instances structure = getInstances();
      PrintWriter outW = null;
     
      if(getRetrieval() == BATCH || getRetrieval() == NONE)
          throw new IOException("Batch and incremental saving cannot be mixed.");
      if(getWriter() != null)
          outW = new PrintWriter(getWriter());
         
      if(writeMode == WAIT){
        if(structure == null){
            setWriteMode(CANCEL);
            if(inst != null)
                System.err.println("Structure(Header Information) has to be set in advance");
        }
        else
            setWriteMode(STRUCTURE_READY);
        writeMode = getWriteMode();
      }
      if(writeMode == CANCEL){
          if(outW != null)
              outW.close();
          cancel();
      }
      if(writeMode == STRUCTURE_READY){
          setWriteMode(WRITE);
          //write header
          Instances header = new Instances(structure,0);
          if(retrieveFile() == null || outW == null)
              System.out.println(header.toString());
          else{
              outW.print(header.toString());
              outW.print("\n");
              outW.flush();
          }
          writeMode = getWriteMode();
      }
      if(writeMode == WRITE){
          if(structure == null)
              throw new IOException("No instances information available.");
          if(inst != null){
          //write instance
              if(retrieveFile() == null || outW == null)
                System.out.println(inst);
              else{
View Full Code Here

Examples of java.io.IOException

   * @throws IOException throws IOException if saving in batch mode is not possible
   */
  public void writeBatch() throws IOException {
 
      if(getInstances() == null)
          throw new IOException("No instances to save");
      if(getRetrieval() == INCREMENTAL)
          throw new IOException("Batch and incremental saving cannot be mixed.");
      setRetrieval(BATCH);
      setWriteMode(WRITE);
      if(retrieveFile() == null && getWriter() == null){
          System.out.println((getInstances()).toString());
          setWriteMode(WAIT);
View Full Code Here

Examples of java.io.IOException

   */
  public void setSource(File dir) throws IOException {
    reset();
   
    if (dir == null) {
      throw new IOException("Source directory object is null!");
    }
   
    m_sourceFile = dir;
    if (!dir.exists() || !dir.isDirectory())
      throw new IOException("Directory '" + dir + "' not found");
  }
View Full Code Here

Examples of java.io.IOException

   *         set of Instances
   * @throws IOException   if an error occurs
   */
  public Instances getStructure() throws IOException {
    if (getDirectory() == null) {
      throw new IOException("No directory/source has been specified");
    }
   
    // determine class labels, i.e., sub-dirs
    if (m_structure == null) {
      String directoryPath = getDirectory().getAbsolutePath();
View Full Code Here

Examples of java.io.IOException

   * @return the structure of the data set as an empty set of Instances
   * @throws IOException if there is no source or parsing fails
   */
  public Instances getDataSet() throws IOException {
    if (getDirectory() == null)
      throw new IOException("No directory/source has been specified");
   
    String directoryPath = getDirectory().getAbsolutePath();
    ArrayList<String> classes = new ArrayList<String>();
    Enumeration enm = getStructure().classAttribute().enumerateValues();
    while (enm.hasMoreElements())
View Full Code Here

Examples of java.io.IOException

   * @return never returns without throwing an exception
   * @throws IOException always. TextDirectoryLoader is unable to process a data
   * set incrementally.
   */
  public Instance getNextInstance(Instances structure) throws IOException {
    throw new IOException("TextDirectoryLoader can't read data sets incrementally.");
  }
View Full Code Here

Examples of java.io.IOException

        }

        //
        // Password not found
        //
        throw new IOException();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.