Examples of FastByteArrayInputStream


Examples of org.elasticsearch.common.io.FastByteArrayInputStream

        }
        String commitPointName = "commit-" + Long.toString(version, Character.MAX_RADIX);
        CommitPoint commitPoint = new CommitPoint(version, commitPointName, CommitPoint.Type.GENERATED, indexCommitPointFiles, translogCommitPointFiles);
        try {
            byte[] commitPointData = CommitPoints.toXContent(commitPoint);
            blobContainer.writeBlob(commitPointName, new FastByteArrayInputStream(commitPointData), commitPointData.length);
        } catch (Exception e) {
            throw new IndexShardGatewaySnapshotFailedException(shardId, "Failed to write commit point", e);
        }

        // delete all files that are not referenced by any commit point
View Full Code Here

Examples of org.elasticsearch.hadoop.util.FastByteArrayInputStream

    DataOutputStream da = new DataOutputStream(out);
    written.write(da);
    da.close();
   
    LinkedMapWritable read = new LinkedMapWritable();
    read.readFields(new DataInputStream(new FastByteArrayInputStream(out.bytes())));
    assertThat(read.size(), is(written.size()));
    assertThat(read.toString(), is(written.toString()));
  }
View Full Code Here

Examples of winterwell.utils.io.FastByteArrayInputStream

   * @testedby {@link UtilsTest#testCopy()}
   */
  public static <X> X copy(X object) {
    FastByteArrayOutputStream out = new FastByteArrayOutputStream();
    XStreamUtils.xstream().toXML(object, out);
    FastByteArrayInputStream in = new FastByteArrayInputStream(
        out.getByteArray(), out.getSize());
    Object copy = XStreamUtils.xstream().fromXML(in);
    return (X) copy;
  }
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

        final int len = s.readInt();
        final byte[] b = new byte[len];
        s.readFully(b, 0, len);

        FastByteArrayInputStream bis = new FastByteArrayInputStream(b);
        ObjectInputStream ois = new ObjectInputStream(bis);
        this._bodyExpr = (XQExpression) ois.readObject();
        this._bindingVar = (BindingVariable) ois.readObject();

        this._exprBytes = b;
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

        out.writeObject(student2);
        out.close();

        final byte[] b = f.toByteArray();

        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        ObjectInputStream oin = new ObjectInputStream(in);

        Assert.assertEquals(student1, oin.readObject());
        Assert.assertEquals(5, oin.readInt());
        Assert.assertEquals(student2, oin.readObject());
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

        byte[] b2 = out2.toByteArray();
        out.writeInt(b2.length);
        out.write(b2);

        FastByteArrayInputStream bis3 = new FastByteArrayInputStream(b2);
        ObjectInputStream ois3 = new ObjectInputStream(bis3);
        Assert.assertEquals(student2, ois3.readObject());
        Assert.assertEquals(student3, ois3.readObject());

        out.close();

        final byte[] b = f.toByteArray();
        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        ObjectInputStream oin = new ObjectInputStream(in);

        Assert.assertEquals(student1, oin.readObject());
        Assert.assertEquals(5, oin.readInt());

        int size3 = oin.readInt();
        byte[] b3 = new byte[size3];
        oin.read(b3);
        ArrayAssert.assertEquals(b2, b3);

        FastByteArrayInputStream bis4 = new FastByteArrayInputStream(b3);
        ObjectInputStream ois4 = new ObjectInputStream(bis4);
        Assert.assertEquals(student2, ois4.readObject());
        Assert.assertEquals(student3, ois4.readObject());

        oin.close();
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

        ObjectOutputStream out = new ObjectOutputStream(f);
        PlaceHolder holder1 = new PlaceHolder();
        out.writeObject(holder1);
        out.flush();

        FastByteArrayInputStream bis = new FastByteArrayInputStream(f.getInternalArray(), 0, f.size());
        ObjectInputStream ois = new ObjectInputStream(bis);
        Assert.assertEquals(holder1, ois.readObject());
    }
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

            int size = s.readInt();
            byte[] b = new byte[size];
            s.readFully(b, 0, size);
            this.ser23 = b;

            FastByteArrayInputStream bis3 = new FastByteArrayInputStream(b);
            ObjectInputStream ois3 = new ObjectInputStream(bis3);
            this.student2 = (Student) ois3.readObject();
            this.student3 = (Student) ois3.readObject();
        }
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

            throw new IOException(PrintUtils.prettyPrintStackTrace(e));
        }
    }

    public static <T> T readObjectQuietly(final byte[] obj) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj));
    }
View Full Code Here

Examples of xbird.util.io.FastByteArrayInputStream

    public static <T> T readObjectQuietly(final byte[] obj) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj));
    }

    public static <T> T readObjectQuietly(final byte[] obj, final ClassLoader cl) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj), cl);
    }
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.