Package java.io

Examples of java.io.BufferedReader.mark()


        final boolean errorsOnly = resultCollector.isErrorLogging();
        final boolean successOnly = resultCollector.isSuccessOnlyLogging();
        try {
            dataReader = new BufferedReader(new InputStreamReader(
                    new FileInputStream(filename), SaveService.getFileEncoding("UTF-8")));
            dataReader.mark(400);// Enough to read the header column names
            // Get the first line, and see if it is the header
            String line = dataReader.readLine();
            if (line == null) {
                throw new IOException(filename + ": unable to read header line");
            }
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

      if (par_in == null){
        throw new IOException();
      }
      InputStreamReader parstream = new InputStreamReader(par_in);
      buf_in = new BufferedReader(parstream);
      buf_in.mark(2);
      buf_in.read(); // just read one character to see if we can
      buf_in.reset();
    }
    catch (IOException e){
      try{
View Full Code Here

      buf_in.reset();
    }
    catch (IOException e){
      try{
        buf_in = new BufferedReader(new FileReader(p_resourceName));
        buf_in.mark(2);
        buf_in.read();
        buf_in.reset();
      }
      catch (IOException e1){
        buf_in = null;
View Full Code Here

        try {
            Reader reader =
                new BufferedReader(new InputStreamReader(stream, encoding));

            // TIKA-240: Drop the BOM when extracting plain text
            reader.mark(1);
            int bom = reader.read();
            if (bom != '\ufeff') { // zero-width no-break space
                reader.reset();
            }
View Full Code Here

                    url = null; // Don't bother user with generic IRI syntax
                    Reader reader = new BufferedReader(
                            new Utf8PercentDecodingReader(new StringReader(
                                    "function(event){" + tail.toString() + "}")));
                    // XXX CharSequenceReader
                    reader.mark(1);
                    int c = reader.read();
                    if (c != 0xFEFF) {
                        reader.reset();
                    }
                    try {
View Full Code Here

                    iri = null; // Don't bother user with generic IRI syntax
                    Reader reader = new BufferedReader(
                            new Utf8PercentDecodingReader(new StringReader(
                                    "function(event){" + tail.toString() + "}")));
                    // XXX CharSequenceReader
                    reader.mark(1);
                    int c = reader.read();
                    if (c != 0xFEFF) {
                        reader.reset();
                    }
                    try {
View Full Code Here

      chars[i] = (char) i;
    Reader in = new BufferedReader(new Support_StringReader(new String(
        chars)), 12);

    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);
View Full Code Here

    assertTrue("Wrong chars", in.read() == (char) 6
        && in.read() == (char) 7);

    in = new BufferedReader(new Support_StringReader(new String(chars)), 12);
    in.skip(6);
    in.mark(8);
    in.skip(7);
    in.reset();
    assertTrue("Wrong chars 2", in.read() == (char) 6
        && in.read() == (char) 7);
   
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.