Search in sources :

Example 16 with AsyncByteBufferFeeder

use of com.fasterxml.aalto.AsyncByteBufferFeeder in project aalto-xml by FasterXML.

the class TestXmlDeclaration method testStandAloneDeclaration.

public void testStandAloneDeclaration() throws Exception {
    final String XML = "<?xml version  ='1.0' encoding=\"UTF-8\"  standalone='yes' ?>  <root />";
    final AsyncXMLInputFactory f = new InputFactoryImpl();
    for (final int chunkSize : CHUNK_SIZES) {
        // test for byte array
        AsyncXMLStreamReader<AsyncByteArrayFeeder> sr_array = null;
        try {
            sr_array = f.createAsyncForByteArray();
            final AsyncReaderWrapperForByteArray reader_array = new AsyncReaderWrapperForByteArray(sr_array, chunkSize, XML);
            _testStandAloneDeclaration(sr_array, reader_array);
        } finally {
            if (sr_array != null) {
                sr_array.close();
            }
        }
        // test for byte buffer
        AsyncXMLStreamReader<AsyncByteBufferFeeder> sr_buffer = null;
        try {
            sr_buffer = f.createAsyncForByteBuffer();
            final AsyncReaderWrapperForByteBuffer reader_buffer = new AsyncReaderWrapperForByteBuffer(sr_buffer, chunkSize, XML);
            _testStandAloneDeclaration(sr_buffer, reader_buffer);
        } finally {
            if (sr_buffer != null) {
                sr_buffer.close();
            }
        }
    }
}
Also used : AsyncByteBufferFeeder(com.fasterxml.aalto.AsyncByteBufferFeeder) AsyncByteArrayFeeder(com.fasterxml.aalto.AsyncByteArrayFeeder) InputFactoryImpl(com.fasterxml.aalto.stax.InputFactoryImpl) AsyncXMLInputFactory(com.fasterxml.aalto.AsyncXMLInputFactory)

Example 17 with AsyncByteBufferFeeder

use of com.fasterxml.aalto.AsyncByteBufferFeeder in project aalto-xml by FasterXML.

the class TestCommentParsing method _testComments.

private void _testComments(final String spaces, final int chunkSize) throws Exception {
    final AsyncXMLInputFactory f = new InputFactoryImpl();
    // test for byte array
    AsyncXMLStreamReader<AsyncByteArrayFeeder> sr_array = null;
    try {
        sr_array = f.createAsyncForByteArray();
        final AsyncReaderWrapperForByteArray reader_array = new AsyncReaderWrapperForByteArray(sr_array, chunkSize, spaces + XML);
        _testComments(sr_array, reader_array);
    } finally {
        if (sr_array != null) {
            sr_array.close();
        }
    }
    // test for byte buffer
    AsyncXMLStreamReader<AsyncByteBufferFeeder> sr_buffer = null;
    try {
        sr_buffer = f.createAsyncForByteBuffer();
        final AsyncReaderWrapperForByteBuffer reader_buffer = new AsyncReaderWrapperForByteBuffer(sr_buffer, chunkSize, spaces + XML);
        _testComments(sr_buffer, reader_buffer);
    } finally {
        if (sr_buffer != null) {
            sr_buffer.close();
        }
    }
}
Also used : AsyncByteBufferFeeder(com.fasterxml.aalto.AsyncByteBufferFeeder) AsyncByteArrayFeeder(com.fasterxml.aalto.AsyncByteArrayFeeder) InputFactoryImpl(com.fasterxml.aalto.stax.InputFactoryImpl) AsyncXMLInputFactory(com.fasterxml.aalto.AsyncXMLInputFactory)

Example 18 with AsyncByteBufferFeeder

use of com.fasterxml.aalto.AsyncByteBufferFeeder in project aalto-xml by FasterXML.

the class TestXmlDeclaration method testStandAloneDeclaration2.

public void testStandAloneDeclaration2() throws Exception {
    final String XML = "<?xml version=\"1.0\" standalone='yes'?>\n<root/>";
    final AsyncXMLInputFactory f = new InputFactoryImpl();
    for (final int chunkSize : CHUNK_SIZES) {
        // test for byte array
        AsyncXMLStreamReader<AsyncByteArrayFeeder> sr_array = null;
        try {
            sr_array = f.createAsyncForByteArray();
            final AsyncReaderWrapperForByteArray reader_array = new AsyncReaderWrapperForByteArray(sr_array, chunkSize, XML);
            _testStandAloneDeclaration2(sr_array, reader_array);
        } finally {
            if (sr_array != null) {
                sr_array.close();
            }
        }
        // test for byte buffer
        AsyncXMLStreamReader<AsyncByteBufferFeeder> sr_buffer = null;
        try {
            sr_buffer = f.createAsyncForByteBuffer();
            final AsyncReaderWrapperForByteBuffer reader_buffer = new AsyncReaderWrapperForByteBuffer(sr_buffer, chunkSize, XML);
            _testStandAloneDeclaration2(sr_buffer, reader_buffer);
        } finally {
            if (sr_buffer != null) {
                sr_buffer.close();
            }
        }
    }
}
Also used : AsyncByteBufferFeeder(com.fasterxml.aalto.AsyncByteBufferFeeder) AsyncByteArrayFeeder(com.fasterxml.aalto.AsyncByteArrayFeeder) InputFactoryImpl(com.fasterxml.aalto.stax.InputFactoryImpl) AsyncXMLInputFactory(com.fasterxml.aalto.AsyncXMLInputFactory)

