Package java.io

Examples of java.io.IOException


      String str = msg + ", read " + m_Tokenizer.toString();
      if (m_Lines > 0) {
  int line = Integer.parseInt(str.replaceAll(".* line ", ""));
  str = str.replaceAll(" line .*", " line " + (m_Lines + line - 1));
      }
      throw new IOException(str);
    }
View Full Code Here


              ArffReader arff = new ArffReader(new StringReader(m_Tokenizer.sval), m_Data.attribute(m_IndicesBuffer[numValues]).relation(), 0);
              Instances data = arff.getData();
              m_ValueBuffer[numValues] = m_Data.attribute(m_IndicesBuffer[numValues]).addRelation(data);
            }
            catch (Exception e) {
              throw new IOException(e.toString() + " of line " + getLineNo());
            }
            break;
          default:
            errorMessage("unknown attribute type in column " + m_IndicesBuffer[numValues]);
    }
View Full Code Here

              ArffReader arff = new ArffReader(new StringReader(m_Tokenizer.sval), m_Data.attribute(i).relation(), 0);
              Instances data = arff.getData();
              instance[i] = m_Data.attribute(i).addRelation(data);
            }
            catch (Exception e) {
              throw new IOException(e.toString() + " of line " + getLineNo());
            }
            break;
          default:
            errorMessage("unknown attribute type in column " + i);
    }
