You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractRendererMaker.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright 2005 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.render;
  18. import org.apache.fop.apps.FOUserAgent;
  19. /**
  20. * Base class for factory classes which instantiate Renderers and provide information
  21. * about them.
  22. */
  23. public abstract class AbstractRendererMaker {
  24. /**
  25. * Instantiates a new renderer.
  26. * @param ua the user agent
  27. * @return the newly instantiated renderer
  28. */
  29. public abstract Renderer makeRenderer(FOUserAgent ua);
  30. /**
  31. * @return Indicates whether this renderer requires an OutputStream to work with.
  32. */
  33. public abstract boolean needsOutputStream();
  34. /**
  35. * @return an array of MIME types the renderer supports.
  36. */
  37. public abstract String[] getSupportedMimeTypes();
  38. /**
  39. * Indicates whether a specific MIME type is supported by this renderer.
  40. * @param mimeType the MIME type (ex. "application/pdf")
  41. * @return true if the MIME type is supported
  42. */
  43. public boolean isMimeTypeSupported(String mimeType) {
  44. String[] mimes = getSupportedMimeTypes();
  45. for (int i = 0; i < mimes.length; i++) {
  46. if (mimes[i].equals(mimeType)) {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. }