Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.factual.driver;
 
 
Represents a streaming request where the response is provided through the a callback

Author(s):
brandon
public class FactualStream {
  private final BufferedReader br;
  private final LineCallback cb;
  public FactualStream(BufferedReader brLineCallback cb) {
    this. = br;
    this. = cb;
  }

  
Start reading the response line by line. This is a blocking call.
  public void start() {
    String line = null;
    StringBuffer sb = new StringBuffer();
    try {
      while ((line = .readLine()) != null) {
        if ( != null)
          .onLine(line);
        sb.append(line);
      }
    } catch (IOException e) {
    }
  }

  
Terminate the request
  public void end() {
    Closeables.closeQuietly();
  }
New to GrepCode? Check out our FAQ X