Examples of encode()


Examples of org.apache.flex.forks.batik.ext.awt.image.codec.PNGImageEncoder.encode()

    public void encodeImage(BufferedImage buf, File imageFile)
        throws SVGGraphics2DIOException {
        try {
            OutputStream os = new FileOutputStream(imageFile);
            ImageEncoder encoder = new PNGImageEncoder(os, null);
            encoder.encode(buf);
            os.close();
        } catch (IOException e) {
            throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName());
        }
    }

Examples of org.apache.flex.forks.batik.ext.awt.image.codec.tiff.TIFFImageEncoder.encode()

                off[i] = i;
            SampleModel sm = new PixelInterleavedSampleModel
                (DataBuffer.TYPE_BYTE, w, h, bands, w*bands, off);
           
            RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm);
            tiffEncoder.encode(rimg);
        } catch (IOException ex) {
            throw new TranscoderException(ex);
        }
    }

Examples of org.apache.geronimo.crypto.encoders.HexTranslator.encode()

        byte[] data = md.digest(password.getBytes());
        if(encoding == null || "hex".equalsIgnoreCase(encoding)) {
            // Convert bytes to hex digits
            byte[] hexData = new byte[data.length * 2];
            HexTranslator ht = new HexTranslator();
            ht.encode(data, 0, data.length, hexData, 0);
            return new String(hexData);
        } else if("base64".equalsIgnoreCase(encoding)) {
            return new String(Base64.encode(data));
        }
        return "";

Examples of org.apache.geronimo.mail.util.RFC2231Encoder.encode()

                // the string format is charset''data
                out.write(charset.getBytes());
                out.write('\'');
                out.write('\'');
                encoder.encode(valueBytes, 0, valueBytes.length, out);

                // default in case there is an exception
                _parameters.put(name, new ParameterValue(name, value, new String(out.toByteArray())));
                return;

Examples of org.apache.geronimo.util.encoders.HexTranslator.encode()

        MessageDigest md = MessageDigest.getInstance(algorithm);
        byte[] data = md.digest(password.getBytes());
        // Convert bytes to hex digits
        byte[] hexData = new byte[data.length * 2];
        HexTranslator ht = new HexTranslator();
        ht.encode(data, 0, data.length, hexData, 0);
        return new String(hexData);
    }

    public static final GBeanInfo GBEAN_INFO;

Examples of org.apache.harmony.pack200.BHSDCodec.encode()

                // range of the codec
                long largest = codec.largest();
                long smallest = codec.isSigned() ? codec.smallest() : 0;
                long difference = (largest - smallest) / 4;
                for (long j = smallest; j <= largest; j += difference) {
                    byte[] encoded = codec.encode(j, 0);
                    long decoded = 0;
                    try {
                        decoded = codec.decode(
                                new ByteArrayInputStream(encoded), 0);
                    } catch (EOFException e) {

Examples of org.apache.harmony.pack200.Codec.encode()

    }

    public void testDeltaEncodings() throws IOException, Pack200Exception {
        Codec c = Codec.UDELTA5;
        int[] sequence = new int[] {0, 2, 4, 2, 2, 4};
        byte[] encoded = c.encode(sequence);
        int[] decoded = c.decodeInts(6, new ByteArrayInputStream(encoded));
        for (int i = 0; i < decoded.length; i++) {
            assertEquals(sequence[i], decoded[i]);
        }
    }

Examples of org.apache.harmony.pack200.PopulationCodec.encode()

        byte[] bytes1 = Codec.DELTA5
                .encode(new int[] { 11, 12, 33, 4000, -555 });
        // rest of band to be encoded with a PopulationCodec
        PopulationCodec popCodec = new PopulationCodec(Codec.UNSIGNED5,
                Codec.BYTE1, Codec.UNSIGNED5);
        byte[] bytes2 = popCodec.encode(new int[] { 10, 20 }, new int[] { 0, 1,
                2, 1, 0, 2, 2, 2, 1, 1, 0, 2, 0, 1, 1, 0, 0 }, new int[] { 5,
                3, 999, 789, 355, 12345 });
        byte[] bandEncoded = new byte[bytes1.length + bytes2.length];
        System.arraycopy(bytes1, 0, bandEncoded, 0, bytes1.length);
        System.arraycopy(bytes2, 0, bandEncoded, bytes1.length, bytes2.length);

Examples of org.apache.harmony.security.asn1.ASN1Implicit.encode()

        // decode primitive
        assertTrue(Arrays.equals(array, (byte[]) type2
                .decode(primitiveEncoding)));

        // encode primitive
        assertTrue(Arrays.equals(primitiveEncoding, type2.encode(array)));

        // decode constructed
        try {
            type2.decode(constructedEncoding);
            fail("No expected ASN1Exception");

Examples of org.apache.harmony.security.asn1.ASN1Sequence.encode()

            }
        };

        byte[] expectedArray = new byte[] { 0x30, 0x00 };

        byte[] encoded = s.encode(new Object[] { Boolean.TRUE });
        assertTrue("Encoded boolean:", Arrays.equals(expectedArray, encoded));

        //
        // Integer as default
        //
TOP
Copyright © 2018 www.massapi.com. 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.