org.apache.camel.converter
Class IOConverter

java.lang.Object
  extended by org.apache.camel.converter.IOConverter

@Converter
public final class IOConverter
extends Object

Some core java.io based Type Converters

Version:

Method Summary
static String getCharsetName(Exchange exchange)
           
static String getCharsetName(Exchange exchange, boolean useDefault)
          Gets the charset name if set as property Exchange.CHARSET_NAME.
static String getDefaultCharsetName()
           
static String normalizeCharset(String charset)
          This method will take off the quotes and double quotes of the charset
static byte[] toByteArray(BufferedReader reader)
          Deprecated. 
static byte[] toByteArray(BufferedReader reader, Exchange exchange)
           
static byte[] toByteArray(ByteArrayOutputStream os)
           
static byte[] toByteArray(File file)
           
static byte[] toByteArray(Reader reader)
          Deprecated. 
static byte[] toByteArray(Reader reader, Exchange exchange)
           
static byte[] toByteArray(String value)
          Deprecated. 
static byte[] toByteArray(String value, Exchange exchange)
           
static byte[] toBytes(InputStream stream)
           
static File toFile(String name)
           
static InputStream toInputStream(BufferedReader buffer)
          Deprecated. 
static InputStream toInputStream(BufferedReader buffer, Exchange exchange)
           
static InputStream toInputStream(byte[] data)
           
static InputStream toInputStream(ByteArrayOutputStream os)
           
static InputStream toInputStream(File file)
           
static InputStream toInputStream(String text)
          Deprecated. 
static InputStream toInputStream(String text, Exchange exchange)
           
static InputStream toInputStream(URL url)
           
static ObjectInput toObjectInput(InputStream stream)
           
static ObjectOutput toObjectOutput(OutputStream stream)
           
static OutputStream toOutputStream(File file)
           
static BufferedReader toReader(File file)
          Deprecated. 
static BufferedReader toReader(File file, Exchange exchange)
           
static Reader toReader(InputStream in)
          Deprecated. 
static Reader toReader(InputStream in, Exchange exchange)
           
static StringReader toReader(String text)
           
static String toString(BufferedReader reader)
           
static String toString(byte[] data)
          Deprecated. 
static String toString(byte[] data, Exchange exchange)
           
static String toString(ByteArrayOutputStream os)
          Deprecated. 
static String toString(ByteArrayOutputStream os, Exchange exchange)
           
static String toString(File file)
          Deprecated. 
static String toString(File file, Exchange exchange)
           
static String toString(InputStream in)
          Deprecated. 
static String toString(InputStream in, Exchange exchange)
           
static String toString(Reader reader)
           
static String toString(URL url)
          Deprecated. 
static String toString(URL url, Exchange exchange)
           
static BufferedWriter toWriter(File file)
          Deprecated. 
static BufferedWriter toWriter(File file, Exchange exchange)
           
static Writer toWriter(OutputStream out)
          Deprecated. 
static Writer toWriter(OutputStream out, Exchange exchange)
          Deprecated. 
