/* DO NOT EDIT THIS FILE - it is machine generated (JCGO_116) */

#ifdef JCGO_SEPARATED
#define JCGO_116
#include "jcgortl.h"
#include "Main.h"
#endif

#ifdef JCGO_116

#ifdef CHKALL_java_io_ByteArrayOutputStream
#include "jcgobchk.h"
#endif

JCGO_NOSEP_INLINE java_io_ByteArrayOutputStream CFASTCALL
java_io_ByteArrayOutputStream__this__I( java_io_ByteArrayOutputStream
 This, jint size )
{
 {
  (java_io_OutputStream__this__((java_io_OutputStream)This));
  JCGO_FIELD_NZACCESS(This, buf)= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
   0, size);
  JCGO_FIELD_NZACCESS(This, count)= 0;
 }
 return This;
}

JCGO_NOSEP_INLINE void CFASTCALL
java_io_ByteArrayOutputStream__resize__I( java_io_ByteArrayOutputStream
 This, jint add )
{
 {
  if (JCGO_FIELD_NZACCESS(This, count) + add > JCGO_ARRAY_LENGTH(JCGO_FIELD_NZACCESS(This,
   buf)))
  {
   jbyteArr newbuf;
   jint newlen;
   newlen= JCGO_ARRAY_LENGTH(JCGO_FIELD_NZACCESS(This, buf)) * (jint)2;
   if (JCGO_FIELD_NZACCESS(This, count) + add > newlen)
   {
    newlen= JCGO_FIELD_NZACCESS(This, count) + add;
   }
   newbuf= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
    0, newlen);
   (java_lang_System__arraycopy__LoILoII(
    (java_lang_Object)JCGO_FIELD_NZACCESS(This, buf), (java_lang_Object)newbuf,
    0, 0, JCGO_FIELD_NZACCESS(This, count)));
   JCGO_FIELD_NZACCESS(This, buf)= newbuf;
  }
 }
}

JCGO_NOSEP_INLINE java_io_ByteArrayOutputStream CFASTCALL
java_io_ByteArrayOutputStream__this__( java_io_ByteArrayOutputStream
 This )
{
 {
  (java_io_ByteArrayOutputStream__this__I((java_io_ByteArrayOutputStream)This,
   java_io_ByteArrayOutputStream__initial_buffer_size));
 }
 return This;
}

JCGO_NOSEP_INLINE java_io_ByteArrayOutputStream CFASTCALL
java_io_ByteArrayOutputStream__new__( void )
{
 JCGO_CLINIT_TRIG(java_io_ByteArrayOutputStream__class);
 return java_io_ByteArrayOutputStream__this__(
  (java_io_ByteArrayOutputStream)jcgo_newObject((jvtable)&java_io_ByteArrayOutputStream_methods));
}

JCGO_NOSEP_INLINE jbyteArr CFASTCALL
java_io_ByteArrayOutputStream__toByteArray__( java_io_ByteArrayOutputStream
 This )
{
 JCGO_SYNC_BLOCKSAFENZ(This)
 {
  jbyteArr ret;
  ret= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte), 0, JCGO_FIELD_NZACCESS(This,
   count));
  (java_lang_System__arraycopy__LoILoII(
   (java_lang_Object)JCGO_FIELD_NZACCESS(This, buf), (java_lang_Object)ret,
   0, 0, JCGO_FIELD_NZACCESS(This, count)));
#ifndef JCGO_SEHTRY
  JCGO_SYNC_JUMPLEAVE(0);
#endif
  return ret;
 }
 JCGO_SYNC_ENDUNREACH
}

JCGO_NOSEP_INLINE java_lang_String CFASTCALL
java_io_ByteArrayOutputStream__toString__( java_io_ByteArrayOutputStream
 This )
{
 {
  return (java_lang_String__new__BAII(
   JCGO_FIELD_NZACCESS(This, buf), 0, JCGO_FIELD_NZACCESS(This, count)));
 }
}

