Java Code Examples for com.sun.tools.javac.file.JavacFileManager#toArray()

The following examples show how to use com.sun.tools.javac.file.JavacFileManager#toArray() . 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: DiagnosticSource.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<>(buf);
    return buf;
}
 
Example 2
Source File: DiagnosticSource.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 3
Source File: DiagnosticSource.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<>(buf);
    return buf;
}
 
Example 4
Source File: DiagnosticSource.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 5
Source File: DiagnosticSource.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 6
Source File: DiagnosticSource.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 7
Source File: DiagnosticSource.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 8
Source File: DiagnosticSource.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 9
Source File: DiagnosticSource.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected char[] initBuf(JavaFileObject fileObject) throws IOException {
    char[] buf;
    CharSequence cs = fileObject.getCharContent(true);
    if (cs instanceof CharBuffer) {
        CharBuffer cb = (CharBuffer) cs;
        buf = JavacFileManager.toArray(cb);
        bufLen = cb.limit();
    } else {
        buf = cs.toString().toCharArray();
        bufLen = buf.length;
    }
    refBuf = new SoftReference<char[]>(buf);
    return buf;
}
 
Example 10
Source File: Scanner.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
/** Create a scanner from the input buffer.  buffer must implement
 *  array() and compact(), and remaining() must be less than limit().
 */
protected Scanner(ScannerFactory fac, CharBuffer buffer) {
    this(fac, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 11
Source File: UnicodeReader.java    From java-n-IDE-for-Android with Apache License 2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 12
Source File: UnicodeReader.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 13
Source File: UnicodeReader.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 14
Source File: UnicodeReader.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 15
Source File: UnicodeReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 16
Source File: UnicodeReader.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 17
Source File: UnicodeReader.java    From javaide with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 18
Source File: UnicodeReader.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 19
Source File: UnicodeReader.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}
 
Example 20
Source File: UnicodeReader.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a scanner from the input array.  This method might
 * modify the array.  To avoid copying the input array, ensure
 * that {@code inputLength < input.length} or
 * {@code input[input.length -1]} is a white space character.
 *
 * @param sf the factory which created this Scanner
 * @param buffer the input, might be modified
 * Must be positive and less than or equal to input.length.
 */
protected UnicodeReader(ScannerFactory sf, CharBuffer buffer) {
    this(sf, JavacFileManager.toArray(buffer), buffer.limit());
}