Package java.io

Examples of java.io.IOException


            m_byteBuffer.setOffset(m_emptyOffset);
            if (readHeader(m_endOffset - m_emptyOffset)) {
                return true;
            } else {
                s_logger.error("Missing final DIME record chunk");
                throw new IOException("Missing final DIME record chunk");
            }
        } else {
            return false;
        }
    }
View Full Code Here


            // read first chunk of next part
            if (readHeader(0)) {
                return true;
            } else {
                s_logger.error("End of input before end of message");
                throw new IOException("End of input before end of message");
            }
           
        } else if (s_logger.isDebugEnabled()) {
            s_logger.debug("End of message reached");
        }
View Full Code Here

                            MediaType partMediaType = new MediaType(partTypeText);
                            if (CodecDirectory.hasCodecFor(partMediaType)) {
                                mediaType = partMediaType;
                            }
                        } catch (ParseException e) {
                            throw new IOException("Unable to parse media type '" + partTypeText + "'");
                        }
                    }
                    if (mediaType == null) {
                        mediaType = CodecDirectory.TEXT_XML_MEDIA_TYPE;
                    }
                    m_reader = m_codecCache.getCodec(mediaType).getReader(m_dimeInput, null, m_endpoint, false);
                    m_reader.init();
                    m_initialized = true;
                } else {
                    throw new IOException("No data present");
                }
            }
        }
View Full Code Here

        String key = CodecDirectory.getCodecKey(mediaType);
        XmlCodec codec = (XmlCodec)m_codecMap.get(key);
        if (codec == null) {
            codec = CodecDirectory.getCodec(mediaType);
            if (codec == null) {
                throw new IOException("Unknown media type '" + mediaType + "'");
            }
            m_codecMap.put(key, codec);
        }
        return codec;
    }
View Full Code Here

     */
    public XmlCodec getCodec(MediaType mediaType) throws IOException, WsException {
        String key = CodecDirectory.getCodecKey(mediaType);
        InstancePool pool = (InstancePool)m_codecMap.get(key);
        if (pool == null) {
            throw new IOException("Unsupported media type '" + mediaType + "'");
        } else {
            return (XmlCodec)pool.getInstance();
        }
    }
View Full Code Here

            MediaType contentType;
            if (ctype != null) {
                try {
                    contentType = new MediaType(ctype);
                } catch (ParseException e) {
                    throw new IOException("Unable to parse content-type '" + ctype + "'");
                }
                if (CodecDirectory.hasCodecFor(contentType)) {
                    mediaType = contentType;
                }
            }
View Full Code Here

          directAccess = metaData.isDirectAccess();
          cacheable = metaData.isCacheable();
          description = metaData.getDescription();
          category = metaData.getCategory();
        } catch (CoreException e) {
          IOException ioe = new IOException("Unable to read metadata file of tml resource '" + _tmlFile.getLocation() + "'.");
          ioe.setStackTrace(e.getStackTrace());
          throw ioe;
        } finally {
          if (reader != null) {
            try {
              reader.close();
View Full Code Here

          if (_metadataFolder.members().length == 0) {
              _metadataFolder.delete(false, new NullProgressMonitor());
          }
          reload();
        } catch (CoreException e) {
          IOException ioe = new IOException("Unable to delete meta data file '" + _metadataFile.getLocation() + "'.");
          ioe.setStackTrace(e.getStackTrace());
          throw ioe;
       
      }   
    } else {     
      TMLMetadataInfo metaData = new TMLMetadataInfo();
      metaData.setDirectAccess(directAccess);
      metaData.setDescription(description);
      metaData.setCacheable(cacheable);
      metaData.setCategory(category);
      XStream xstream = new XStream(new DomDriver());
      xstream.alias(TMLMetadataInfo.XSTREAM_ALIAS, TMLMetadataInfo.class);
      Writer writer = null;
      try {
        if (!_metadataFolder.exists()) {
          _metadataFolder.create(true, true, new NullProgressMonitor())
          _metadataFile = _metadataFolder.getFile(_tmlFile.getName().substring(0, _tmlFile.getName().length() - _tmlFile.getFileExtension().length()) + "metadata.xml");
        }

        writer = new OutputStreamWriter(new FileOutputStream(_metadataFile.getLocation().toFile()), _fileEncoding);
        xstream.toXML(metaData, writer);
       
      } catch (CoreException e) {
        IOException ioe = new IOException("Unable to save metadata file '" + _metadataFile.getLocation() + "'.");
        ioe.setStackTrace(e.getStackTrace());
        throw ioe;
      } finally {
        if (writer != null) {
          try {
            writer.close();
View Full Code Here

                            MediaType partMediaType = new MediaType(partTypeText);
                            if (CodecDirectory.hasCodecFor(partMediaType)) {
                                mediaType = partMediaType;
                            }
                        } catch (ParseException e) {
                            throw new IOException("Unable to parse media type '" + partTypeText + "'");
                        }
                    }
                    if (mediaType == null) {
                        mediaType = CodecDirectory.TEXT_XML_MEDIA_TYPE;
                    }
View Full Code Here

                    m_reader = s_readerFactory.createReader(m_inWrapper.getReader(), name, true);
                } else {
                    m_reader = s_readerFactory.recycleReader(m_reader, m_inWrapper.getReader(), name);
                }
            } catch (JiBXException e) {
                throw new IOException("Error creating reader: " + e.getMessage());
            }
            return m_reader;
        }
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.