Package java.io

Examples of java.io.Reader.ready()


            Reader r = pop.retrieveMessage(1);
            assertEquals(POP3.TRANSACTION_STATE, pop.getState());

            //Add some sleep here to handle network latency
            while(!r.ready())
            {
                Thread.sleep(10);
            }
            r.close();
            r = null;
View Full Code Here


            r = pop.retrieveMessageTop(1, 10);
            assertEquals(POP3.TRANSACTION_STATE, pop.getState());

            //Add some sleep here to handle network latency
            while(!r.ready())
            {
                Thread.sleep(10);
            }
            r.close();
            r = null;
View Full Code Here

        this.fins = new FileInputStream(tmpFile);
        // channel null
        Reader testReader = Channels.newReader(null, Charset.forName(CODE_SET)
                .newDecoder(), -1);
        assertNotNull(testReader);
        assertFalse(testReader.ready());
        try {
            readres = testReader.read((CharBuffer) null);
            fail();
        } catch (NullPointerException e) {
            // correct
View Full Code Here

        // channel with null inputs
        testReader = Channels.newReader(rbChannel, Charset.forName(CODE_SET)
                .newDecoder(), //$NON-NLS-1$
                -1);
        assertNotNull(testReader);
        assertFalse(testReader.ready());
        try {
            readres = testReader.read(charBuf);
            fail();
        } catch (NullPointerException e) {
            // correct
View Full Code Here

        // channel null
        Reader testReader = Channels.newReader(null, Charset.forName(CODE_SET)
                .newDecoder(), //$NON-NLS-1$
                0);
        assertNotNull(testReader);
        assertFalse(testReader.ready());
        try {
            readres = testReader.read((CharBuffer) null);
            fail();
        } catch (NullPointerException e) {
            // correct
View Full Code Here

        // channel with null inputs
        testReader = Channels.newReader(rbChannel, Charset.forName(CODE_SET)
                .newDecoder(), //$NON-NLS-1$
                -1);
        assertNotNull(testReader);
        assertFalse(testReader.ready());
        try {
            readres = testReader.read(charBuf);
            fail();
        } catch (NullPointerException e) {
            // correct
View Full Code Here

        Reader testReader_s = Channels.newReader(rbChannel, CODE_SET); //$NON-NLS-1$

        assertEquals(this.fileSize, this.fins.available());
        // not ready...
        assertFalse(testReader.ready());
        assertFalse(testReader_s.ready());
        // still reads
        readres = testReader.read(charBuf);
        assertEquals(bufSize, readres);
        assertEquals(0, this.fins.available());
View Full Code Here

        }

        readres = testReader_s.read(charBuf);
        assertEquals(0, readres);
        assertTrue(testReader.ready());
        assertFalse(testReader_s.ready());
    }

    /*
     * Zero-Buffer
     */
 
View Full Code Here

        Reader reader = serialClob.getCharacterStream();
        char[] data = new char[buf.length];
        int read = reader.read(data);
        assertEquals(buf.length, read);
        assertTrue(Arrays.equals(buf, data));
        assertFalse(reader.ready());

        MockSerialClob mockClob = new MockSerialClob();
        mockClob.characterStreamReader = new CharArrayReader(mockClob.buf);
        mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
        mockClob.asciiOutputStream = new ByteArrayOutputStream();
View Full Code Here

        reader = serialClob.getCharacterStream();
        data = new char[mockClob.buf.length];
        read = reader.read(data);
        assertEquals(mockClob.buf.length, read);
        assertTrue(Arrays.equals(mockClob.buf, data));
        assertFalse(reader.ready());
    }

    public void testGetSubString() throws Exception {
        SerialClob serialClob = new SerialClob("hello".toCharArray());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.