View Full Code Here

   * @exception IOException if an error occurs
   */
  @Override
  public Instances getStructure() throws IOException {
    if ((m_sourceFile == null) && (m_sourceReader == null)) {
      throw new IOException("No source has been specified");
    }

    if (m_structure == null) {
      try {
  m_st = new StreamTokenizer(m_sourceReader);
View Full Code Here

   * @exception IOException if there is no source or parsing fails
   */
  @Override
  public Instances getDataSet() throws IOException {
    if ((m_sourceFile == null) && (m_sourceReader == null)) {
      throw new IOException("No source has been specified");
    }
   
    if (m_structure == null) {
      getStructure();
    }
View Full Code Here

   */
  public final void deploy(AgentId reply) throws IOException {
    if ((id == null) || id.isNullId()) {
      logmon.log(BasicLevel.ERROR,
                 AgentServer.getName() + ", can't deploy " + this.toString() + ", id is null");
      throw new IOException("Can't deploy agent, id is null");
    }
    if (deployed) {
      logmon.log(BasicLevel.ERROR,
                 AgentServer.getName() + ", can't deploy " + this.toString() + ", already deployed");
      throw new IOException("Can't deploy agent, already deployed");
    }

    //  If we use sendTo agent's method the from field is the agent id, and
    // on reception the from node (from.to) can be false.
    Channel.sendTo(AgentId.factoryId(id.getTo()),
View Full Code Here

            } else {
                try {
                        _schema = WGSchemaDefinition.read(getSchemaDefinitionFile().getContents());
                    }
                    catch (Exception e) {
                        IOException ioe = new IOException("Unable to read schema definition '" + getSchemaDefinitionFile().getLocation() + "'.");
                        ioe.setStackTrace(e.getStackTrace());
                        throw ioe;
                    }
            }
        } catch (CoreException e) {
            IOException ioe = new IOException("Unable to read schema definition '" + getSchemaDefinitionFile().getLocation() + "'.");
                ioe.setStackTrace(e.getStackTrace());
                throw ioe;
        } finally {
            if (schemaIn != null) {
                schemaIn.close();
            }
View Full Code Here

        if (getSchemaDefinitionFile() != null && getSchemaDefinitionFile().exists()) {
            try {
                _schema = WGSchemaDefinition.read(getSchemaDefinitionFile().getContents());
            }
            catch (Exception e) {
                IOException ioe = new IOException("Unable to read schema definition '" + getSchemaDefinitionFile().getLocation() + "'.");
                ioe.setStackTrace(e.getStackTrace());
                throw ioe;
            }
        } else {
            _schema = null;
        }
View Full Code Here

  public void saveChanges() throws IOException {
    WGADesignStructureHelper helper = new WGADesignStructureHelper(_designContainer);
    try {
      helper.makeDesignConfigWriteable();
    } catch (CoreException e) {
      IOException ioe = new IOException("Unable to save design config changes. Configuration is readonly.");
      ioe.setStackTrace(e.getStackTrace());
      throw ioe;
    }
   
    super.saveChanges();
   
    if (_schema != null) {
        OutputStream out = new FileOutputStream(getSchemaDefinitionFile().getLocation().toFile());
        try {
            _schema.write(out);
        } catch (Exception e) {
            IOException ioe = new IOException("Unable to save design config changes.");
              ioe.setStackTrace(e.getStackTrace());
              throw ioe;
        } finally {
            out.close();
        }
    }
View Full Code Here

            m_chunked = false;
            byte byt = buffer[offset];
            int version = (byt & DimeCommon.VERSION_MASK);
            if (version != DimeCommon.VERSION_VALUE) {
                s_logger.error("Invalid DIME version: " + version);
                throw new IOException("Invalid DIME version");
            }
            if ((byt & DimeCommon.MESSAGE_BEGIN_FLAG) != 0) {
                if (m_messageState == DimeCommon.MESSAGE_START) {
                    m_messageState = DimeCommon.MESSAGE_MIDDLE;
                } else {
                    s_logger.error("Unexpected MB (Message Begin) DIME record");
                    throw new IOException("Unexpected MB (Message Begin) DIME record");
                }
            } else if (m_messageState == DimeCommon.MESSAGE_START) {
                s_logger.error("Missing expected MB (Message Begin) DIME record");
                throw new IOException("Missing expected MB (Message Begin) DIME record");
            }
            if ((byt & DimeCommon.CHUNK_FLAG) != 0) {
                m_chunked = true;
                if (m_messageState == DimeCommon.MESSAGE_MIDDLE) {
                    m_messageState = DimeCommon.MESSAGE_CHUNK;
                } else if (m_messageState == DimeCommon.MESSAGE_CHUNK) {
                    first = false;
                } else {
                    s_logger.error("Invalid CF (Chunk Flag) DIME record");
                    throw new IOException("Invalid CF (Chunk Flag) DIME record");
                }
            } else if (m_messageState == DimeCommon.MESSAGE_CHUNK) {
                m_messageState = DimeCommon.MESSAGE_MIDDLE;
                first = false;
            }
            if ((byt & DimeCommon.MESSAGE_END_FLAG) != 0) {
                if (m_messageState == DimeCommon.MESSAGE_MIDDLE) {
                    m_messageState = DimeCommon.MESSAGE_END;
                } else {
                    s_logger.error("Unexpected ME (Message End) DIME record");
                    throw new IOException("Unexpected ME (Message End) DIME record");
                }
            }
           
            // validate type code and fixed part of second byte
            byt = buffer[offset + 1];
            if (!first) {
                if (byt != 0) {
                    s_logger.error("DIME chunk record read with non-zero type or reserved field");
                    throw new IOException("DIME chunk record read with non-zero type or reserved field");
                }
            } else {
                m_partTypeCode = byt & DimeCommon.TYPE_FORMAT_MASK;
                if ((byt & ~DimeCommon.TYPE_FORMAT_MASK) != 0) {
                    s_logger.error("DIME record read with non-zero reserved field");
                    throw new IOException("DIME record read with non-zero reserved field");
                }
            }
           
            // get the variable-length field sizes
            int optlength = buildShort(offset + 2);
            int idlength = buildShort(offset + 4);
            int typelength = buildShort(offset + 6);
            int length = (buildShort(offset + 8) << 16) + buildShort(offset + 10);
            if (first) {
               
                // read the actual variable-length fields
                int optpadded = (optlength + 3) & -4;
                int idpadded = (idlength + 3) & -4;
                int typepadded = (typelength + 3) & -4;
                m_byteBuffer.require(length + optpadded + idpadded + typepadded);
                buffer = m_byteBuffer.getBuffer();
                start = m_byteBuffer.getOffset();
                offset = start + retain + m_paddingNeeded + DimeCommon.HEADER_SIZE + optpadded;
                if (idlength > 0) {
                    m_partIdentifier = new String(buffer, offset, idlength, "UTF-8");
                    offset += idpadded;
                } else {
                    m_partIdentifier = null;
                }
                if (typelength > 0) {
                    m_partTypeText = new String(buffer, offset, typelength, "UTF-8");
                    offset += typepadded;
                } else {
                    m_partTypeText = null;
                }
               
            } else {
                if (optlength != 0 || idlength != 0 || typelength != 0) {
                    s_logger.error("DIME chunk record read with non-zero field length(s)");
                    throw new IOException("DIME chunk record read with non-zero field length(s)");
                }
                offset += DimeCommon.HEADER_SIZE;
            }
           
            // move retained data up in buffer to overwrite header
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.