src/share/vm/utilities/ostream.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7089790_full Sdiff src/share/vm/utilities

src/share/vm/utilities/ostream.cpp

Print this page
rev 2694 : imported patch headers_only
rev 2695 : shared changes


  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileLog.hpp"
  27 #include "oops/oop.inline.hpp"
  28 #include "runtime/arguments.hpp"
  29 #include "utilities/defaultStream.hpp"
  30 #include "utilities/ostream.hpp"
  31 #include "utilities/top.hpp"
  32 #include "utilities/xmlstream.hpp"
  33 #ifdef TARGET_OS_FAMILY_linux
  34 # include "os_linux.inline.hpp"
  35 #endif
  36 #ifdef TARGET_OS_FAMILY_solaris
  37 # include "os_solaris.inline.hpp"
  38 #endif
  39 #ifdef TARGET_OS_FAMILY_windows
  40 # include "os_windows.inline.hpp"
  41 #endif



  42 
  43 extern "C" void jio_print(const char* s); // Declarationtion of jvm method
  44 
  45 outputStream::outputStream(int width) {
  46   _width       = width;
  47   _position    = 0;
  48   _newlines    = 0;
  49   _precount    = 0;
  50   _indentation = 0;
  51 }
  52 
  53 outputStream::outputStream(int width, bool has_time_stamps) {
  54   _width       = width;
  55   _position    = 0;
  56   _newlines    = 0;
  57   _precount    = 0;
  58   _indentation = 0;
  59   if (has_time_stamps)  _stamp.update();
  60 }
  61 


 975   memcpy(buffer + buffer_pos, s, len);
 976   buffer_pos += len;
 977   update_position(s, len);
 978 }
 979 
 980 char* bufferedStream::as_string() {
 981   char* copy = NEW_RESOURCE_ARRAY(char, buffer_pos+1);
 982   strncpy(copy, buffer, buffer_pos);
 983   copy[buffer_pos] = 0;  // terminating null
 984   return copy;
 985 }
 986 
 987 bufferedStream::~bufferedStream() {
 988   if (!buffer_fixed) {
 989     FREE_C_HEAP_ARRAY(char, buffer);
 990   }
 991 }
 992 
 993 #ifndef PRODUCT
 994 
 995 #if defined(SOLARIS) || defined(LINUX)
 996 #include <sys/types.h>
 997 #include <sys/socket.h>
 998 #include <netinet/in.h>
 999 #include <arpa/inet.h>
1000 #endif
1001 
1002 // Network access
1003 networkStream::networkStream() : bufferedStream(1024*10, 1024*10) {
1004 
1005   _socket = -1;
1006 
1007   int result = os::socket(AF_INET, SOCK_STREAM, 0);
1008   if (result <= 0) {
1009     assert(false, "Socket could not be created!");
1010   } else {
1011     _socket = result;
1012   }
1013 }
1014 
1015 int networkStream::read(char *buf, size_t len) {




  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "compiler/compileLog.hpp"
  27 #include "oops/oop.inline.hpp"
  28 #include "runtime/arguments.hpp"
  29 #include "utilities/defaultStream.hpp"
  30 #include "utilities/ostream.hpp"
  31 #include "utilities/top.hpp"
  32 #include "utilities/xmlstream.hpp"
  33 #ifdef TARGET_OS_FAMILY_linux
  34 # include "os_linux.inline.hpp"
  35 #endif
  36 #ifdef TARGET_OS_FAMILY_solaris
  37 # include "os_solaris.inline.hpp"
  38 #endif
  39 #ifdef TARGET_OS_FAMILY_windows
  40 # include "os_windows.inline.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_bsd
  43 # include "os_bsd.inline.hpp"
  44 #endif
  45 
  46 extern "C" void jio_print(const char* s); // Declarationtion of jvm method
  47 
  48 outputStream::outputStream(int width) {
  49   _width       = width;
  50   _position    = 0;
  51   _newlines    = 0;
  52   _precount    = 0;
  53   _indentation = 0;
  54 }
  55 
  56 outputStream::outputStream(int width, bool has_time_stamps) {
  57   _width       = width;
  58   _position    = 0;
  59   _newlines    = 0;
  60   _precount    = 0;
  61   _indentation = 0;
  62   if (has_time_stamps)  _stamp.update();
  63 }
  64 


 978   memcpy(buffer + buffer_pos, s, len);
 979   buffer_pos += len;
 980   update_position(s, len);
 981 }
 982 
 983 char* bufferedStream::as_string() {
 984   char* copy = NEW_RESOURCE_ARRAY(char, buffer_pos+1);
 985   strncpy(copy, buffer, buffer_pos);
 986   copy[buffer_pos] = 0;  // terminating null
 987   return copy;
 988 }
 989 
 990 bufferedStream::~bufferedStream() {
 991   if (!buffer_fixed) {
 992     FREE_C_HEAP_ARRAY(char, buffer);
 993   }
 994 }
 995 
 996 #ifndef PRODUCT
 997 
 998 #if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
 999 #include <sys/types.h>
1000 #include <sys/socket.h>
1001 #include <netinet/in.h>
1002 #include <arpa/inet.h>
1003 #endif
1004 
1005 // Network access
1006 networkStream::networkStream() : bufferedStream(1024*10, 1024*10) {
1007 
1008   _socket = -1;
1009 
1010   int result = os::socket(AF_INET, SOCK_STREAM, 0);
1011   if (result <= 0) {
1012     assert(false, "Socket could not be created!");
1013   } else {
1014     _socket = result;
1015   }
1016 }
1017 
1018 int networkStream::read(char *buf, size_t len) {


src/share/vm/utilities/ostream.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File