Class InputStreamStringBuilder

java.lang.Object
org.refcodes.io.InputStreamStringBuilder
All Implemented Interfaces:
org.refcodes.mixin.EncodingAccessor<String>, org.refcodes.mixin.EncodingAccessor.EncodingBuilder<String,InputStreamStringBuilder>, org.refcodes.mixin.EncodingAccessor.EncodingMutator<String>, org.refcodes.mixin.EncodingAccessor.EncodingProperty<String>, org.refcodes.mixin.InputStreamAccessor, org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<InputStreamStringBuilder>, org.refcodes.mixin.InputStreamAccessor.InputStreamMutator, org.refcodes.mixin.InputStreamAccessor.InputStreamProperty

public class InputStreamStringBuilder extends Object implements org.refcodes.mixin.InputStreamAccessor.InputStreamProperty, org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<InputStreamStringBuilder>, org.refcodes.mixin.EncodingAccessor.EncodingProperty<String>, org.refcodes.mixin.EncodingAccessor.EncodingBuilder<String,InputStreamStringBuilder>
The InputStreamStringBuilder constructs String instances from InputStream instances. Either use setInputStream(InputStream) (withInputStream(InputStream)) followed by a Object.toString() method (not thread safe) or directly call toString(InputStream) (thread safe). You may specify an encoding to be used such as UTF-8 by either setting the encoding attribute with EncodingAccessor.EncodingMutator.setEncoding(Object) (withEncoding(String)) or by passing the encoding to the conversion method as of toString(String) which overrules the encoding attribute.
  • Constructor Details

    • InputStreamStringBuilder

      public InputStreamStringBuilder()
  • Method Details

    • withEncoding

      public InputStreamStringBuilder withEncoding(String aEncoding)
      Specified by:
      withEncoding in interface org.refcodes.mixin.EncodingAccessor.EncodingBuilder<String,InputStreamStringBuilder>
    • withInputStream

      public InputStreamStringBuilder withInputStream(InputStream aInputStream)
      Specified by:
      withInputStream in interface org.refcodes.mixin.InputStreamAccessor.InputStreamBuilder<InputStreamStringBuilder>
    • toString

      public String toString(InputStream aInputStream) throws IOException
      The String being build by the builder upon the settings of the attributes.
      Parameters:
      aInputStream - The InputStream which to convert into a String.
      Returns:
      The according resulting String
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.
    • toStrings

      public String[] toStrings(InputStream aInputStream) throws IOException
      The Strings being build by the builder upon the settings of the attributes.
      Parameters:
      aInputStream - The InputStream which to convert into a String array.
      Returns:
      The according resulting String array
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.
    • getEncoding

      public String getEncoding()
      Specified by:
      getEncoding in interface org.refcodes.mixin.EncodingAccessor<String>
    • setEncoding

      public void setEncoding(String aEncoding)
      Specified by:
      setEncoding in interface org.refcodes.mixin.EncodingAccessor.EncodingMutator<String>
    • getInputStream

      public InputStream getInputStream()
      Specified by:
      getInputStream in interface org.refcodes.mixin.InputStreamAccessor
    • setInputStream

      public void setInputStream(InputStream aInputStream)
      Specified by:
      setInputStream in interface org.refcodes.mixin.InputStreamAccessor.InputStreamMutator
    • toString

      public String toString(InputStream aInputStream, String aEncoding) throws IOException
      The String being build by the builder upon the settings of the attributes.
      Parameters:
      aInputStream - The InputStream which to convert into a String.
      aEncoding - The text encoding to be used.
      Returns:
      The according resulting String
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(String aEncoding) throws IOException
      The Strings being build by the builder upon the settings of the attributes.
      Parameters:
      aEncoding - The text encoding to be used.
      Returns:
      The according resulting String array
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.
    • toStrings

      public String[] toStrings() throws IOException
      The Strings being build by the builder upon the settings of the attributes.
      Returns:
      The according resulting String array
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.
    • toStrings

      public String[] toStrings(String aEncoding) throws IOException
      The Strings being build by the builder upon the settings of the attributes.
      Parameters:
      aEncoding - The text encoding to be used.
      Returns:
      The according resulting String array
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.
    • toStrings

      public String[] toStrings(InputStream aInputStream, String aEncoding) throws IOException
      The Strings being build by the builder upon the settings of the attributes.
      Parameters:
      aInputStream - The InputStream which to convert into a String array.
      aEncoding - The text encoding to be used.
      Returns:
      The according resulting String array
      Throws:
      IOException - thrown in case accessing the InputStream caused faults.