com.sun.xml.internal.stream.util.BufferAllocator Java Examples

The following examples show how to use com.sun.xml.internal.stream.util.BufferAllocator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Entity.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(boolean isGE, String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.isGE = isGE;
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #2
Source File: Entity.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(boolean isGE, String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.isGE = isGE;
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #3
Source File: Entity.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #4
Source File: Entity.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(boolean isGE, String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.isGE = isGE;
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #5
Source File: Entity.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(boolean isGE, String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.isGE = isGE;
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #6
Source File: Entity.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(boolean isGE, String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.isGE = isGE;
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #7
Source File: Entity.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #8
Source File: Entity.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(boolean isGE, String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.isGE = isGE;
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #9
Source File: Entity.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** Constructs a scanned entity. */
public ScannedEntity(String name,
        XMLResourceIdentifier entityLocation,
        InputStream stream, Reader reader,
        String encoding, boolean literal, boolean mayReadChunks, boolean isExternal) {
    this.name = name ;
    this.entityLocation = entityLocation;
    this.stream = stream;
    this.reader = reader;
    this.encoding = encoding;
    this.literal = literal;
    this.mayReadChunks = mayReadChunks;
    this.isExternal = isExternal;
    final int size = isExternal ? fBufferSize : DEFAULT_INTERNAL_BUFFER_SIZE;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ch = ba.getCharBuffer(size);
    if (ch == null) {
        this.ch = new char[size];
    }
}
 
Example #10
Source File: Entity.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Release any resources associated with this entity.
 */
public void close() throws IOException {
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ba.returnCharBuffer(ch);
    ch = null;
    reader.close();
}
 
Example #11
Source File: ASCIIReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the MessageFormatter to use to message reporting.
 * @param locale    the Locale for which messages are to be reported
 */
public ASCIIReader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #12
Source File: UCSReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.  The Endian-ness and whether this is
 * UCS-2 or UCS-4 needs also to be known in advance.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE.
 */
public UCSReader(InputStream inputStream, int size, short encoding) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fEncoding = encoding;
}
 
Example #13
Source File: UTF8Reader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a UTF-8 reader from the specified input stream,
 * buffer size and MessageFormatter.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the formatter for localizing/formatting errors.
 * @param locale    the Locale to use for messages
 */
public UTF8Reader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #14
Source File: Entity.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Release any resources associated with this entity.
 */
public void close() throws IOException {
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ba.returnCharBuffer(ch);
    ch = null;
    reader.close();
}
 
Example #15
Source File: UCSReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.  The Endian-ness and whether this is
 * UCS-2 or UCS-4 needs also to be known in advance.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE.
 */
public UCSReader(InputStream inputStream, int size, short encoding) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fEncoding = encoding;
}
 
Example #16
Source File: ASCIIReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the MessageFormatter to use to message reporting.
 * @param locale    the Locale for which messages are to be reported
 */
public ASCIIReader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #17
Source File: Entity.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Release any resources associated with this entity.
 */
public void close() throws IOException {
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ba.returnCharBuffer(ch);
    ch = null;
    reader.close();
}
 
Example #18
Source File: Entity.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Release any resources associated with this entity.
 */
public void close() throws IOException {
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ba.returnCharBuffer(ch);
    ch = null;
    reader.close();
}
 
Example #19
Source File: UCSReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.  The Endian-ness and whether this is
 * UCS-2 or UCS-4 needs also to be known in advance.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE.
 */
public UCSReader(InputStream inputStream, int size, short encoding) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fEncoding = encoding;
}
 
Example #20
Source File: ASCIIReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the MessageFormatter to use to message reporting.
 * @param locale    the Locale for which messages are to be reported
 */
public ASCIIReader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #21
Source File: UTF8Reader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a UTF-8 reader from the specified input stream,
 * buffer size and MessageFormatter.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the formatter for localizing/formatting errors.
 * @param locale    the Locale to use for messages
 */
public UTF8Reader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #22
Source File: UTF8Reader.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a UTF-8 reader from the specified input stream,
 * buffer size and MessageFormatter.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the formatter for localizing/formatting errors.
 * @param locale    the Locale to use for messages
 */
public UTF8Reader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #23
Source File: ASCIIReader.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the MessageFormatter to use to message reporting.
 * @param locale    the Locale for which messages are to be reported
 */
public ASCIIReader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #24
Source File: UCSReader.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.  The Endian-ness and whether this is
 * UCS-2 or UCS-4 needs also to be known in advance.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE.
 */
public UCSReader(InputStream inputStream, int size, short encoding) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fEncoding = encoding;
}
 
Example #25
Source File: UTF8Reader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a UTF-8 reader from the specified input stream,
 * buffer size and MessageFormatter.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the formatter for localizing/formatting errors.
 * @param locale    the Locale to use for messages
 */
public UTF8Reader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #26
Source File: Entity.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Release any resources associated with this entity.
 */
public void close() throws IOException {
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ba.returnCharBuffer(ch);
    ch = null;
    reader.close();
}
 
Example #27
Source File: UTF8Reader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a UTF-8 reader from the specified input stream,
 * buffer size and MessageFormatter.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the formatter for localizing/formatting errors.
 * @param locale    the Locale to use for messages
 */
public UTF8Reader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #28
Source File: Entity.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Release any resources associated with this entity.
 */
public void close() throws IOException {
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    ba.returnCharBuffer(ch);
    ch = null;
    reader.close();
}
 
Example #29
Source File: ASCIIReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param messageFormatter  the MessageFormatter to use to message reporting.
 * @param locale    the Locale for which messages are to be reported
 */
public ASCIIReader(InputStream inputStream, int size,
        MessageFormatter messageFormatter, Locale locale) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fFormatter = messageFormatter;
    fLocale = locale;
}
 
Example #30
Source File: UCSReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs an ASCII reader from the specified input stream
 * and buffer size.  The Endian-ness and whether this is
 * UCS-2 or UCS-4 needs also to be known in advance.
 *
 * @param inputStream The input stream.
 * @param size        The initial buffer size.
 * @param encoding One of UCS2LE, UCS2BE, UCS4LE or UCS4BE.
 */
public UCSReader(InputStream inputStream, int size, short encoding) {
    fInputStream = inputStream;
    BufferAllocator ba = ThreadLocalBufferAllocator.getBufferAllocator();
    fBuffer = ba.getByteBuffer(size);
    if (fBuffer == null) {
        fBuffer = new byte[size];
    }
    fEncoding = encoding;
}