Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.util
Class FormattedSequencePrintStream

    java.lang.Object
      java.io.OutputStream
          java.io.FilterOutputStream
              java.io.PrintStream
                  org.ensembl.util.FormattedSequencePrintStream

public class FormattedSequencePrintStream
extends java.io.PrintStream

Extended PrintStream to allow users to print fasta formatted sequence output with an unformatted header, and sequence formatted to a user-specified column width maximum, using a user supplied line ending. Users should use the normal PrintStream methods to write header elements. Users should use the various *Sequence methods to print out sequences. Note, the default line ending is a newline, but this can be over ridden.

Author:
  Darin London, Craig Melsopp

Field Summary

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`FormattedSequencePrintStream(int maxColumnLen, java.io.OutputStream out)` Constructor for a basic FormattedSequencePrintStream, with maxColumn and an underlying OutputStream.
`FormattedSequencePrintStream(int maxColumnLen, java.io.OutputStream out, boolean autoFlush)` Constructor for a FormattedSequencePrintStream, stating whether the underlying PrintStream should be in autoFlush mode, or not.
`FormattedSequencePrintStream(int maxColumnLen, java.io.OutputStream out, java.lang.String encoding)` Constructor for a FormattedSequencePrintStream, with a specified encoding.
`FormattedSequencePrintStream(int maxColumnLen, java.lang.String lineEnd, java.io.OutputStream out)`
`FormattedSequencePrintStream(int maxColumnLen, java.lang.String lineEnd, java.io.OutputStream out, boolean autoFlush)` Constructor for a FormattedSequencePrintStream, setting the autoFlush and the lineEnd string to print when adding a line end to formatted sequence output.
`FormattedSequencePrintStream(int maxColumnLen, java.lang.String lineEnd, java.io.OutputStream out, boolean autoFlush, java.lang.String encoding)` Constructor for a FormattedSequencePrintStream, with a specified lineEnd, autoFlush, and encoding.

Method Summary
`void` | `printSequence(char x)` Write out a char of sequence, with formatting.
`void` | `printSequence(char[] x)` Write out a char[] object of sequence, with formatting.
`void` | `printSequence(java.lang.String x)` Write out a String of sequence.
`void` | `resetColumnCount()` sets the columnCount to 0, to signal that a new output of sequence has begun
`void` | `writeSequence(byte b)` Write out a byte of sequence, with formatting.
`void` | `writeSequence(byte[] buf)` write an entire byte[] object containing sequence, with formatting.
`void` | `writeSequence(byte[] buf, int off, int len)` write a portion of a byte[] object containing sequence, with formatting.

Methods inherited from class java.io.PrintStream
`checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, setError, write, write`

Methods inherited from class java.io.FilterOutputStream
`write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FormattedSequencePrintStream

    public FormattedSequencePrintStream(int maxColumnLen,
                                        java.io.OutputStream out)

  Constructor for a basic FormattedSequencePrintStream, with maxColumn and an underlying OutputStream. The default line ending, a newline, is used to add line endings to sequences. Autoflush is set to false.

Parameters:
  `maxColumnLen` - - integer, column length max. A maxColumnLen of 0 signals that no formatting should occur
  `out` - - underlying OutputStream for the PrintStream

### FormattedSequencePrintStream

    public FormattedSequencePrintStream(int maxColumnLen,
                                        java.lang.String lineEnd,
                                        java.io.OutputStream out)

### FormattedSequencePrintStream

    public FormattedSequencePrintStream(int maxColumnLen,
                                        java.io.OutputStream out,
                                        boolean autoFlush)

  Constructor for a FormattedSequencePrintStream, stating whether the underlying PrintStream should be in autoFlush mode, or not. The default line ending, a newline, is used to add line endings to sequences.

Parameters:
  `maxColumnLen` - - integer, column length max. A maxColumnLen of 0 signals that no formatting should occur
  `out` - - underlying OutputStream for the PrintStream
  `autoFlush` - - boolean, if true, underlying PrintStream is set to autoFlush true
See Also:
  `PrintStream`

### FormattedSequencePrintStream

    public FormattedSequencePrintStream(int maxColumnLen,
                                        java.lang.String lineEnd,
                                        java.io.OutputStream out,
                                        boolean autoFlush)

  Constructor for a FormattedSequencePrintStream, setting the autoFlush and the lineEnd string to print when adding a line end to formatted sequence output. Useful for output such as HTML, where the newline should be instead of \n.

Parameters:
  `maxColumnLen` - - integer, column length max. A maxColumnLen of 0 signals that no formatting should occur
  `lineEnd` - - String to end sequence lines with when the formatter inserts a new line to the sequences (default is newline).
  `out` - - underlying OutputStream for the PrintStream
  `autoFlush` - - boolean, if true, underlying PrintStream is set to autoFlush true
See Also:
  `PrintStream`

### FormattedSequencePrintStream

    public FormattedSequencePrintStream(int maxColumnLen,
                                        java.io.OutputStream out,
                                        java.lang.String encoding)
                                 throws java.io.UnsupportedEncodingException

  Constructor for a FormattedSequencePrintStream, with a specified encoding.

Parameters:
  `maxColumnLen` - - integer, column length max. A maxColumnLen of 0 signals that no formatting should occur
  `out` - - underlying OutputStream for the PrintStream
  `encoding` - - encoding to use for character/string conversion
Throws:
  `java.io.UnsupportedEncodingException`
See Also:
  `PrintStream`

### FormattedSequencePrintStream

    public FormattedSequencePrintStream(int maxColumnLen,
                                        java.lang.String lineEnd,
                                        java.io.OutputStream out,
                                        boolean autoFlush,
                                        java.lang.String encoding)
                                 throws java.io.UnsupportedEncodingException

  Constructor for a FormattedSequencePrintStream, with a specified lineEnd, autoFlush, and encoding.

Parameters:
  `maxColumnLen` - - integer, column length max. A maxColumnLen of 0 signals that no formatting should occur
  `out` - - underlying OutputStream for the PrintStream
  `autoFlush` - - boolean, if true, underlying PrintStream is set to autoFlush true
  `encoding` - - encoding to use for character/string conversion
Throws:
  `java.io.UnsupportedEncodingException`
See Also:
  `PrintStream`

Method Detail

### printSequence

    public void printSequence(char x)

  Write out a char of sequence, with formatting.

  Parameters:
    `x` - - char of sequence to be written

### printSequence

    public void printSequence(char[] x)

  Write out a char[] object of sequence, with formatting.

  Parameters:
    `x` - - char[] with sequence to be printed

### printSequence

    public void printSequence(java.lang.String x)

  Write out a String of sequence. Resolves to writeSequence(sequence.getBytes()).

  Parameters:
    `x` -

### writeSequence

    public void writeSequence(byte b)

  Write out a byte of sequence, with formatting.

  Parameters:
    `b` - - byte of sequence to be printed

### writeSequence

    public void writeSequence(byte[] buf)

  write an entire byte[] object containing sequence, with formatting.

  Parameters:
    `buf` - - byte[] containing sequence to be printed

### writeSequence

    public void writeSequence(byte[] buf,
                              int off,
                              int len)

  write a portion of a byte[] object containing sequence, with formatting.

  Parameters:
    `buf` - - byte[] containing sequence bytes to be printed
    `off` - - beginning offset, eg. byte[off] will be the first byte printed
    `len` - - number of bytes to print, eg. byte[off] - byte[off + len - 1] will be printed

### resetColumnCount

    public void resetColumnCount()

  sets the columnCount to 0, to signal that a new output of sequence has begun

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD