Package java.io

Examples of java.io.ObjectOutputStream.reset()


            logger.error("Exception when creating writer sending object: " + object, e);
            return false;
        }

        try {
            writer.reset();
            writer.flush();
            writer.writeObject(object);
            writer.flush();

            return true;
View Full Code Here


                }
                DataOutputStream dataOut = new DataOutputStream(os);
                ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
                objOut.writeObject(object);
                objOut.flush();
                objOut.reset();
                objOut.close();
                setContent(bytesOut.toBuffer());
            } catch (IOException ioe) {
                throw new RuntimeException(ioe.getMessage(), ioe);
            }
View Full Code Here

      ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
      ObjectOutputStream oos = new ObjectOutputStream(bos);

      for (int i = 0; i < iters; i++) {
        oos.writeObject(o);
        oos.reset();
        b = bos.toByteArray();
        bos.reset();
      }
      System.out.println("(" + o.getClass().getName()
          + ") Serialization performance:  "
View Full Code Here

      ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
      ObjectOutputStream oos = new ObjectOutputStream(bos);

      for (int i = 0; i < iters; i++) {
        oos.writeObject(o);
        oos.reset();
        b = bos.toByteArray();
        bos.reset();
      }
      System.out.println("(" + o.getClass().getName()
          + ") Serialization performance:  "
View Full Code Here

        oos.flush();

        // Failing to reset the object output stream every now and
        // then creates a serious memory leak.
        // right now we always reset. TODO - set up frequency counter per oos?
        oos.reset();
      } catch (IOException e) {
        // there was an io exception so just drop the connection
        oosList.removeElementAt(streamCount);
        getLogger().debug("dropped connection");
View Full Code Here

        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            final ObjectOutputStream oos = new PrivateObjectOutputStream(baos);
            try {
                oos.writeObject(event);
                oos.reset();
            } finally {
                oos.close();
            }
        } catch (final IOException ioe) {
            LOGGER.error("Serialization of LogEvent failed.", ioe);
View Full Code Here

        oos.flush();
        // Failing to reset the object output stream every now and
        // then creates a serious memory leak.
        // right now we always reset. TODO - set up frequency counter
        // per oos?
        oos.reset();
      } catch (IOException e)
      {
        // there was an io exception so just drop the connection
        oosList.removeElementAt(streamCount);
        LogLog.debug("dropped connection");
View Full Code Here

        oos.writeObject(event);
        oos.flush();
      // Failing to reset the object output stream every now and
      // then creates a serious memory leak.
      // right now we always reset. TODO - set up frequency counter per oos?
      oos.reset();
      }
      catch(IOException e) {
        if (e instanceof InterruptedIOException) {
            Thread.currentThread().interrupt();
        }
View Full Code Here

                }
                DataOutputStream dataOut = new DataOutputStream(os);
                ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
                objOut.writeObject(object);
                objOut.flush();
                objOut.reset();
                objOut.close();
                setContent(bytesOut.toByteSequence());
            } catch (IOException ioe) {
                throw new RuntimeException(ioe.getMessage(), ioe);
            }
View Full Code Here

                }
                DataOutputStream dataOut = new DataOutputStream(os);
                ObjectOutputStream objOut = new ObjectOutputStream(dataOut);
                objOut.writeObject(object);
                objOut.flush();
                objOut.reset();
                objOut.close();
                setContent(bytesOut.toByteSequence());
            } catch (IOException ioe) {
                throw new RuntimeException(ioe.getMessage(), ioe);
            }
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.