Package org.beanio

Examples of org.beanio.StreamFactory


    private BeanWriter beanWriter;

    @Override
    public void open(final Serializable checkpoint) throws Exception {
        mappingFileKey = new StreamFactoryKey(jobContext, streamMapping);
        final StreamFactory streamFactory = getStreamFactory(streamFactoryLookup, mappingFileKey, mappingProperties);
        final OutputStream outputStream = getOutputStream(CsvProperties.OVERWRITE);
        final Writer outputWriter = charset == null ? new OutputStreamWriter(outputStream) :
                new OutputStreamWriter(outputStream, charset);
        beanWriter = streamFactory.createWriter(streamName, new BufferedWriter(outputWriter));
    }
View Full Code Here


        if (startRowNumber < this.start || startRowNumber > this.end || startRowNumber < 0) {
            throw SupportMessages.MESSAGES.invalidStartPosition(startRowNumber, this.start, this.end);
        }

        mappingFileKey = new StreamFactoryKey(jobContext, streamMapping);
        final StreamFactory streamFactory = getStreamFactory(streamFactoryLookup, mappingFileKey, mappingProperties);
        final InputStream inputStream = getInputStream(resource, false);
        final Reader inputReader = charset == null ? new InputStreamReader(inputStream) :
                new InputStreamReader(inputStream, charset);
        beanReader = streamFactory.createReader(streamName, new BufferedReader(inputReader), LocaleUtil.parseLocale(locale));

        if (errorHandler != null) {
            beanReader.setErrorHandler((BeanReaderErrorHandler) errorHandler.newInstance());
        }
        if (startRowNumber > 1) {
View Full Code Here

                                          final Map mappingProperties) throws Exception {
        if (streamFactoryLookup != null) {
            return InitialContext.doLookup(streamFactoryLookup);
        }
        synchronized (beanIOMappings) {
            StreamFactory streamFactory = beanIOMappings.get(key);
            if (streamFactory != null) {
                return streamFactory;
            }
            final InputStream mappingInputStream = getInputStream(key.mappingFile, false);
            if (mappingInputStream == null) {
                throw SupportMessages.MESSAGES.invalidReaderWriterProperty(null, null, "streamMapping");
            }
            streamFactory = StreamFactory.newInstance();

            try {
                if (mappingProperties == null) {
                    streamFactory.load(mappingInputStream);
                } else {
                    final Properties p = new Properties();
                    p.putAll(mappingProperties);
                    streamFactory.load(mappingInputStream, p);
                }
            } finally {
                try {
                    mappingInputStream.close();
                } catch (final IOException ioe) {
View Full Code Here

        if (startRowNumber < this.start || startRowNumber > this.end || startRowNumber < 0) {
            throw SupportMessages.MESSAGES.invalidStartPosition(startRowNumber, this.start, this.end);
        }

        mappingFileKey = new StreamFactoryKey(jobContext, streamMapping);
        final StreamFactory streamFactory = getStreamFactory(streamFactoryLookup, mappingFileKey, mappingProperties);
        final InputStream inputStream = getInputStream(resource, false);
        final Reader inputReader = charset == null ? new InputStreamReader(inputStream) :
                new InputStreamReader(inputStream, charset);
        beanReader = streamFactory.createReader(streamName, new BufferedReader(inputReader), LocaleUtil.parseLocale(locale));

        if (errorHandler != null) {
            beanReader.setErrorHandler((BeanReaderErrorHandler) errorHandler.newInstance());
        }
        if (startRowNumber > 1) {
View Full Code Here

    private BeanWriter beanWriter;

    @Override
    public void open(final Serializable checkpoint) throws Exception {
        mappingFileKey = new StreamFactoryKey(jobContext, streamMapping);
        final StreamFactory streamFactory = getStreamFactory(streamFactoryLookup, mappingFileKey, mappingProperties);
        final OutputStream outputStream = getOutputStream(CsvProperties.OVERWRITE);
        final Writer outputWriter = charset == null ? new OutputStreamWriter(outputStream) :
                new OutputStreamWriter(outputStream, charset);
        beanWriter = streamFactory.createWriter(streamName, new BufferedWriter(outputWriter));
    }
View Full Code Here

        if (startRowNumber < this.start || startRowNumber > this.end || startRowNumber < 0) {
            throw SupportMessages.MESSAGES.invalidStartPosition(startRowNumber, this.start, this.end);
        }

        mappingFileKey = new StreamFactoryKey(jobContext, streamMapping);
        final StreamFactory streamFactory = getStreamFactory(streamFactoryLookup, mappingFileKey, mappingProperties);
        final InputStream inputStream = getInputStream(resource, false);
        final Reader inputReader = charset == null ? new InputStreamReader(inputStream) :
                new InputStreamReader(inputStream, charset);
        beanReader = streamFactory.createReader(streamName, new BufferedReader(inputReader), LocaleUtil.parseLocale(locale));

        if (errorHandler != null) {
            beanReader.setErrorHandler((BeanReaderErrorHandler) errorHandler.newInstance());
        }
        if (startRowNumber > 1) {
View Full Code Here

                                          final Map mappingProperties) throws Exception {
        if (streamFactoryLookup != null) {
            return InitialContext.doLookup(streamFactoryLookup);
        }
        synchronized (beanIOMappings) {
            StreamFactory streamFactory = beanIOMappings.get(key);
            if (streamFactory != null) {
                return streamFactory;
            }
            final InputStream mappingInputStream = getInputStream(key.mappingFile, false);
            if (mappingInputStream == null) {
                throw SupportMessages.MESSAGES.invalidReaderWriterProperty(null, null, "streamMapping");
            }
            streamFactory = StreamFactory.newInstance();

            try {
                if (mappingProperties == null) {
                    streamFactory.load(mappingInputStream);
                } else {
                    final Properties p = new Properties();
                    p.putAll(mappingProperties);
                    streamFactory.load(mappingInputStream, p);
                }
            } finally {
                try {
                    mappingInputStream.close();
                } catch (final IOException ioe) {
View Full Code Here

TOP

Related Classes of org.beanio.StreamFactory

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.