Package org.jfree.resourceloader

Examples of org.jfree.resourceloader.ResourceLoadingException


    {
      return inputRepository.createInputStream(resourceIdentifer);
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException
              ("Failed to create input stream for " + resourceIdentifer, e);
    }
  }
View Full Code Here


    public ResourceData load(final ResourceKey key)
            throws ResourceLoadingException
    {
        if (!isSupportedKey(key))
        {
            throw new ResourceLoadingException("None of my keys.");
        }

        return new InputRepositoryResourceData(key, inputRepository);
    }
View Full Code Here

        oin.close();
      }
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to load resource", e);
    }
    catch (ClassNotFoundException e)
    {
      throw new ResourceCreationException
              ("Missing class definition: Failed to create encoding.");
View Full Code Here

  public ResourceData load(final ResourceKey key) throws ResourceLoadingException
  {
    if (isSupportedKey(key) == false)
    {
      throw new ResourceLoadingException
          ("Key format is not recognized.");
    }
    return new URLResourceData(key);
  }
View Full Code Here

      }
      return new SimpleResource (data.getKey(), properties, data.getVersion(manager));
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to load the properties file.",e);
    }
  }
View Full Code Here

      c.setAllowUserInteraction(false);
      return c.getInputStream();
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to open URL connection", e);
    }
  }
View Full Code Here

    try
    {
      final InputStream in = getResourceAsStream(caller);
      if (in == null)
      {
        throw new ResourceLoadingException("Unable to read Stream: No input stream: " + getKey());
      }
      try
      {
        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
        IOUtils.getInstance().copyStreams(in, bout);
        return bout.toByteArray();
      }
      finally
      {
        in.close();
      }
    }
    catch (ResourceLoadingException rle)
    {
      throw rle;
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Unable to read Stream: ", e);
    }
  }
View Full Code Here

      }

      final InputStream in = getResourceAsStream(caller);
      if (in == null)
      {
        throw new ResourceLoadingException("Unable to read Stream: No input stream: " + getKey());
      }
      try
      {
        if (offset > 0)
        {
          long toBeSkipped = offset;
          long skipResult = in.skip(toBeSkipped);
          toBeSkipped -= skipResult;
          while (skipResult > 0 && toBeSkipped > 0)
          {
            skipResult = in.skip(offset);
            toBeSkipped -= skipResult;
          }

          if (toBeSkipped > 0)
          {
            // failed to read up to the offset ..
            throw new ResourceLoadingException
                ("Unable to read Stream: Skipping content failed: " + getKey());
          }
        }

        int bytesToRead = length;
        // the input stream does not supply accurate available() data
        // the zip entry does not know the size of the data
        int bytesRead = in.read(target, length - bytesToRead, bytesToRead);
        while (bytesRead > -1 && bytesToRead > 0)
        {
          bytesToRead -= bytesRead;
          bytesRead = in.read(target, length - bytesToRead, bytesToRead);
        }
        return length - bytesRead;
      }
      finally
      {
        in.close();
      }
    }
    catch (ResourceLoadingException rle)
    {
      throw rle;
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Unable to read Stream: ", e);
    }
  }
View Full Code Here

  {
    final InputStream stream = ObjectUtilities.getResourceAsStream
        (resourcePath, ClassloaderResourceData.class);
    if (stream == null)
    {
      throw new ResourceLoadingException("Resource is not available: " + resourcePath);
    }
    return stream;
  }
View Full Code Here

      throw new NullPointerException();
    }
    final File file = (File) key.getIdentifier();
    if (file.isFile() == false)
    {
      throw new ResourceLoadingException
              ("File-handle given does not point to a regular file.");
    }
    if (file.canRead() == false)
    {
      throw new ResourceLoadingException
              ("File '" + file + "' is not readable.");
    }
    this.key = key;
    this.file = file;
  }
View Full Code Here

TOP

Related Classes of org.jfree.resourceloader.ResourceLoadingException

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.