As you guys may know, on one of my production boxes, I’ve been having CFMail issues. Details here.
Here is an image of the problem:
As well, I looked parsing the necessary cfmail files to get rid of defective line. But looking at ColdFusion and Java (and even .NET), nothing stood out.
So that was it! I needed a solid CFC to work with text files on a line by line basis. Enter FileByLine.CFC.
Here is some code!
Author: Sami Hoda
Email: sami bytestopshere.com
Note: Comments appreciated!
This code is provided as is.
I make no warranty or guarantee.
Use of this code is at your own risk.
READING OF LARGE FILES INTO ARRAYS FOR MANIPULATION CAN BE RISKY. RE-READ WARNING!
– Optimization! I want it faster!
– Implement some sort of find capability… use Regex?
Copyright 2009 Sami Hoda
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
And now the image shows:
Voila! Have fun. Comments welcome!
I’ll add this code to RiaForge shortly!
UPDATE: Code now on RiaForge, see http://filebyline.riaforge.org/.