Code example for RandomAccessFile

Methods: lengthreadskipBytes

0
        } 
 
        //our yaml parser seems to be too tolerant. Each yaml suite must end with \n, otherwise clients tests might break. 
        RandomAccessFile randomAccessFile = null;
        try { 
            randomAccessFile = new RandomAccessFile(file, "r");
            randomAccessFile.skipBytes((int)randomAccessFile.length() - 1);
            if (randomAccessFile.read() != 10) {
                throw new RestTestParseException("test suite [" + api + "/" + filename + "] doesn't end with line feed (\\n)");
            } 
        } finally { 
            IOUtils.close(randomAccessFile);
        } 
 
        XContentParser parser = YamlXContent.yamlXContent.createParser(new FileInputStream(file));
        try { 
            RestTestSuiteParseContext testParseContext = new RestTestSuiteParseContext(api, filename, parser);
            return parse(testParseContext);
        } catch(Exception e) {
            throw new RestTestParseException("Error parsing " + api + "/" + filename, e);