Examples of FastOutputStream


Examples of com.sleepycat.util.FastOutputStream

            throw new IllegalArgumentException(
                        "Data object class (" + object.getClass() +
                        ") not an instance of binding's base class (" +
                        baseClass + ')');
        }
        FastOutputStream fo = getFastOutputStream();
        try {
            SerialOutput jos = new SerialOutput(fo, classCatalog);
            jos.writeObject(object);
        } catch (IOException e) {
            throw new RuntimeExceptionWrapper(e);
        }

        byte[] hdr = SerialOutput.getStreamHeader();
        entry.setData(fo.getBufferBytes(), hdr.length,
                     fo.getBufferLength() - hdr.length);
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

     * creating it if necessary.
     *
     * @return FastOutputStream
     */
    private FastOutputStream getFastOutputStream() {
        FastOutputStream fo = (FastOutputStream) fastOutputStreamHolder.get();
        if (fo == null) {
            fo = new FastOutputStream();
            fastOutputStreamHolder.set(fo);
        }
        fo.reset();
        return fo;
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

        public Object getElement() {
            return value;
        }

        public byte[] asBytes() throws IOException {
            FastOutputStream buffer = new FastOutputStream();
            DataOutputStream out = new DataOutputStream(buffer);
            out.writeLong(unwrapLong(previousKey));
            out.writeLong(unwrapLong(nextKey));
            out.writeUTF((String) value);
            return buffer.toByteArray();
        }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

        return info;
    }

    public void objectToEntry(final T info, DatabaseEntry entry) {

        FastOutputStream serialOutput = super.getSerialOutput(info);
        OutputStream out = serialOutput;
        if (compress) {
            out = new LZFOutputStream(serialOutput);
        }
        if (DEBUG) {
            out = new TeeOutputStream(out, System.out);
        }
        try {
            xstreamPersister.save(info, out);
            out.flush();
            out.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        final byte[] bytes = serialOutput.getBufferBytes();
        final int offset = 0;
        final int length = serialOutput.getBufferLength();
        entry.setData(bytes, offset, length);
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

        return info;
    }

    @Override
    public void objectToEntry(T e, DatabaseEntry entry) {
        FastOutputStream serialOutput = super.getSerialOutput(e);
        try {
            ObjectOutputStream out = new ObjectOutputStream(serialOutput);
            out.writeObject(e);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
       
        final byte[] bytes = serialOutput.getBufferBytes();
        final int offset = 0;
        final int length = serialOutput.getBufferLength();
        entry.setData(bytes, offset, length);
    }
View Full Code Here

Examples of org.activemq.util.FastOutputStream

        public Object getElement() {
            return value;
        }

        public byte[] asBytes() throws IOException {
            FastOutputStream buffer = new FastOutputStream();
            DataOutputStream out = new DataOutputStream(buffer);
            out.writeLong(unwrapLong(previousKey));
            out.writeLong(unwrapLong(nextKey));
            out.writeUTF((String) value);
            return buffer.toByteArray();
        }
View Full Code Here

Examples of org.apache.solr.common.util.FastOutputStream

      String compress = params.get(COMPRESSION);
      String sChecksum = params.get(CHECKSUM);
      String sindexVersion = params.get(CMD_INDEX_VERSION);
      if (sindexVersion != null) indexVersion = Long.parseLong(sindexVersion);
      if (Boolean.parseBoolean(compress)) {
        fos = new FastOutputStream(new DeflaterOutputStream(out));
      } else {
        fos = new FastOutputStream(out);
      }
      FileInputStream inputStream = null;
      int packetsWritten = 0;
      try {
        long offset = -1;
View Full Code Here

Examples of org.apache.solr.common.util.FastOutputStream

      String compress = params.get(COMPRESSION);
      String sChecksum = params.get(CHECKSUM);
      String sindexVersion = params.get(CMD_INDEX_VERSION);
      if (sindexVersion != null) indexVersion = Long.parseLong(sindexVersion);
      if (Boolean.parseBoolean(compress)) {
        fos = new FastOutputStream(new DeflaterOutputStream(out));
      } else {
        fos = new FastOutputStream(out);
      }
      FileInputStream inputStream = null;
      int packetsWritten = 0;
      try {
        long offset = -1;
View Full Code Here

Examples of org.apache.solr.common.util.FastOutputStream

      String compress = params.get(COMPRESSION);
      String sChecksum = params.get(CHECKSUM);
      String sindexVersion = params.get(CMD_INDEX_VERSION);
      if (sindexVersion != null) indexVersion = Long.parseLong(sindexVersion);
      if (Boolean.parseBoolean(compress)) {
        fos = new FastOutputStream(new DeflaterOutputStream(out));
      } else {
        fos = new FastOutputStream(out);
      }
      FileInputStream inputStream = null;
      int packetsWritten = 0;
      try {
        long offset = -1;
View Full Code Here

Examples of org.apache.solr.common.util.FastOutputStream

  }

  @Override
  public void write(DataOutput out) throws IOException {
    JavaBinCodec codec = new JavaBinCodec();
    FastOutputStream daos = FastOutputStream.wrap(DataOutputOutputStream.constructOutputStream(out));
    codec.init(daos);
    try {
      codec.writeVal(sid);
    } finally {
      daos.flushBuffer();
    }
  }
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.