JCGO_NOSEP_STATIC void CFASTCALL
java_io_ByteArrayOutputStream__write__BAII( java_io_ByteArrayOutputStream
 This, jbyteArr buffer, jint offset, jint add )
{
 JCGO_SYNC_BLOCKSAFENZ(This)
 {
  if (add >= 0)
  {
   (java_io_ByteArrayOutputStream__resize__I(
    This, add));
  }
  (java_lang_System__arraycopy__LoILoII(
   (java_lang_Object)buffer, (java_lang_Object)JCGO_FIELD_NZACCESS(This,
   buf), offset, JCGO_FIELD_NZACCESS(This, count), add));
  JCGO_FIELD_NZACCESS(This, count)+= add;
 }
 JCGO_SYNC_END
}

JCGO_NOSEP_STATIC void CFASTCALL
java_io_ByteArrayOutputStream__class__0( void )
{
 JCGO_CLINIT_BEGIN(java_io_ByteArrayOutputStream__class);
 {
  jint r;
  r= (java_lang_Integer__intValue__(
   (java_lang_Integer__getInteger__LsI(
   JCGO_STRREF_OF(jcgo_string2_BtArOtSt), java_io_ByteArrayOutputStream__DEFAULT_INITIAL_BUFFER_SIZE))));
  if (r <= 0)
  {
   r= java_io_ByteArrayOutputStream__DEFAULT_INITIAL_BUFFER_SIZE;
  }
  java_io_ByteArrayOutputStream__initial_buffer_size= r;
 }
 JCGO_CLINIT_DONE(java_io_ByteArrayOutputStream__class);
}

JCGO_NOSEP_DATA CONST struct java_io_ByteArrayOutputStream_methods_s
 java_io_ByteArrayOutputStream_methods=
{
 JCGO_CLASSREF_OF(java_io_ByteArrayOutputStream__class),
 JCGO_GCJDESCR_INIT(java_io_ByteArrayOutputStream_s, buf)
 OBJT_java_io_ByteArrayOutputStream,
 (JCGO_OBJSIZE_T)sizeof(struct java_io_ByteArrayOutputStream_s),
 NULL,
 JCGO_CLINIT_INIT(java_io_ByteArrayOutputStream__class__0)
 java_io_ByteArrayOutputStream__this__,
 java_lang_Object__equals__Lo,
 java_lang_Object__hashCode__,
 java_io_ByteArrayOutputStream__toString__,
 java_lang_Object__finalize__,
 java_io_ByteArrayOutputStream__write__BAII,
 (void (CFASTCALL*)(java_io_OutputStream))java_lang_Object__finalize__,
 (void (CFASTCALL*)(java_io_OutputStream))java_lang_Object__finalize__
};

JCGO_NOSEP_DATA struct java_io_ByteArrayOutputStream_class_s java_io_ByteArrayOutputStream__class
 ATTRIBNONGC=
{
 {
  &java_lang_Class_methods,
  JCGO_MON_INIT
  JCGO_OBJREF_OF(*(java_lang_Object)&java_io_ByteArrayOutputStream_methods),
  JCGO_STRREF_OF(jcgo_string1_BtArOtSt),
  JCGO_CLASSREF_OF(java_io_OutputStream__class),
  ((jObjectArr)JCGO_OBJREF_OF(jcgo_array3_Object)),
  0x1c1
 }
};

JCGO_NOSEP_DATA jint java_io_ByteArrayOutputStream__initial_buffer_size=
 (jint)0;

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string1_BtArOtSt
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array12_VMClass),
 4, 29, (jint)0xac524416L
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string2_BtArOtSt
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array12_VMClass),
 0, 51, (jint)0x199fd56dL
};

#ifdef CHKALL_java_io_ByteArrayOutputStream
#include "jcgochke.h"
#endif

#endif
