001    package railo.runtime.functions.file;
002    
003    import java.io.IOException;
004    
005    import railo.runtime.PageContext;
006    import railo.runtime.exp.FunctionException;
007    import railo.runtime.exp.PageException;
008    import railo.runtime.op.Caster;
009    
010    public class FileReadLine {
011    
012            public static String call(PageContext pc, Object fileObj) throws PageException {
013                    if(!(fileObj instanceof FileStreamWrapper)) 
014                            throw new FunctionException(pc,"FileReadLine",1,"fileObj",
015                                            "invalid type ["+Caster.toTypeName(fileObj)+"], only File Object produced by FileOpen supported");
016                    try {
017                            return ((FileStreamWrapper)fileObj).readLine();
018                    } catch (IOException e) {
019                            throw Caster.toPageException(e);
020                    }
021            }
022    }