Package util

Examples of util.StreamReader$State


    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

  }

  public void establishConnection(String httpRequest) throws Exception {
    socket = new Socket(host, port);
    socketOutput = socket.getOutputStream();
    socketReader = new StreamReader(socket.getInputStream());
    byte[] bytes = httpRequest.getBytes("UTF-8");
    socketOutput.write(bytes);
    socketOutput.flush();
    print("http request sent" + "\n");
  }
View Full Code Here

  public int getContentSize() {
    return contentSize;
  }

  public void setBody(InputStream input, int size) {
    reader = new StreamReader(input);
    contentSize = size;
  }
View Full Code Here

TOP

Related Classes of util.StreamReader$State

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.