Examples of ObjectOutputStream


Examples of java.io.ObjectOutputStream

      result[current++] = new Double(Utils.missingValue());
    }
   
    // sizes
    ByteArrayOutputStream bastream = new ByteArrayOutputStream();
    ObjectOutputStream oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(m_Classifier);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(train);
    result[current++] = new Double(bastream.size());
    bastream = new ByteArrayOutputStream();
    oostream = new ObjectOutputStream(bastream);
    oostream.writeObject(test);
    result[current++] = new Double(bastream.size());
   
    // Prediction interval statistics
    result[current++] = new Double(eval.coverageOfTestCasesByPredictedRegions());
    result[current++] = new Double(eval.sizeOfPredictedRegions());
View Full Code Here

Examples of java.io.ObjectOutputStream

    if (size <= 0)
      throw new IllegalArgumentException("Buffer size <= 0");
    buf = new byte[size];

    if (! compressedFlows)
      oos = new ObjectOutputStream(this);
    count = 0;
  }
View Full Code Here

Examples of java.io.ObjectOutputStream

          // Writes a serializable object to this output stream.
          if (compressedFlows) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            GZIPOutputStream gzipos = new GZIPOutputStream(baos);
           
            oos = new ObjectOutputStream(gzipos);
            oos.writeObject(msg.not);

            // Be careful, the reset writes a TC_RESET byte
            oos.reset();
            // The OOS flush call the flush of this output stream.
View Full Code Here

Examples of java.io.ObjectOutputStream

                         String dirName, String name,
                         boolean first) throws IOException {
    Context ctx = (Context) perThreadContext.get();
    if (ctx.oos == null) {
      ctx.bos.reset();
      ctx.oos = new ObjectOutputStream(ctx.bos);
    } else {
      ctx.oos.reset();
      ctx.bos.reset();
      ctx.bos.write(OOS_STREAM_HEADER, 0, 4);
    }
View Full Code Here

Examples of java.io.ObjectOutputStream

  public void save(Serializable obj,
                   String dirName, String name,
                   boolean first) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(obj);
    oos.flush();
    saveByteArray(bos.toByteArray(), dirName, name);
  }
View Full Code Here

Examples of java.io.ObjectOutputStream

        System.out.println(xml2);
       
        assertEquals(xml, xml2);
       
        // test serialization of process elements
        new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(process);
    }
View Full Code Here

Examples of java.io.ObjectOutputStream

    public static StatefulSession getSerialisedStatefulSession(StatefulSession session,
                                                               RuleBase ruleBase,
                                                               boolean dispose) throws Exception {
        // Serialize to a byte array
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutput out = new ObjectOutputStream( bos );
        out.writeObject( session );
        out.close();
        bos.close();

        // Get the bytes of the serialized object
        final byte[] b1 = bos.toByteArray();

        ByteArrayInputStream bais = new ByteArrayInputStream( b1 );
        StatefulSession session2 = ruleBase.newStatefulSession( bais );
        bais.close();

        bos = new ByteArrayOutputStream();
        out = new ObjectOutputStream( bos );
        out.writeObject( session2 );
        out.close();
        bos.close();

        final byte[] b2 = bos.toByteArray();

        // bytes should be the same.
View Full Code Here

Examples of java.io.ObjectOutputStream

      try {
  OutputStream os = new FileOutputStream(sFile);
  if (sFile.getName().endsWith(".gz")) {
    os = new GZIPOutputStream(os);
  }
  ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
  objectOutputStream.writeObject(classifier);
  if (trainHeader != null) objectOutputStream.writeObject(trainHeader);
  objectOutputStream.flush();
  objectOutputStream.close();
      } catch (Exception e) {
 
  JOptionPane.showMessageDialog(null, e, "Save Failed",
              JOptionPane.ERROR_MESSAGE);
  saveOK = false;
View Full Code Here

Examples of java.io.ObjectOutputStream

    }

    public static byte[] toBytes(final BindingVariable bindingVar, final XQExpression bodyExpr) {
        final FastByteArrayOutputStream bos = new FastByteArrayOutputStream(8192);
        try {
            final ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(bodyExpr);
            oos.writeObject(bindingVar);
            oos.flush();
        } catch (IOException e) {
            LOG.error(e.getMessage(), e);
            throw new IllegalStateException(e);
        }
        return bos.toByteArray();
View Full Code Here

Examples of java.io.ObjectOutputStream

public class SerializationTest extends TestCase {

    public void test1() throws IOException, ClassNotFoundException {
        FastByteArrayOutputStream f = new FastByteArrayOutputStream();

        ObjectOutputStream out = new ObjectOutputStream(f);
        Student student1 = new Student("Chris", "Giroir", "111111", "elkfjwe", "wifjew");
        out.writeObject(student1);
        out.writeInt(5);
        out.close();

        out = new NoHeaderObjectOutputStream(f);
        Student student2 = new Student("Chris2", "Giroir2", "elkfjwe", "111111");
        out.writeObject(student2);
        out.close();

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

        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        ObjectInputStream oin = new ObjectInputStream(in);
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.