CVS: jfor/src/org/jfor/jfor/tools/jpeg EncoderWrapper.java,NONE,1.1 IJpegEncoder.java,NONE,1.1 JpegEncoderFactory.java,NONE,1.1 Encoder.java,1.4,1.5 JPEGException.java,1.3,1.4

Bertrand Delacretaz <[email protected]> Thu, 17 Jul 2003 07:07:33 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/tools/jpeg
In directory sc8-pr-cvs1:/tmp/cvs-serv11391/src/org/jfor/jfor/tools/jpeg

Modified Files:
	Encoder.java JPEGException.java 
Added Files:
	EncoderWrapper.java IJpegEncoder.java JpegEncoderFactory.java 
Log Message:
V0.7.2.dev-h - jpeg encoder package refactoring

--- NEW FILE: EncoderWrapper.java ---
package org.jfor.jfor.tools.jpeg;

import java.io.ByteArrayOutputStream;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * ====================================================================
 * jfor Apache-Style Software License.
 * Copyright (c) 2002 by the jfor project. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in
 * the documentation and/or other materials provided with the
 * distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 * if any, must include the following acknowledgment:
 * "This product includes software developed
 * by the jfor project (http://www.jfor.org)."
 * Alternately, this acknowledgment may appear in the software itself,
 * if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The name "jfor" must not be used to endorse
 * or promote products derived from this software without prior written
 * permission.  For written permission, please contact [email protected].
 *
 * 5. Products derived from this software may not be called "jfor",
 * nor may "jfor" appear in their name, without prior written
 * permission of [email protected].
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE JFOR PROJECT OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 * Contributor(s):
-----------------------------------------------------------------------------*/

/** Adapts our JPEG Encoder to IJpegEncoder
 *  @author [email protected]
 */
 
// -------------------------------------------------------------------------------------
// $Id: EncoderWrapper.java,v 1.1 2003/07/17 14:07:31 bdelacretaz Exp $
// $Log: EncoderWrapper.java,v $
// Revision 1.1  2003/07/17 14:07:31  bdelacretaz
// V0.7.2.dev-h - jpeg encoder package refactoring
//
// -------------------------------------------------------------------------------------

class EncoderWrapper implements IJpegEncoder {
    /** encode the given data in JPEG */
    public byte[] encodeJPEG(int quality, byte[] data) throws JPEGException {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        final Encoder e = new Encoder(quality,out);
        e.encodeJPEG(data);
        return out.toByteArray();
    }
}

--- NEW FILE: IJpegEncoder.java ---
package org.jfor.jfor.tools.jpeg;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * ====================================================================
 * jfor Apache-Style Software License.
 * Copyright (c) 2002 by the jfor project. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in
 * the documentation and/or other materials provided with the
 * distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 * if any, must include the following acknowledgment:
 * "This product includes software developed
 * by the jfor project (http://www.jfor.org)."
 * Alternately, this acknowledgment may appear in the software itself,
 * if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The name "jfor" must not be used to endorse
 * or promote products derived from this software without prior written
 * permission.  For written permission, please contact [email protected].
 *
 * 5. Products derived from this software may not be called "jfor",
 * nor may "jfor" appear in their name, without prior written
 * permission of [email protected].
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE JFOR PROJECT OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 * Contributor(s):
-----------------------------------------------------------------------------*/

/** Interface to a JPEG image encoder, declares just what jfor uses
 *  @author [email protected]
 */
 
// -------------------------------------------------------------------------------------
// $Id: IJpegEncoder.java,v 1.1 2003/07/17 14:07:31 bdelacretaz Exp $
// $Log: IJpegEncoder.java,v $
// Revision 1.1  2003/07/17 14:07:31  bdelacretaz
// V0.7.2.dev-h - jpeg encoder package refactoring
//
// -------------------------------------------------------------------------------------

public interface IJpegEncoder {
   /** Encode image data in JPEG
    *  @param data Byte array with data of a gif or tif image
    *  @exception JPEGException On error
    */
   public byte [] encodeJPEG (int quality,byte[] data) throws JPEGException;

}

--- NEW FILE: JpegEncoderFactory.java ---
package org.jfor.jfor.tools.jpeg;

import java.io.OutputStream;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * ====================================================================
 * jfor Apache-Style Software License.
 * Copyright (c) 2002 by the jfor project. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in
 * the documentation and/or other materials provided with the
 * distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 * if any, must include the following acknowledgment:
 * "This product includes software developed
 * by the jfor project (http://www.jfor.org)."
 * Alternately, this acknowledgment may appear in the software itself,
 * if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The name "jfor" must not be used to endorse
 * or promote products derived from this software without prior written
 * permission.  For written permission, please contact [email protected].
 *
 * 5. Products derived from this software may not be called "jfor",
 * nor may "jfor" appear in their name, without prior written
 * permission of [email protected].
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE JFOR PROJECT OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 * Contributor(s):
 * @author Andreas Putz <[email protected]>
-----------------------------------------------------------------------------*/

/** Provides IJpegEncoder objects
 *  @author [email protected]
 */
 
// -------------------------------------------------------------------------------------
// $Id: JpegEncoderFactory.java,v 1.1 2003/07/17 14:07:31 bdelacretaz Exp $
// $Log: JpegEncoderFactory.java,v $
// Revision 1.1  2003/07/17 14:07:31  bdelacretaz
// V0.7.2.dev-h - jpeg encoder package refactoring
//
// -------------------------------------------------------------------------------------

public class JpegEncoderFactory {
    /** @return a suitable IJpegEncoder */
    public IJpegEncoder getEncoder() {
        return new EncoderWrapper();
    }
}

Index: Encoder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/tools/jpeg/Encoder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Encoder.java	12 Jul 2002 08:08:31 -0000	1.4
--- Encoder.java	17 Jul 2003 14:07:31 -0000	1.5
***************
*** 76,80 ****
   * an gif or tif image.
   */
! public class Encoder extends Component
  {
  
--- 76,81 ----
   * an gif or tif image.
   */
! 
! class Encoder extends Component
  {
  
***************
*** 113,117 ****
  	 * @param out Outputstream
  	 */
! 	public Encoder (int quality, OutputStream out)
  	{
  		outStream = outStream = new BufferedOutputStream (out);
--- 114,118 ----
  	 * @param out Outputstream
  	 */
!     Encoder (int quality, OutputStream out)
  	{
  		outStream = outStream = new BufferedOutputStream (out);

Index: JPEGException.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/tools/jpeg/JPEGException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** JPEGException.java	12 Jul 2002 08:08:31 -0000	1.3
--- JPEGException.java	17 Jul 2003 14:07:31 -0000	1.4
***************
*** 67,70 ****
--- 67,73 ----
  // $Id$
  // $Log$
+ // Revision 1.4  2003/07/17 14:07:31  bdelacretaz
+ // V0.7.2.dev-h - jpeg encoder package refactoring
+ //
  // Revision 1.3  2002/07/12 08:08:31  bdelacretaz
  // License changed to jfor Apache-style license
***************
*** 102,106 ****
  	 * @param message Error message
  	 */
! 	public JPEGException (String message)
  	{
  		super (message);
--- 105,109 ----
  	 * @param message Error message
  	 */
! 	JPEGException (String message)
  	{
  		super (message);



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0