Package util

Examples of util.StreamReader


  public synchronized void acceptSocket(Socket socket) throws IOException, InterruptedException {
    checkForPulse();
    fitSocket = socket;
    fitInput = fitSocket.getOutputStream();
    FitProtocol.writeData("", fitInput);
    fitOutput = new StreamReader(fitSocket.getInputStream());

    fitListeningThread = new Thread(new FitListeningRunnable(), "FitClient fitOutput");
    fitListeningThread.start();
  }
View Full Code Here


  public void connect() throws IOException {
    int maxTries = connectionTimeout * 20; // wait time is 50 ms
    while (client == null) {
      client = tryConnect(maxTries--);
    }
    reader = new StreamReader(client.getInputStream());
    writer = new BufferedWriter(new OutputStreamWriter(client.getOutputStream(), "UTF-8"));
    slimServerVersionMessage = reader.readLine();
    validateConnection();
  }
View Full Code Here

    assertEquals(1, process.exitValue());
  }

  private String read(int n) throws Exception {
    return new StreamReader(socketInput).read(n);
  }
View Full Code Here

    }.start();
  }

  private void checkDocumentResults(int right, int wrong, int ignored,
      int exceptions) throws Exception {
    Counts actual = FitProtocol.readCounts(new StreamReader(socketInput));

    assertEquals(right, actual.right);
    assertEquals(wrong, actual.wrong);
    assertEquals(ignored, actual.ignores);
    assertEquals(exceptions, actual.exceptions);
View Full Code Here

      more = processOneSetOfInstructions();
  }

  private void initialize(Socket s) throws IOException {
    executor = slimFactory.getListExecutor(verbose);
    reader = new StreamReader(s.getInputStream());
    writer = new BufferedWriter(new OutputStreamWriter(s.getOutputStream(), "UTF-8"));
    writer.write(String.format("Slim -- V%s\n", SlimVersion.VERSION));
    writer.flush();
  }
View Full Code Here

    int bytes = buffer.getSize();
    assertEquals(12, bytes);

    InputStream input = buffer.getInputStream();
    String content = new StreamReader(input).read(12);
    assertEquals("some content", content);
  }
View Full Code Here

  @Test
  public void testUnicode() throws Exception {
    ContentBuffer buffer = new ContentBuffer();
    buffer.append("??\uFFFD\uFFFD");
    assertEquals("??\uFFFD\uFFFD", new StreamReader(buffer.getInputStream()).read(buffer.getSize()));
  }
View Full Code Here

  private static final Pattern statusLinePattern = Pattern.compile("HTTP/\\d.\\d (\\d\\d\\d) ");
  private static final Pattern headerPattern = Pattern.compile("([^:]*): (.*)");

  public ResponseParser(InputStream input) throws IOException {
    this.input = new StreamReader(input);
    parseStatusLine();
    parseHeaders();
    if (isChuncked()) {
      parseChunks();
      parseHeaders();
View Full Code Here

  protected Request() {
  }

  public Request(InputStream input) {
    this.input = new StreamReader(new BufferedInputStream(input));
  }
View Full Code Here

   
    InputStream input = getClass().getResourceAsStream(classpathResource);
    if (input == null) {
      return new NotFoundResponder().makeResponse(context, request);
    }
    StreamReader reader = new StreamReader(input);
    // Set a hard limit on the amount of data that can be read:
    byte[] content = reader.readBytes(RESOURCE_SIZE_LIMIT);
    SimpleResponse response = new SimpleResponse();
    response.setContent(content);
    setContentType(classpathResource, response);
    lastModifiedDate = LAST_MODIFIED_FOR_RESOURCES;
    response.setLastModifiedHeader(lastModifiedDate);
View Full Code Here

TOP

Related Classes of util.StreamReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.