|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava3.core.sequence.io.util.IOUtils
public class IOUtils
Nested Class Summary | |
---|---|
static interface |
IOUtils.ReaderProcessor
Closure interface used when working with IOUtils#processReader(String) . |
Constructor Summary | |
---|---|
IOUtils()
|
Method Summary | ||
---|---|---|
static void |
close(Closeable c)
Closes any Object which implements the interface Closeable and
sending any error to the logger but not forcing any explicit catching of
stream errors. |
|
static void |
copy(InputStream input,
OutputStream output)
Moves the bytes from input to output using a 4KB byte array. |
|
static
|
getGCGChecksum(List<S> sequences)
Calculates GCG checksum for entire list of sequences |
|
static
|
getGCGChecksum(S sequence)
Calculates GCG checksum for a given sequence |
|
static
|
getGCGHeader(List<S> sequences)
Assembles a GCG file header |
|
static
|
getGCGType(CompoundSet<C> cs)
Determines GCG type |
|
static
|
getIDFormat(List<S> sequences)
Creates format String for accession IDs |
|
static List<String> |
getList(BufferedReader br)
Returns the contents of a buffered reader as a list of strings |
|
static List<String> |
getList(File file)
Delegates to getList(InputStream) by wrapping the File
in a valid stream. |
|
static List<String> |
getList(InputStream is)
Delegates to getList(BufferedReader) by wrapping the InputStream
in a valid reader. |
|
static String |
getPDBCharacter(boolean web,
char c1,
char c2,
boolean similar,
char c)
Creates formatted String for a single character of PDB output |
|
static String |
getPDBConservation(boolean web,
char c1,
char c2,
boolean similar)
Creates formatted String for displaying conservation in PDB output |
|
static String |
getPDBLegend()
Creates formatted String for displaying conservation legend in PDB output |
|
static InputStream |
openFile(File file)
For a filename this code will check the extension of the file for a .gz extension. |
|
static void |
processReader(BufferedReader br,
IOUtils.ReaderProcessor processor)
Takes in a reader and a processor, reads every line from the given file and then invokes the processor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IOUtils()
Method Detail |
---|
public static void close(Closeable c)
Closeable
and
sending any error to the logger but not forcing any explicit catching of
stream errors.
c
- The stream to closepublic static void copy(InputStream input, OutputStream output) throws IOException
input
- Input stream of bytesoutput
- Output stream of bytes
IOException
- If anything occurs in the case of the reads and writespublic static void processReader(BufferedReader br, IOUtils.ReaderProcessor processor) throws ParserException
br
- The reader to processprocessor
- The processor to invoke on all lines
ParserException
- Can throw this if we cannot parse the given readerpublic static List<String> getList(BufferedReader br) throws ParserException
br
- BufferedReader to read from; will be closed
ParserException
- Can throw this if we cannot parse the given readerpublic static List<String> getList(InputStream is) throws ParserException
getList(BufferedReader)
by wrapping the InputStream
in a valid reader. No encoding is mentioned so if you need anything
more advanced then use the other version of this method.
is
- InputStream which is a text file
ParserException
- Can throw this if the file is not a file or we
cannot parse itpublic static List<String> getList(File file) throws ParserException
getList(InputStream)
by wrapping the File
in a valid stream. No encoding is mentioned so if you need anything
more advanced then use the other version of this method. Since this
uses openFile(File)
this code can support GZipped and plain
files.
file
- File which is a text file
ParserException
- Can throw this if the file is not a file or we
cannot parse itpublic static InputStream openFile(File file) throws ParserException
GZIPInputStream
. Otherwise we return a normal
FileInputStream
.
file
- File which may or may not be GZipped
ParserException
- Can throw this if the file is not a file or we
cannot open it for processingpublic static <S extends Sequence<C>,C extends Compound> int getGCGChecksum(List<S> sequences)
sequences
- list of sequences
public static <S extends Sequence<C>,C extends Compound> int getGCGChecksum(S sequence)
sequence
- given sequence
public static <S extends Sequence<C>,C extends Compound> String getGCGHeader(List<S> sequences)
sequences
- list of sequences
public static <C extends Compound> String getGCGType(CompoundSet<C> cs)
cs
- compound set of sequences
public static <S extends Sequence<C>,C extends Compound> String getIDFormat(List<S> sequences)
sequences
- list of sequences
public static String getPDBCharacter(boolean web, char c1, char c2, boolean similar, char c)
web
- true for HTML displayc1
- character in first sequencec2
- character in second sequencesimilar
- true if c1 and c2 are considered similar compoundsc
- character to display
public static String getPDBConservation(boolean web, char c1, char c2, boolean similar)
web
- true for HTML displayc1
- character in first sequencec2
- character in second sequencesimilar
- true if c1 and c2 are considered similar compounds
public static String getPDBLegend()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |