Package org.apache.rat.document.impl

Examples of org.apache.rat.document.impl.FileDocument


     *
     * @see RAT-81
     */
    @Test
    public void binaryWithMalformedInputRAT81() throws Throwable {
        FileDocument doc = new FileDocument(new File("src/test/resources/binaries/UTF16_with_signature.xml"));
        Reader r = null;
        try {
            char[] dummy = new char[100];
            r = doc.reader();
            r.read(dummy);
            // if we get here, the UTF-16 encoded file didn't throw
            // any exception, try the UTF-8 encoded one
            r.close();
            doc = new FileDocument(new File("src/test/resources/binaries/UTF8_with_signature.xml"));
            r = doc.reader();
            r.read(dummy);
            // still here?  can't test on this platform
            System.err.println("Skipping testBinaryWithMalformedInput");
        } catch (IOException e) {
            if (r!= null) {
View Full Code Here


    @Test
    public void realBinaryContent() {
        // This test is not accurate on all platforms
        if (System.getProperty("file.encoding").startsWith("ANSI")) {
            assertTrue(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/binaries/Image-png.not"))));
        }
    }
View Full Code Here

        }
    }

    @Test
    public void textualContent() {
        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
    }
View Full Code Here

        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
    }

    @Test
    public void emptyFile() {
        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/sub/Empty.txt"))));
    }
View Full Code Here

     * platform's default encoding.
     *
     * @see RAT-81
     */
    public void testBinaryWithMalformedInput() throws Throwable {
        FileDocument doc = new FileDocument(new File("src/test/resources/binaries/UTF16_with_signature.xml"));
        Reader r = null;
        try {
            char[] dummy = new char[100];
            r = doc.reader();
            r.read(dummy);
            // if we get here, the UTF-16 encoded file didn't throw
            // any exception, try the UTF-8 encoded one
            r.close();
            doc = new FileDocument(new File("src/test/resources/binaries/UTF8_with_signature.xml"));
            r = doc.reader();
            r.read(dummy);
            // still here?  can't test on this platform
            System.err.println("Skipping testBinaryWithMalformedInput");
        } catch (IOException e) {
            r.close();
View Full Code Here

            }
        }
    }

    public void testRealBinaryContent() {
        assertTrue(guesser.isBinary(new FileDocument(new File("src/test/resources/binaries/Image-png.not"))));
    }
View Full Code Here

    public void testRealBinaryContent() {
        assertTrue(guesser.isBinary(new FileDocument(new File("src/test/resources/binaries/Image-png.not"))));
    }

    public void testTextualContent() {
        assertFalse(guesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
    }
View Full Code Here

    public void testTextualContent() {
        assertFalse(guesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
    }

    public void testEmptyFile() {
        assertFalse(guesser.isBinary(new FileDocument(new File("src/test/resources/elements/sub/Empty.txt"))));
    }
View Full Code Here

     * @param file the file to be reported on
     * @throws RatReportFailedException
     */
    private void report(final RatReport report, File file) throws RatReportFailedException {

        IDocument document = new FileDocument(file, UNARCHIVER);
        report.report(document);

    }
View Full Code Here

     * @param file the file to be reported on
     * @throws RatException
     */
    private void report(final RatReport report, File file) throws RatException {

        Document document = new FileDocument(file);
        report.report(document);

    }
View Full Code Here

TOP

Related Classes of org.apache.rat.document.impl.FileDocument

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.