Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static methods from CharsetDetector, add an interface and create CharsetDetector.Instance #134

Open
304NotModified opened this issue Oct 26, 2021 · 0 comments
Milestone

Comments

@304NotModified
Copy link
Member

For mocking.

e.g.

interface ICharsetDetector
{
  DetectionResult DetectFromBytes(byte[] bytes);
  DetectionResult DetectFromBytes(byte[] bytes, int offset, int len); 
  DetectionResult DetectFromStream(Stream stream);
  DetectionResult DetectFromStream(Stream stream, long? maxBytesToRead);
}

public class CharsetDetector 
{
   public ICharsetDetector Instance => _instance;
}

and move to extensions for SRP:

public static class CharsetDetectorFileExtensions
{
public static DetectionResult DetectFromFile(this ICharsetDetector detector, string filePath) {...}
public static DetectionResult DetectionResult DetectFromFile(this ICharsetDetector detector, FileInfo file) {...}
@304NotModified 304NotModified added this to the 3.0 milestone Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant