Examples of readBytes()


Examples of org.apache.lucene.store.IndexInput.readBytes()

        setUp_2();
        CompoundFileReader cr = new CompoundFileReader(dir, "f.comp");
        IndexInput is = cr.openInput("f2");
        is.seek(is.length() - 10);
        byte b[] = new byte[100];
        is.readBytes(b, 0, 10);

        try {
            is.readByte();
            fail("Single byte read past end of file");
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.lucene.store.IndexInput.readBytes()

            //System.out.println("SUCCESS: single byte read past end of file: " + e);
        }

        is.seek(is.length() - 10);
        try {
            is.readBytes(b, 0, 50);
            fail("Block read past end of file");
        } catch (IOException e) {
            /* success */
            //System.out.println("SUCCESS: block read past end of file: " + e);
        }
View Full Code Here

Examples of org.apache.lucene.store.IndexInput.readBytes()

            long len = is.length();
            long readCount = 0;
            while ( readCount < len )
            {
                int toRead = readCount + BUFFER_SIZE > len ? (int) ( len - readCount ) : BUFFER_SIZE;
                is.readBytes( buf, 0, toRead );
                os.writeBytes( buf, toRead );
                readCount += toRead;
            }

            return true;
View Full Code Here

Examples of org.apache.lucene.store.IndexInput.readBytes()

            while ( bytesLeft > 0 )
            {
                toRead = ( bytesLeft >= buf.length ) ? buf.length : bytesLeft;
                bytesLeft -= toRead;

                in.readBytes( buf, 0, toRead, false );

                zos.write( buf, 0, toRead );
            }
        }
        finally
View Full Code Here

Examples of org.apache.lucene.store.IndexInput.readBytes()

            expectedBytes = new byte[(int) toRead];
         }
         int nextBytesToRead = (int) Math.min(toRead, arrayLengthToRead);

         bytesGenerator.nextBytes(expectedBytes);
         indexInput.readBytes(readBytes, 0, nextBytesToRead);

         assert Arrays.equals(expectedBytes, readBytes);

         toRead = toRead - nextBytesToRead;
View Full Code Here

Examples of org.apache.lucene.store.InputStream.readBytes()

                OutputStream out = dest.createFile(files[i]);
                try {
                    long remaining = in.length();
                    while (remaining > 0) {
                        int num = (int) Math.min(remaining, buffer.length);
                        in.readBytes(buffer, 0, num);
                        out.writeBytes(buffer, num);
                        remaining -= num;
                    }
                } finally {
                    out.close();
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput.readBytes()

    try {
      is = BinaryDictionary.getClassResource(getClass(), FILENAME_SUFFIX);
      is = new BufferedInputStream(is);
      final DataInput in = new InputStreamDataInput(is);
      CodecUtil.checkHeader(in, HEADER, VERSION, VERSION);
      in.readBytes(characterCategoryMap, 0, characterCategoryMap.length);
      for (int i = 0; i < CLASS_COUNT; i++) {
        final byte b = in.readByte();
        invokeMap[i] = (b & 0x01) != 0;
        groupMap[i] = (b & 0x02) != 0;
      }
View Full Code Here

Examples of org.apache.lucene.util.PagedBytes.PagedBytesDataInput.readBytes()

      int numBytes = _TestUtil.nextInt(r2, 1, 100000);
      byte[] bytes = new byte[numBytes];
      r2.nextBytes(bytes);

      byte[] bytesIn = new byte[numBytes];
      dataInput.readBytes(bytesIn, 0, numBytes);
      assertTrue(Arrays.equals(bytes, bytesIn));

      long fp = dataInput.getPosition();
      assert fp == lastFP + numBytes;
      lastFP = fp;
View Full Code Here

Examples of org.apache.qpid.client.message.JMSBytesMessage.readBytes()

        JMSBytesMessage bm = TestMessageHelper.newJMSBytesMessage();
        bm.writeByte((byte)3);
        bm.writeByte((byte)4);
        bm.reset();
        byte[] result = new byte[2];
        int count = bm.readBytes(result);
        assertEquals((byte)3, result[0]);
        assertEquals((byte)4, result[1]);
        assertEquals(2, count);
    }
View Full Code Here

Examples of org.apache.qpid.client.message.JMSStreamMessage.readBytes()

        JMSStreamMessage bm = TestMessageHelper.newJMSStreamMessage();
        byte[] bytes = {1,2,3,4};
        bm.writeBytes(bytes, 1, 2);
        bm.reset();
        bytes = new byte[2];
        bm.readBytes(bytes);
        assertEquals(2, bytes[0]);
        assertEquals(3, bytes[1]);
    }

    public void testWriteObject() throws Exception
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.