Package java.io

Examples of java.io.ByteArrayOutputStream.writeTo()


    if (key == -1) {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, " -> connection opened, initializes new connection");
      StreamUtil.writeTo(reconnectTimeout, baos);
      baos.writeTo(os);
      os.flush();

      int len = StreamUtil.readIntFrom(is);
      long dt = StreamUtil.readLongFrom(is);
      if (dt > clockSynchroThreshold)
View Full Code Here


      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, " -> init reliable connection");
    } else {
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG, " -> reinitializes connection " + identity + ',' + key);
      baos.writeTo(os);
      os.flush();

      int len = StreamUtil.readIntFrom(is);
      int res = StreamUtil.readIntFrom(is);
      if (logger.isLoggable(BasicLevel.DEBUG))
View Full Code Here

           
            if (getLogger().isLoggable(BasicLevel.DEBUG))
              getLogger().log(BasicLevel.DEBUG, "writeNotification - size=" + baos.size());

            writeInt(baos.size());
            baos.writeTo(this);
           
            flush();
           
            oos = null;
          } else {
View Full Code Here

      objectOutput.writeObject(object);
      objectOutput.flush();
      byteOutputStream.close();
      serializer.write(byteOutputStream.size());
      serializer.write(':');
      byteOutputStream.writeTo(serializer.getOutput());
    } catch (InvalidClassException e) {
      throw new IOException("Object not serializable: "+e.getMessage());
    } catch (NotSerializableException e) {
      throw new IOException("Object not serializable: "+e.getMessage());
    }
View Full Code Here

          File dir = file.getParentFile();
          if (!dir.exists()) {
            dir.mkdirs();
          }
          fileoutput = new FileOutputStream(file);
          output.writeTo(fileoutput);
        } catch (IOException e) {
        } finally {
          if (fileoutput != null) {
            try {
              fileoutput.close();
View Full Code Here

            // FlatDecode is compatible with the java.util.zip.Deflater class
            os.write("/Filter /FlateDecode\n".getBytes());
            os.write("/Length ".getBytes());
            os.write(Integer.toString(b.size()+1).getBytes());
            os.write("\n>>\nstream\n".getBytes());
            b.writeTo(os);
            os.write("\n".getBytes());
        } else {
            // This is a non-deflated stream
            os.write("/Length ".getBytes());
            os.write(Integer.toString(buf.size()).getBytes());
View Full Code Here

   
    // The page has been generated without exception -> Send it to the user
    resp.set("Content-Type", "text/html; charset=" + SIMPLE_TAG_ENCODING);
    PrintStream pageStream = resp.getPrintStream();
    try {
      stream.writeTo(pageStream);
    }
    finally {
      pageStream.close();
    }
  }
View Full Code Here

                super(new ByteArrayOutputStream());
            }
            void resetOut(OutputStream newOut) throws IOException {
                ByteArrayOutputStream bout = (ByteArrayOutputStream)out;
                if (bout.size() > 0) {
                    bout.writeTo(newOut);
                }
                out = newOut;
            }

View Full Code Here

            super(new ByteArrayOutputStream());
        }
        void resetOut(OutputStream newOut) throws IOException {
            ByteArrayOutputStream bout = (ByteArrayOutputStream)out;
            if (bout.size() > 0) {
                bout.writeTo(newOut);
            }
            out = newOut;
        }

View Full Code Here

            super(new ByteArrayOutputStream());
        }
        public void resetOut(OutputStream newOut) throws IOException {
            ByteArrayOutputStream bout = (ByteArrayOutputStream)out;
            if (bout.size() > 0) {
                bout.writeTo(newOut);
            }
            out = newOut;
        }
    }
}
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.