Package java.io

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


  public void init(Socket sock) throws IOException {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG, "ReliableTcpConnection.init()");
    synchronized (this) {
      if (getStatus() != INIT)
        throw new IOException("Already connected");
      setStatus(CONNECTING);
    }

    try {
      this.sock = sock;
View Full Code Here

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG,
                 "ReliableTcpConnection.send(" + request + ')');

    if (getStatus() != CONNECT)
      throw new IOException("Connection closed");
    try {     
      synchronized (outputLock) {       
        doSend(outputCounter, inputCounter, request);
        addPendingMessage(new TcpMessage(
          outputCounter, request));
View Full Code Here

  public AbstractJmsReply receive() throws Exception {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG,
                 "ReliableTcpConnection.receive()");
    if (getStatus() != CONNECT)
      throw new IOException("Connection closed");

    while (true) {
      try {
        long messageId;
        long ackId;
View Full Code Here

  public void send(AbstractJmsMessage request)
  throws Exception {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log( BasicLevel.DEBUG,
                  "ReliableTcpClient[" + identity + ',' + key + "].send(" + request + ')');
    if (status == CLOSE) throw new IOException("Closed connection");
    if (status != CONNECT) {
      if (reconnect) waitForReconnection();
      else throw new IOException("Closed connection");
    }
    while (true) {
      try {
        connection.send(request);
        return;
View Full Code Here

    if (logmon.isLoggable(BasicLevel.DEBUG))
      logmon.log(BasicLevel.DEBUG, getName() + ", starting");

    try {
      if (isRunning())
        throw new IOException("Consumer already running.");

      for (int i=0; i<sessions.length; i++) {
        if (sessions[i] != null) {
          sessions[i].init();
View Full Code Here

    byte[] magicRead = new byte[8];
    readFully(in, magicRead);
    for (int i = 0; i < 8; i++) {
      if (magicRead[i] != magic[i]) {
        throw new IOException("Bad magic number:" + new String(magicRead, 0, 7) + magicRead[7]
            + " instead of " + new String(magic, 0, 7) + magic[7]);
      }
    }
    if (logmon.isLoggable(BasicLevel.DEBUG))
      logmon.log(BasicLevel.DEBUG, getName() + ", readMagic from #" + boot.sid + " -> "
View Full Code Here

  final int readAck(InputStream in)throws IOException {
    byte[] magicRead = new byte[8];
    readFully(in, magicRead);
    for (int i = 0; i < 8; i++) {
      if (magicRead[i] != magic[i]) {
        throw new IOException("Bad magic number:" + new String(magicRead, 0, 7) + magicRead[7]
            + " instead of " + new String(magic, 0, 7) + magic[7]);
      }
    }
    if (logmon.isLoggable(BasicLevel.DEBUG))
      logmon.log(BasicLevel.DEBUG, getName() + ", readMagicAck -> "
View Full Code Here

      Properties props = new Properties();
      props.put("user", "user1");
      props.put("password", "user1");
      conn = DriverManager.getConnection(connurl + new File(dir, "JoramDB").getPath() + ";create=true", props);
    } catch (IllegalAccessException exc) {
      throw new IOException(exc.getMessage());
    } catch (ClassNotFoundException exc) {
      throw new IOException(exc.getMessage());
    } catch (InstantiationException exc) {
      throw new IOException(exc.getMessage());
    } catch (SQLException sqle) {
      throw new IOException(sqle.getMessage());
    }

    try {
      // Creating a statement lets us issue commands against the connection.
      Statement s = conn.createStatement();
View Full Code Here

  public void close() throws IOException {
    outStr.close();
    try {
      client.disconnect(true);
    } catch (Throwable t) {
      throw new IOException(t.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of java.io.IOException

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.