Package org.pentaho.reporting.libraries.resourceloader

Examples of org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException


    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

      }
      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

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

    {
      throw new ResourceCreationException("Failed to parse the stylesheet.");
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to load the stylesheet.");
    }
  }
View Full Code Here

    {
      throw new ResourceCreationException("Failed to parse the stylesheet.");
    }
    catch (IOException e)
    {
      throw new ResourceLoadingException("Failed to load the stylesheet.");
    }
  }
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

        {
            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

TOP

Related Classes of org.pentaho.reporting.libraries.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.