Example 19 with AsyncByteBufferFeeder

use of com.fasterxml.aalto.AsyncByteBufferFeeder in project aalto-xml by FasterXML.

the class TestXmlDeclaration method testEncodingDeclaration.

public void testEncodingDeclaration() throws Exception {
    final String XML = "<?xml version= \"1.0\"   encoding='UTF-8' ?><root/>";
    final AsyncXMLInputFactory f = new InputFactoryImpl();
    for (final int chunkSize : CHUNK_SIZES) {
        // test for byte array
        AsyncXMLStreamReader<AsyncByteArrayFeeder> sr_array = null;
        try {
            sr_array = f.createAsyncForByteArray();
            final AsyncReaderWrapperForByteArray reader_array = new AsyncReaderWrapperForByteArray(sr_array, chunkSize, XML);
            _testEncodingDeclaration(sr_array, reader_array);
        } finally {
            if (sr_array != null) {
                sr_array.close();
            }
        }
        // test for byte buffer
        AsyncXMLStreamReader<AsyncByteBufferFeeder> sr_buffer = null;
        try {
            sr_buffer = f.createAsyncForByteBuffer();
            final AsyncReaderWrapperForByteBuffer reader_buffer = new AsyncReaderWrapperForByteBuffer(sr_buffer, chunkSize, XML);
            _testEncodingDeclaration(sr_buffer, reader_buffer);
        } finally {
            if (sr_buffer != null) {
                sr_buffer.close();
            }
        }
    }
}
Also used : AsyncByteBufferFeeder(com.fasterxml.aalto.AsyncByteBufferFeeder) AsyncByteArrayFeeder(com.fasterxml.aalto.AsyncByteArrayFeeder) InputFactoryImpl(com.fasterxml.aalto.stax.InputFactoryImpl) AsyncXMLInputFactory(com.fasterxml.aalto.AsyncXMLInputFactory)

Example 20 with AsyncByteBufferFeeder

use of com.fasterxml.aalto.AsyncByteBufferFeeder in project aalto-xml by FasterXML.

the class TestXmlDeclaration method testVersionOnlyDeclaration.

public void testVersionOnlyDeclaration() throws Exception {
    final String XML = "<?xml version='1.0' ?><root />";
    final AsyncXMLInputFactory f = new InputFactoryImpl();
    for (final int chunkSize : CHUNK_SIZES) {
        // test for byte array
        AsyncXMLStreamReader<AsyncByteArrayFeeder> sr_array = null;
        try {
            sr_array = f.createAsyncForByteArray();
            final AsyncReaderWrapperForByteArray reader_array = new AsyncReaderWrapperForByteArray(sr_array, chunkSize, XML);
            _testVersionOnlyDeclaration(sr_array, reader_array);
        } finally {
            if (sr_array != null) {
                sr_array.close();
            }
        }
        // test for byte buffer
        AsyncXMLStreamReader<AsyncByteBufferFeeder> sr_buffer = null;
        try {
            sr_buffer = f.createAsyncForByteBuffer();
            final AsyncReaderWrapperForByteBuffer reader_buffer = new AsyncReaderWrapperForByteBuffer(sr_buffer, chunkSize, XML);
            _testVersionOnlyDeclaration(sr_buffer, reader_buffer);
        } finally {
            if (sr_buffer != null) {
                sr_buffer.close();
            }
        }
    }
}
Also used : AsyncByteBufferFeeder(com.fasterxml.aalto.AsyncByteBufferFeeder) AsyncByteArrayFeeder(com.fasterxml.aalto.AsyncByteArrayFeeder) InputFactoryImpl(com.fasterxml.aalto.stax.InputFactoryImpl) AsyncXMLInputFactory(com.fasterxml.aalto.AsyncXMLInputFactory)

Aggregations

AsyncByteBufferFeeder (com.fasterxml.aalto.AsyncByteBufferFeeder)24 AsyncXMLInputFactory (com.fasterxml.aalto.AsyncXMLInputFactory)22 InputFactoryImpl (com.fasterxml.aalto.stax.InputFactoryImpl)22 AsyncByteArrayFeeder (com.fasterxml.aalto.AsyncByteArrayFeeder)21 ByteBuffer (java.nio.ByteBuffer)1