Package java.io

Examples of java.io.PushbackReader


   }

   private static List<String> parseProtocols(String config_str) throws IOException
   {
      List<String> retval = new LinkedList<String>();
      PushbackReader reader = new PushbackReader(new StringReader(config_str));
      int ch;
      StringBuilder sb;
      boolean running = true;

      while (running)
      {
         String protocol_name = readWord(reader);
         sb = new StringBuilder();
         sb.append(protocol_name);

         ch = read(reader);
         if (ch == -1)
         {
            retval.add(sb.toString());
            break;
         }

         if (ch == ':')
         { // no attrs defined
            retval.add(sb.toString());
            continue;
         }

         if (ch == '(')
         { // more attrs defined
            reader.unread(ch);
            String attrs = readUntil(reader, ')');
            sb.append(attrs);
            retval.add(sb.toString());
         }
         else
         {
            retval.add(sb.toString());
         }

         while (true)
         {
            ch = read(reader);
            if (ch == ':')
            {
               break;
            }
            if (ch == -1)
            {
               running = false;
               break;
            }
         }
      }
      reader.close();

      return retval;
   }
View Full Code Here


     * @param config_str Configuration string
     * @return Vector of strings
     */
    private static Vector<String> parseProtocols(String config_str) throws IOException {
        Vector<String> retval=new Vector<String>();
        PushbackReader reader=new PushbackReader(new StringReader(config_str));
        int ch;
        StringBuilder sb;
        boolean running=true;

        while(running) {
            String protocol_name=readWord(reader);
            sb=new StringBuilder();
            sb.append(protocol_name);

            ch=read(reader);
            if(ch == -1) {
                retval.add(sb.toString());
                break;
            }

            if(ch == ':') {  // no attrs defined
                retval.add(sb.toString());
                continue;
            }

            if(ch == '(') { // more attrs defined
                reader.unread(ch);
                String attrs=readUntil(reader, ')');
                sb.append(attrs);
                retval.add(sb.toString());
            }
            else {
                retval.add(sb.toString());
            }

            while(true) {
                ch=read(reader);
                if(ch == ':') {
                    break;
                }
                if(ch == -1) {
                    running=false;
                    break;
                }
            }
        }
        reader.close();

        return retval;
    }
View Full Code Here

        internalBuffer = new char[LS_CHARS.length + 3];
        pos = internalBuffer.length;
        // Assumes input is at start of message
        atBeginning = true;
        eof = false;
        internalReader = new PushbackReader(reader);
    }
View Full Code Here

    }
   
    /** Creates a new instance of CsvInputArchive */
    public CsvInputArchive(InputStream in)
    throws UnsupportedEncodingException {
        stream = new PushbackReader(new InputStreamReader(in, "UTF-8"));
    }
View Full Code Here

        {
            this.pushbackReader = (PushbackReader) reader;
        }
        else
        {
            this.pushbackReader = new PushbackReader( reader, 1 );
        }
    }
View Full Code Here

        internalBuffer = new char[LS_CHARS.length + 3];
        pos = internalBuffer.length;
        // Assumes input is at start of message
        atBeginning = true;
        eof = false;
        internalReader = new PushbackReader(reader);
    }
View Full Code Here

  {
//System.err.println( "loadLispSource '"+name+"' --> "+f );

    FileReader      fr;
    LispParser      parser;
    PushbackReader    pbr;
    LispValue      codeFragment, result;
    boolean        verbose = classPrefs.getBoolean( KEY_VERBOSE, false );
   
    fr        = new FileReader( f )// throws FileNotFoundException
    try {
      pbr      = new PushbackReader( fr, 32 );
      initJatha()// XXX we should remove all user variables and functions
      prefsHash.setf_gethash( jatha.makeString( "BASEDIRECTORY" ),
        jatha.makeString( f.getParent() ));
//System.err.println( "initJatha() done." );
      parser    = jatha.PARSER;    // XXX ? Jatha.getParser();
View Full Code Here

        sb.append(line);
        sb.append("\n");
      }
      in.close();
     
      this.in = new PushbackReader(new StringReader(sb.toString()));
      //end add
     
//      this.in = new PushbackReader(new InputStreamReader(
//          new FileInputStream(file), charset));
      nextTree = nextTree();
View Full Code Here

                    metadata.getAbsolutePath() + "}.");
            }
        }
        File rootFile = new File(metadata, ROOT);
        if ( rootFile.exists() ) {
            PushbackReader reader =
                new PushbackReader(new FileReader(rootFile), 100);
            if ( !isRootSupported(reader) ) {
                throw new IllegalArgumentException(
                    "Can not mount GFileManager as the existing {" +
                    root.getAbsolutePath() +
                    "} file defined an unsupported root.");
            }
            reader.close();
            return;
        }
        boolean success = rootFile.createNewFile();
        if ( !success ) {
            throw new IllegalArgumentException(
View Full Code Here

}

public static class SetReader extends AFn{
  public Object invoke(Object reader, Object leftbracket) {
    PushbackReader r = (PushbackReader) reader;
    return PersistentHashSet.createWithCheck(readDelimitedList('}', r, true));
  }
View Full Code Here

TOP

Related Classes of java.io.PushbackReader

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.