Examples of IOException


Examples of java.io.IOException

    File cfgFile = new File(path);
    if (cfgFile.exists() && cfgFile.isFile()) {
      if ((cfgFile.length() == 0)) {
        Log.logger.log(BasicLevel.ERROR,
                       " \"" + cfgFile.getPath() + "\", is empty.");
        throw new IOException(" \"" + cfgFile.getPath() + "\", is empty.");
      }
     
      FileInputStream fis = null;
      try {
        fis = new FileInputStream(cfgFile);
        ObjectInputStream ois = new ObjectInputStream(fis);
        a3config = (A3CMLConfig) ois.readObject();
      } catch (Exception exc) {
        Log.logger.log(BasicLevel.WARN, "Can't load configuration: " + path, exc);
      } finally {
        if (fis != null) fis.close();
      }

      if (Log.logger.isLoggable(BasicLevel.DEBUG))
        Log.logger.log(BasicLevel.DEBUG,
                       "Config.load : a3cmlconfig = " + a3config);
      return a3config;
    }

    //search a3config in path used to load classes.
    ClassLoader classLoader = null;
    InputStream is = null;
    try {
      classLoader = A3CMLConfig.class.getClassLoader();
      if (classLoader != null) {
        Log.logger.log(BasicLevel.WARN,
                       "Trying to find [" + path + "] using " +
                       classLoader + " class loader.");
        is = classLoader.getResourceAsStream(path);
      }
    } catch(Throwable t) {
      Log.logger.log(BasicLevel.WARN,
                     "Can't find [" + path + "] using " +
                     classLoader + " class loader.", t);
      is = null;
    }
    if (is == null) {
      // Last ditch attempt: get the resource from the system class path.
      Log.logger.log(BasicLevel.WARN,
                     "Trying to find serialized config using ClassLoader.getSystemResource().");
      is = ClassLoader.getSystemResourceAsStream(path);
    }
    if (is != null) {
      ObjectInputStream ois = new ObjectInputStream(is);
      a3config = (A3CMLConfig) ois.readObject();
    }

    if (a3config == null) {
      Log.logger.log(BasicLevel.WARN,
                     "Unable to find configuration file: " + path);
      throw new IOException("Unable to find configuration file: " + path);
    }
   
    if (Log.logger.isLoggable(BasicLevel.DEBUG))
      Log.logger.log(BasicLevel.DEBUG, "Config.load : a3cmlconfig = " + a3config);
    return a3config;
View Full Code Here

Examples of java.io.IOException

    gzipstream = new GZIPOutputStream(baos);
  }

  public void close() throws IOException {
    if (closed) {
      throw new IOException("This output stream has already been closed");
    }
    gzipstream.finish();

    byte[] bytes = baos.toByteArray();
View Full Code Here

Examples of java.io.IOException

    closed = true;
  }

  public void flush() throws IOException {
    if (closed) {
      throw new IOException("Cannot flush a closed output stream");
    }
    gzipstream.flush();
  }
View Full Code Here

Examples of java.io.IOException

    gzipstream.flush();
  }

  public void write(int b) throws IOException {
    if (closed) {
      throw new IOException("Cannot write to a closed output stream");
    }
    gzipstream.write((byte) b);
  }
View Full Code Here

Examples of java.io.IOException

    write(b, 0, b.length);
  }

  public void write(byte b[], int off, int len) throws IOException {
    if (closed) {
      throw new IOException("Cannot write to a closed output stream");
    }
    gzipstream.write(b, off, len);
  }
View Full Code Here

Examples of nanomsg.exceptions.IOException

    @Override
    public void subscribe(final String topic) throws IOException {
        try {
            subscribe(topic.getBytes("utf-8"));
        } catch (UnsupportedEncodingException e) {
            throw new IOException(e);
        }
    }
View Full Code Here

Examples of org.apache.hadoop.thriftfs.api.IOException

    Configuration.addDefaultResource("thriftfs-site.xml");
  }

  public static IOException toThrift(Throwable t) {
    if (t == null) {
      return new IOException();
    }

    IOException ret = new IOException();
    ret.clazz = t.getClass().getName();
    ret.msg = t.getMessage();
    ret.stack = "";
    for (StackTraceElement frame : t.getStackTrace()) {
      ret.stack += frame.toString() + "\n";
View Full Code Here

Examples of org.jboss.dna.graph.property.IoException

        if (stream == null) return null;
        try {
            byte[] value = IoUtil.readBytes(stream);
            return create(value);
        } catch (IOException err) {
            throw new IoException(GraphI18n.errorConvertingIo.text(InputStream.class.getSimpleName(),
                                                                   Binary.class.getSimpleName()), err);
        }
    }
View Full Code Here

Examples of org.jooq.exception.IOException

                writer.append("" + (size() - maxRecords));
                writer.append(" record(s) truncated...");
            }
        }
        catch (java.io.IOException e) {
            throw new IOException("Exception while writing TEXT", e);
        }
    }
View Full Code Here

Examples of org.modeshape.jcr.value.IoException

                } catch (IOException e) {
                    Logger.getLogger(getClass()).debug(e, "Error closing the stream while converting from Binary to String");
                }
            }
        } catch (RepositoryException e) {
            throw new IoException(e);
        } finally {
            value.dispose();
        }
    }
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.