Code Monkey home page Code Monkey logo

linereader's Introduction

LineReader

A collection of classes to implement a file reader that can read a specific amount of the content of a file. Instead of reading the whole file at once the aim is to read block wise. The file contents can be read forwards or backwards.

The included FileReader class originally has been created by Dave DeLong. Here you can find his answer on a question at stackoverflow.com.

Screenshot

The screenshot shows the current implementation.

LineReader

Configuration

The following configuration is used for the project.

  • MacOSX 10.7.2
  • SDK 10.7.
  • XCode 4.2. 64bit
  • Cocoa Application
  • Garbage collection

License

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Creative Commons Attribution-ShareAlike 3.0 Unported License

linereader's People

Contributors

johnjohndoe avatar levous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linereader's Issues

Consider <NSFastEnumeration> conformance

It'd be an interesting thing to make FileReader conform to <NSFastEnumeration>, so you could do:

FileReader *r = [[FileReader alloc] initWithFilePath:pathToFile];
for (NSString *line in r) {
  NSLog(@"line: %@", line);
}
[r release];

Harmonization of the FileReader

The use and meaning of local variables in FileReader readline and readLineBackwards are not consistent. Especially, the character position at which the reader sits after one while loop in readLineBackwards is another then it is in readLine. That makes it difficult to use the class without knowledge about the inner semantics.
Further, readLineBackwards can be simplified by getting rid of the redundant if-clauses used before and within the while loop. That needs some brain power of course :-}

Naming of things

While it uglifies the code, it is best practice to prefix both class names and any category methods with some uniquish characters. JJD would be appropriate. Without namespaces in Cocoa, this provides a level of protection against collision if another set of source code. or a library or framework, also defines a similar thing called FileReader or implements a similarly named category method on NSData.

Cocoa will happily pick one, and it might not be the one you want, even if you omit the header files for colliding names.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.