Package java.io

Examples of java.io.DataInput


    }

    System.out.println("Mid-key: " + Bytes.toStringBinary(reader.midkey()));

    // Printing general bloom information
    DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();
    BloomFilter bloomFilter = null;
    if (bloomMeta != null)
      bloomFilter = BloomFilterFactory.createFromMeta(bloomMeta, reader);

    System.out.println("Bloom filter:");
View Full Code Here


      try {
        if (blockType == BlockType.GENERAL_BLOOM_META) {
          if (this.generalBloomFilter != null)
            return; // Bloom has been loaded

          DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();
          if (bloomMeta != null) {
            // sanity check for NONE Bloom filter
            if (bloomFilterType == BloomType.NONE) {
              throw new IOException(
                  "valid bloom filter type not found in FileInfo");
            } else {
              generalBloomFilter = BloomFilterFactory.createFromMeta(bloomMeta,
                  reader);
              LOG.info("Loaded " + bloomFilterType.toString() + " ("
                  + generalBloomFilter.getClass().getSimpleName()
                  + ") metadata for " + reader.getName());
            }
          }
        } else if (blockType == BlockType.DELETE_FAMILY_BLOOM_META) {
          if (this.deleteFamilyBloomFilter != null)
            return; // Bloom has been loaded

          DataInput bloomMeta = reader.getDeleteBloomFilterMetadata();
          if (bloomMeta != null) {
            deleteFamilyBloomFilter = BloomFilterFactory.createFromMeta(
                bloomMeta, reader);
            LOG.info("Loaded Delete Family Bloom ("
                + deleteFamilyBloomFilter.getClass().getSimpleName()
View Full Code Here

     *
     * @param input the data input for this page
     * @throws java.io.IOException if an exception is thrown
     */
    protected void readMessage(InputStream input) throws IOException {
        DataInput in = new DataInputStream(input);

        readRequestLine(in);
        readHeaders(in);
        readBody(in);

View Full Code Here

    /** parses the request into the 3 different parts, request, headers, and body
     * @param input the data input for this page
     * @throws IOException if an exception is thrown
     */
    protected void readMessage(InputStream input) throws IOException {
        DataInput in = new DataInputStream(input);

        readRequestLine(in);
        readHeaders(in);
        readBody(in);
    }
View Full Code Here

            dataOut.writeByte(NULL_TYPE);
        }
    }

    public Object unmarshal(DataInput dis) throws IOException {
        DataInput dataIn = dis;
        if (!sizePrefixDisabled) {
            int size = dis.readInt();
            if (size > maxFrameSize) {
                throw new IOException("Frame size of " + (size / (1024 * 1024)) + " MB larger than max allowed " + (maxFrameSize / (1024 * 1024)) + " MB");
            }
View Full Code Here

    protected String getCommand(String frame) {
        return frame.substring(0, frame.indexOf('\n') + 1).trim();
    }

    protected String getHeaderValue(String frame, String header) throws IOException {
        DataInput input = new DataInputStream(new ByteArrayInputStream(frame.getBytes()));
        String line;
        for (int idx = 0; /* forever, sort of */; ++idx) {
            line = input.readLine();
            if (line == null) {
                // end of message, no headers
                return null;
            }
            line = line.trim();
View Full Code Here

            dataOut.writeByte(NULL_TYPE);
        }
    }

    public Object unmarshal(DataInput dis) throws IOException {
        DataInput dataIn = dis;
        if (!sizePrefixDisabled) {
            dis.readInt();
            // int size = dis.readInt();
            // byte[] data = new byte[size];
            // dis.readFully(data);
View Full Code Here

    protected String getCommand(String frame) {
        return frame.substring(0, frame.indexOf('\n') + 1).trim();
    }

    protected String getHeaderValue(String frame, String header) throws IOException {
        DataInput input = new DataInputStream(new ByteArrayInputStream(frame.getBytes()));
        String line;
        for (int idx = 0; /* forever, sort of */; ++idx) {
            line = input.readLine();
            if (line == null) {
                // end of message, no headers
                return null;
            }
            line = line.trim();
View Full Code Here

     *
     * @return int[]
     */
    public int[] readIntArray() {
        try {
            DataInput dis;
            if (bigEndian) {
                dis = new DataInputStream(stream);
            } else {
                dis = new LEDataInputStream(stream);
            }

            Vector<Integer> intV = new Vector<Integer>();

            try {
                while (true) {
                    int i = dis.readInt();
                    intV.add(new Integer(i));
                }
            } catch (EOFException eof) {
                stream.close();
            }
View Full Code Here

     *
     * @return float[]
     */
    public float[] readFloatArray() {
        try {
            DataInput dis;
            if (bigEndian) {
                dis = new DataInputStream(stream);
            } else {
                dis = new LEDataInputStream(stream);
            }

            Vector<Float> floatV = new Vector<Float>();

            try {
                while (true) {
                    float f = dis.readFloat();
                    floatV.add(new Float(f));
                }
            } catch (EOFException eof) {
                stream.close();
            }
View Full Code Here

TOP

Related Classes of java.io.DataInput

Copyright © 2018 www.massapicom. 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.