static void validateCharset(String charset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toInputStream

@Converter
public static InputStream toInputStream(URL url)
                                 throws IOException
Throws:
IOException

toInputStream

@Converter
public static InputStream toInputStream(File file)
                                 throws IOException
Throws:
IOException

toReader

@Deprecated
public static BufferedReader toReader(File file)
                               throws IOException
Deprecated. 

Throws:
IOException

toReader

@Converter
public static BufferedReader toReader(File file,
                                                Exchange exchange)
                               throws IOException
Throws:
IOException

toFile

@Converter
public static File toFile(String name)
                   throws FileNotFoundException
Throws:
FileNotFoundException

toOutputStream

@Converter
public static OutputStream toOutputStream(File file)
                                   throws FileNotFoundException
Throws:
FileNotFoundException

toWriter

@Deprecated
public static BufferedWriter toWriter(File file)
                               throws IOException
Deprecated. 

Throws:
IOException

toWriter

@Converter
public static BufferedWriter toWriter(File file,
                                                Exchange exchange)
                               throws IOException
Throws:
IOException

toReader

@Deprecated
public static Reader toReader(InputStream in)
                       throws IOException
Deprecated. 

Throws:
IOException

toReader

@Converter
public static Reader toReader(InputStream in,
                                        Exchange exchange)
                       throws IOException
Throws:
IOException

toWriter

@Deprecated
public static Writer toWriter(OutputStream out)
                       throws IOException
Deprecated. 

Throws:
IOException

toWriter

@Converter
@Deprecated
public static Writer toWriter(OutputStream out,
                                                   Exchange exchange)
                       throws IOException
Deprecated. 

Throws:
IOException

toReader

@Converter
public static StringReader toReader(String text)

toInputStream

@Deprecated
public static InputStream toInputStream(String text)
                                 throws IOException
Deprecated. 

Throws:
IOException

toInputStream

@Converter
public static InputStream toInputStream(String text,
                                                  Exchange exchange)
                                 throws IOException
Throws:
IOException

toInputStream

@Deprecated
public static InputStream toInputStream(BufferedReader buffer)
                                 throws IOException
Deprecated. 

Throws:
IOException

toInputStream

@Converter
public static InputStream toInputStream(BufferedReader buffer,
                                                  Exchange exchange)
                                 throws IOException
Throws:
IOException

toString

@Deprecated
public static String toString(byte[] data)
                       throws IOException
Deprecated. 

Throws:
IOException

toString

@Converter
public static String toString(byte[] data,
                                        Exchange exchange)
                       throws IOException
Throws:
IOException

toString

@Deprecated
public static String toString(File file)
                       throws IOException
Deprecated. 

Throws:
IOException

toString

@Converter
public static String toString(File file,
                                        Exchange exchange)
                       throws IOException
Throws:
IOException

toByteArray

@Converter
public static byte[] toByteArray(File file)
                          throws IOException
Throws:
IOException

toByteArray

@Deprecated
public static byte[] toByteArray(Reader reader)
                          throws IOException
Deprecated. 

Throws:
IOException

toByteArray

@Converter
public static byte[] toByteArray(Reader reader,
                                           Exchange exchange)
                          throws IOException
Throws:
IOException

toString

@Deprecated
public static String toString(URL url)
                       throws IOException
Deprecated. 

Throws:
IOException

toString

@Converter
public static String toString(URL url,
                                        Exchange exchange)
                       throws IOException
Throws:
IOException

toString

@Converter
public static String toString(Reader reader)
                       throws IOException
Throws:
IOException

toString

@Converter
public static String toString(BufferedReader reader)
                       throws IOException
Throws:
IOException

toByteArray

@Deprecated
public static byte[] toByteArray(BufferedReader reader)
                          throws IOException
Deprecated. 

Throws:
IOException

toByteArray

@Converter
public static byte[] toByteArray(BufferedReader reader,
                                           Exchange exchange)
                          throws IOException
Throws:
IOException

toByteArray

@Deprecated
public static byte[] toByteArray(String value)
                          throws IOException
Deprecated. 

Throws:
IOException

toByteArray

@Converter
public static byte[] toByteArray(String value,
                                           Exchange exchange)
                          throws IOException
Throws:
IOException

toString

@Deprecated
public static String toString(InputStream in)
                       throws IOException
Deprecated. 

Throws:
IOException

toString

@Converter
public static String toString(InputStream in,
                                        Exchange exchange)
                       throws IOException
Throws:
IOException

toInputStream

@Converter
public static InputStream toInputStream(byte[] data)

toObjectOutput

@Converter
public static ObjectOutput toObjectOutput(OutputStream stream)
                                   throws IOException
Throws:
IOException

toObjectInput

@Converter
public static ObjectInput toObjectInput(InputStream stream)
                                 throws IOException
Throws:
IOException

toBytes

@Converter
public static byte[] toBytes(InputStream stream)
                      throws IOException
Throws:
IOException

toByteArray

@Converter
public static byte[] toByteArray(ByteArrayOutputStream os)

toString

@Deprecated
public static String toString(ByteArrayOutputStream os)
                       throws IOException
Deprecated. 

Throws:
IOException

toString

@Converter
public static String toString(ByteArrayOutputStream os,
                                        Exchange exchange)
                       throws IOException
Throws:
IOException

toInputStream

@Converter
public static InputStream toInputStream(ByteArrayOutputStream os)

getCharsetName

public static String getCharsetName(Exchange exchange)

getCharsetName

public static String getCharsetName(Exchange exchange,
                                    boolean useDefault)
Gets the charset name if set as property Exchange.CHARSET_NAME.

Parameters:
exchange - the exchange
useDefault - should we fallback and use JVM default charset if no property existed?
Returns:
the charset, or null if no found

getDefaultCharsetName

public static String getDefaultCharsetName()

normalizeCharset

public static String normalizeCharset(String charset)
This method will take off the quotes and double quotes of the charset


validateCharset

public static void validateCharset(String charset)
                            throws UnsupportedCharsetException
Throws:
UnsupportedCharsetException


Apache CAMEL