Package java.io

Examples of java.io.BufferedReader.mark()


      chars[i] = (char) i;
    Reader in = new BufferedReader(new Support_StringReader(new String(
        chars)), 12);
    try {
      in.skip(6);
      in.mark(14);
      in.read(new char[14], 0, 14);
      in.reset();
      assertTrue("Wrong chars", in.read() == (char) 6
          && in.read() == (char) 7);
    } catch (IOException e) {
View Full Code Here


    }

    in = new BufferedReader(new Support_StringReader(new String(chars)), 12);
    try {
      in.skip(6);
      in.mark(8);
      in.skip(7);
      in.reset();
      assertTrue("Wrong chars 2", in.read() == (char) 6
          && in.read() == (char) 7);
    } catch (IOException e) {
View Full Code Here

        } else {
            Reader reader = message.getContent(Reader.class);
            if (reader != null) {
                try {
                    BufferedReader r = new BufferedReader(reader, limit);
                    r.mark(limit);
                    char b[] = new char[limit];
                    int i = r.read(b);
                    buffer.getPayload().append(b, 0, i);
                    r.reset();
                    message.setContent(Reader.class, r);
View Full Code Here

        expectedResidues.add(residue);

        // Mark the final line of the !!index array str so that
        // readResidueSection() can read the !entry.$RES.unit.atoms line

        br.mark(BUFFER_SIZE);

      }

      /*
       * TODO This is broken since this will expect residues read in from
View Full Code Here

    static void printBody(PrintWriter pw, HttpServletRequest req) throws IOException
    {
        BufferedReader in = req.getReader() ;
        if ( req.getContentLength() > 0 )
            // Need +2 because last line may not have a CR/LF on it.
            in.mark(req.getContentLength()+2) ;
        else
            // This is a dump - try to do something that works, even if inefficient.
            in.mark(100*1024) ;

        while(true)
View Full Code Here

        if ( req.getContentLength() > 0 )
            // Need +2 because last line may not have a CR/LF on it.
            in.mark(req.getContentLength()+2) ;
        else
            // This is a dump - try to do something that works, even if inefficient.
            in.mark(100*1024) ;

        while(true)
        {
            String x = in.readLine() ;
            if ( x == null )
View Full Code Here

            } else if (!(fileEntry.inputOutputObject instanceof Reader)) {
                throw new IOException("File " + alias + " already in use");
            } else {
                reader = (BufferedReader) fileEntry.inputOutputObject;
                if (recycle) { // need to check if we are at EOF already
                    reader.mark(1);
                    int peek = reader.read();
                    if (peek == -1) { // already at EOF
                        reader.close();
                        reader = createBufferedReader(fileEntry);
                        fileEntry.inputOutputObject = reader;
View Full Code Here

        } else {
            Reader reader = message.getContent(Reader.class);
            if (reader != null) {
                try {
                    BufferedReader r = new BufferedReader(reader, limit);
                    r.mark(limit);
                    char b[] = new char[limit];
                    int i = r.read(b);
                    buffer.getPayload().append(b, 0, i);
                    r.reset();
                    message.setContent(Reader.class, r);
View Full Code Here

        } else {
            Reader reader = message.getContent(Reader.class);
            if (reader != null) {
                try {
                    BufferedReader r = new BufferedReader(reader, limit);
                    r.mark(limit);
                    char b[] = new char[limit];
                    int i = r.read(b);
                    buffer.getPayload().append(b, 0, i);
                    r.reset();
                    message.setContent(Reader.class, r);
View Full Code Here

    String jsonString = writer.toString();
    assertTrue(jsonString.substring(0,5).toLowerCase(Locale.ENGLISH).startsWith("<html"));
    BufferedReader jsonReader = new BufferedReader(new StringReader(jsonString));
    // Skip ahead to start of JSON
    while (true) {
      jsonReader.mark(16 * 1024);
      String line = jsonReader.readLine();
      if (line == null) {
        fail("Didn't find start of JSON string");
      }
      if (line.startsWith("{")) {
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.