public class FileParser
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
Iterable should be returned
 rather than throwing an exception.
 
 Subclasses should follow| Modifier and Type | Field and Description | 
|---|---|
protected OmeroContext | 
context  | 
static java.lang.Iterable<java.io.Reader> | 
EMPTY
Iterable which returns an empty Iterator. | 
protected long | 
maxFileSize  | 
| Constructor and Description | 
|---|
FileParser()  | 
| Modifier and Type | Method and Description | 
|---|---|
java.lang.Iterable<java.io.Reader> | 
doParse(java.io.File file)
Template method to parse a  
File into manageable chunks. | 
java.lang.Iterable<java.io.Reader> | 
parse(java.io.File file)
Uses  
doParse(File) to create manageable chunks of a file for
 indexing. | 
void | 
setApplicationContext(org.springframework.context.ApplicationContext arg0)  | 
void | 
setMaxFileSize(java.lang.Long size)  | 
java.lang.Iterable<java.io.Reader> | 
wrap(java.util.Iterator<java.io.Reader> it)
Wraps an  
Iterator with an Iterable instance. | 
java.lang.Iterable<java.io.Reader> | 
wrap(java.io.Reader r)  | 
protected OmeroContext context
protected long maxFileSize
public static final java.lang.Iterable<java.io.Reader> EMPTY
Iterable which returns an empty Iterator. This will be
 used in casepublic void setApplicationContext(org.springframework.context.ApplicationContext arg0)
                           throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void setMaxFileSize(java.lang.Long size)
public final java.lang.Iterable<java.io.Reader> parse(java.io.File file)
doParse(File) to create manageable chunks of a file for
 indexing. If the File argument is null or unreadable, then the
 EMPTY Iterable will be returned. The same holds if a
 null Iterable is returned or an Exception is thrown.
 
 The Iterator returned from the instance should always be
 completely iterated through so that resources can be released. For
 example, 
 for (String string : parse(file)) {
     /* possibly ignore string *\/
 }
 file - Can be null.Iterable which is never null.public java.lang.Iterable<java.io.Reader> doParse(java.io.File file)
                                           throws java.lang.Exception
File into manageable chunks.
 
 The default implementation reads from the file lazily with chunks
 overlapping on the final white space. For example a file with:
 The quick brown fox jumps over the lazy dog might be
 parsed to: The quick brown fox jumps and
 jumps over the lazy dog.
 
 Receives a non-null, readable File
 instance from parse(File) and can return a possible null
 Iterable or throw an Exception.
 
 In any of the non-successful cases, the EMPTY Iterable
 will be returned to the consumer.java.lang.Exceptionpublic java.lang.Iterable<java.io.Reader> wrap(java.util.Iterator<java.io.Reader> it)
Iterator with an Iterable instance. If the
 Iterator is null, the EMPTY Iterable will be
 returned.it - Can be null.public java.lang.Iterable<java.io.Reader> wrap(java.io.Reader r)
                
                
Version: 5.4.8-ice35-b99
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.