Java Code Examples for sun.awt.datatransfer.DataTransferer.ReencodingInputStream#read()

The following examples show how to use sun.awt.datatransfer.DataTransferer.ReencodingInputStream#read() . 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: SuplementaryCharactersTransferTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 2
Source File: SuplementaryCharactersTransferTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 3
Source File: SuplementaryCharactersTransferTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 4
Source File: SuplementaryCharactersTransferTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 5
Source File: SuplementaryCharactersTransferTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 6
Source File: SuplementaryCharactersTransferTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataFlavorUtil.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 7
Source File: SuplementaryCharactersTransferTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 8
Source File: SuplementaryCharactersTransferTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 9
Source File: SuplementaryCharactersTransferTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 10
Source File: SuplementaryCharactersTransferTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 11
Source File: SuplementaryCharactersTransferTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 12
Source File: SuplementaryCharactersTransferTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }
 
Example 13
Source File: SuplementaryCharactersTransferTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        DataTransferer dataTransferer = new TestDataTransferer();
        dataTransferer.registerTextFlavorProperties("UNICODE TEXT", "utf-16le", "\r\n", "2");
        ByteTransferable transferable = new ByteTransferable();
        ReencodingInputStream is = dataTransferer.new ReencodingInputStream(transferable.getByteInputStream(), TEXT_FORMAT,
                DataTransferer.getTextCharset(transferable.getDataFlavor()), transferable);

        byte[] bytes = transferable.getBytes();
        byte[] result = new byte[bytes.length];

        is.read(result);

        for (int i = 0; i < bytes.length; i++) {
            if (bytes[i] != result[i]) {
                throw new RuntimeException("Characters are not equal!");
            }
        }

    }