Package freenet.support.io

Examples of freenet.support.io.LineReadingInputStream.readLine()


        handler.outputHandler.queue(msg);
        Closer.close(is);
        return;
      }
      // Read a message
      String messageType = lis.readLine(128, 128, true);
      if(messageType == null) {
        Closer.close(is);
        return;
      }
      if(messageType.equals(""))
View Full Code Here


      is = this.data.getInputStream();
      lis = new LineReadingInputStream(is);

      String line;
      line = lis.readLine(100, 100, false); // really it's US-ASCII, but ISO-8859-1 is close enough.
      while((is.available() > 0) && !line.equals(boundary)) {
        line = lis.readLine(100, 100, false);
      }

      boundary = "\r\n" + boundary;
View Full Code Here

      lis = new LineReadingInputStream(is);

      String line;
      line = lis.readLine(100, 100, false); // really it's US-ASCII, but ISO-8859-1 is close enough.
      while((is.available() > 0) && !line.equals(boundary)) {
        line = lis.readLine(100, 100, false);
      }

      boundary = "\r\n" + boundary;

      RandomAccessBucket filedata = null;
View Full Code Here

      while(is.available() > 0) {
        name = null;
        filename = null;
        contentType = null;
        // chomp headers
        while((line = lis.readLine(200, 200, true)) /* should be UTF-8 as we told the browser to send UTF-8 */ != null) {
          if(line.length() == 0)
            break;

          String[] lineparts = line.split(":");
          if(lineparts == null || lineparts.length == 0)
View Full Code Here

     
      LineReadingInputStream lis = new LineReadingInputStream(is);
     
      while(true) {
       
        String firstLine = lis.readLine(32768, 128, false); // ISO-8859-1 or US-ASCII, _not_ UTF-8
        if (firstLine == null) {
          sock.close();
          return;
        } else if (firstLine.equals("")) {
          continue;
View Full Code Here

        String method = split[0];
       
        MultiValueTable<String,String> headers = new MultiValueTable<String,String>();
       
        while(true) {
          String line = lis.readLine(32768, 128, false); // ISO-8859 or US-ASCII, not UTF-8
          if (line == null) {
            sock.close();
            return;
          }
          //System.out.println("Length="+line.length()+": "+line);
View Full Code Here

            HTMLNode logInfoboxContent = ctx.getPageMaker().getInfobox("infobox-info", "Current status", contentNode, "start-progress", true);
            LineReadingInputStream logreader = null;
            try {
                logreader = FileUtil.getLogTailReader(logs, 2000);
              String line;
              while ((line = logreader.readLine(100000, 200, true)) != null) {
                  logInfoboxContent.addChild("#", line);
                  logInfoboxContent.addChild("br");
              }
            } catch(IOException e) {}
            finally {
View Full Code Here

        System.out.println("Connected to node.");
        LineReadingInputStream lis = new LineReadingInputStream(sockIS);
        OutputStreamWriter osw = new OutputStreamWriter(sockOS, "UTF-8");
        osw.write("ClientHello\nExpectedVersion=0.7\nName=BootstrapPullTest-"+System.currentTimeMillis()+"\nEnd\n");
        osw.flush();
         String name = lis.readLine(65536, 128, true);
         SimpleFieldSet fs = new SimpleFieldSet(lis, 65536, 128, true, false, true);
         if(!name.equals("NodeHello")) {
           System.err.println("No NodeHello from insertor node!");
           System.exit(EXIT_INSERTER_PROBLEM);
         }
View Full Code Here

         osw.flush();
         InputStream is = new FileInputStream(dataFile);
         FileUtil.copy(is, sockOS, TEST_SIZE);
         System.out.println("Sent data");
         while(true) {
             name = lis.readLine(65536, 128, true);
             fs = new SimpleFieldSet(lis, 65536, 128, true, false, true);
           System.out.println("Got FCP message: \n"+name);
           System.out.print(fs.toOrderedString());
           if(name.equals("ProtocolError")) {
             System.err.println("Protocol error when inserting data.");
View Full Code Here

        sfs.putSingle("ExpectedVersion", "2.0");
        fcpm = FCPMessage.create("ClientHello", sfs);
        fcpm.send(os);
        os.flush();

        String messageName = lis.readLine(128, 128, true);
        sfs = getMessage(lis);
        fcpm = FCPMessage.create(messageName, sfs);
        if((fcpm == null) || !(fcpm instanceof NodeHelloMessage)){
          System.err.println("Not a valid FRED node!");
          System.exit(1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.