Package com.ibm.as400.access

Examples of com.ibm.as400.access.CharConverter


        // save record contents to the byte array
        inData = record.getContents();

        // convert this content to the String
        mConverter = new CharConverter(mEncoding);
        retBuffer.append(mConverter.byteArrayToString(inData));

        while ((record = mOriginFile.readNext()) != null)
        {
          // read records while they exist
View Full Code Here


    AS400 as400 = AS400Connection.getInstance(as400name).getSystem();
    String encoding = AS400FileBase.getEncoding(as400, system);

    try
    {
      conv = new CharConverter(encoding);
    }
    catch (UnsupportedEncodingException e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_PROTOCOL,
View Full Code Here

     *
     * @param timeout time to wait when reading from data queue. A value of -1
     *            indicates a blocking read.
     */
    public Exchange receive(long timeout) {
        DataQueue queue = endpoint.getDataQueue();
        try {
            DataQueueEntry entry;
            if (timeout >= 0) {
                entry = queue.read((int)timeout);
            } else {
                entry = queue.read();
            }
            Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
            if (entry != null) {
                if (endpoint.getFormat() == Format.binary) {
                    exchange.getIn().setBody(entry.getData());
View Full Code Here

     * data will be sent as a <code>byte[]</code>. If the endpoint's format is
     * set to {@link Format#text}, the data queue entry's data will be sent as a
     * <code>String</code>.
     */
    public void process(Exchange exchange) throws Exception {
        DataQueue queue = endpoint.getDataQueue();
        if (endpoint.getFormat() == Format.binary) {
            queue.write(exchange.getIn().getBody(byte[].class));
        } else {
            queue.write(exchange.getIn().getBody(String.class));
        }
    }
View Full Code Here

        return system;
    }

    protected DataQueue getDataQueue() {
        if (dataqueue == null) {
            dataqueue = new DataQueue(system, objectPath);
        }
        return dataqueue;
    }
View Full Code Here

     *
     * @param timeout time to wait when reading from data queue. A value of -1
     *            indicates a blocking read.
     */
    public Exchange receive(long timeout) {
        DataQueue queue = endpoint.getDataQueue();
        try {
            DataQueueEntry entry;
            if (timeout >= 0) {
                int seconds = (int)timeout / 1000;
                log.trace("Reading from data queue: {} with {} seconds timeout", queue.getName(), seconds);
                entry = queue.read(seconds);
            } else {
                log.trace("Reading from data queue: {} with no timeout", queue.getName());
                entry = queue.read(-1);
            }

            Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
            if (entry != null) {
                if (endpoint.getFormat() == Format.binary) {
                    exchange.getIn().setBody(entry.getData());
                } else {
                    exchange.getIn().setBody(entry.getString());
                }
                return exchange;
            }
        } catch (AS400SecurityException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (ErrorCompletingRequestException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (IOException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (IllegalObjectTypeException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (InterruptedException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (ObjectDoesNotExistException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        }
        return null;
    }
View Full Code Here

     *
     * @param timeout time to wait when reading from data queue. A value of -1
     *            indicates a blocking read.
     */
    public Exchange receive(long timeout) {
        DataQueue queue = endpoint.getDataQueue();
        try {
            DataQueueEntry entry;
            if (timeout >= 0) {
                int seconds = (int)timeout / 1000;
                if (log.isTraceEnabled()) {
                    log.trace("Reading from data queue: " + queue.getName() + " with " + seconds + " seconds timeout");
                }
                entry = queue.read(seconds);
            } else {
                if (log.isTraceEnabled()) {
                    log.trace("Reading from data queue: " + queue.getName() + " with no timeout");
                }
                entry = queue.read(-1);
            }

            Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
            if (entry != null) {
                if (endpoint.getFormat() == Format.binary) {
                    exchange.getIn().setBody(entry.getData());
                } else {
                    exchange.getIn().setBody(entry.getString());
                }
                return exchange;
            }
        } catch (AS400SecurityException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (ErrorCompletingRequestException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (IOException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (IllegalObjectTypeException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (InterruptedException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        } catch (ObjectDoesNotExistException e) {
            throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
        }
        return null;
    }
View Full Code Here

     *
     * @param timeout time to wait when reading from data queue. A value of -1
     *            indicates a blocking read.
     */
    public Exchange receive(long timeout) {
        DataQueue queue = endpoint.getDataQueue();
        try {
            DataQueueEntry entry;
            if (timeout >= 0) {
                entry = queue.read((int)timeout);
            } else {
                entry = queue.read();
            }
            Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
            if (entry != null) {
                if (endpoint.getFormat() == Format.binary) {
                    exchange.getIn().setBody(entry.getData());
View Full Code Here

     * data will be sent as a <code>byte[]</code>. If the endpoint's format is
     * set to {@link Format#text}, the data queue entry's data will be sent as a
     * <code>String</code>.
     */
    public void process(Exchange exchange) throws Exception {
        DataQueue queue = endpoint.getDataQueue();
        if (endpoint.getFormat() == Format.binary) {
            queue.write(exchange.getIn().getBody(byte[].class));
        } else {
            queue.write(exchange.getIn().getBody(String.class));
        }
    }
View Full Code Here

        return system;
    }

    protected DataQueue getDataQueue() {
        if (dataqueue == null) {
            dataqueue = new DataQueue(system, objectPath);
        }
        return dataqueue;
    }
View Full Code Here

TOP

Related Classes of com.ibm.as400.access.CharConverter

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.