/* 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_ClientStream
#include "jcgobchk.h"
#endif

JCGO_NOSEP_INLINE package_ClientStream CFASTCALL
package_ClientStream__this__L2fa3xL7rjha( package_ClientStream This,
 java_net_Socket socket, package_GameShell applet )
{
 {
  (package_Packet__this__((package_Packet)This));
  JCGO_FIELD_NZACCESS(This, closing)= (jboolean)jfalse;
  JCGO_FIELD_NZACCESS(This, closed)= (jboolean)jtrue;
  JCGO_FIELD_NZACCESS(This, socket)= socket;
  JCGO_FIELD_NZACCESS(This, instream)= (JCGO_CALL_FINALF(socket) java_net_Socket__getInputStream__(
   socket));
  JCGO_FIELD_NZACCESS(This, outstream)= (java_net_Socket__getOutputStream__(
   socket));
  JCGO_FIELD_NZACCESS(This, closed)= (jboolean)jfalse;
  (JCGO_CALL_VFUNC(applet)->startThread__L1k0ty(
   applet, (java_lang_Runnable)This));
 }
 return This;
}

JCGO_NOSEP_FRWINL package_ClientStream CFASTCALL
package_ClientStream__new__L2fa3xL7rjha( java_net_Socket socket, package_GameShell
 applet )
{
 JCGO_CLINIT_TRIG(package_ClientStream__class);
 return package_ClientStream__this__L2fa3xL7rjha(
  (package_ClientStream)jcgo_newObject((jvtable)&package_ClientStream_methods),
  socket, applet);
}

JCGO_NOSEP_STATIC void CFASTCALL
package_ClientStream__closeStream__( package_ClientStream This )
{
 {
  (package_Packet__closeStream__(
   (package_Packet)This));
  JCGO_FIELD_NZACCESS(This, closing)= (jboolean)jtrue;
  {
   JCGO_TRY_BLOCK
   {
    if (JCGO_FIELD_NZACCESS(This, instream) != jnull)
    {
     jObject jcgo_rcvrL1;
     (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, instream), JCGO_CALL_VFUNC((java_io_InputStream)jcgo_rcvrL1)->close__(
      (java_io_InputStream)jcgo_rcvrL1));
    }
    if (JCGO_FIELD_NZACCESS(This, outstream) != jnull)
    {
     jObject jcgo_rcvrL1;
     (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, outstream), JCGO_CALL_VFUNC((java_io_OutputStream)jcgo_rcvrL1)->close__(
      (java_io_OutputStream)jcgo_rcvrL1));
    }
    if (JCGO_FIELD_NZACCESS(This, socket) != jnull)
    {
     jObject jcgo_rcvrL1;
     (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, socket), JCGO_CALL_FINALF((java_net_Socket)jcgo_rcvrL1)
      java_net_Socket__close__(
      (java_net_Socket)jcgo_rcvrL1));
    }
   }
   JCGO_TRY_LEAVE
   JCGO_TRY_CATCHES(1)
   JCGO_TRY_CATCH(OBJT_java_io_IOException, MAXT_java_io_IOException)
   {
    (java_io_PrintStream__println__Ls(
     JCGO_CLINIT_VARACC(java_lang_System__class, java_lang_System__out),
     JCGO_STRREF_OF(jcgo_string2_ClntStrm)));
   }
   JCGO_TRY_RETHROW(1)
  }
  JCGO_FIELD_NZACCESS(This, closed)= (jboolean)jtrue;
  {
   JCGO_SYNC_BLOCKSAFENZ(This)
   {
    (java_lang_Object__notify__(
     (java_lang_Object)This));
   }
   JCGO_SYNC_END
  }
  JCGO_FIELD_NZACCESS(This, buffer)= (jbyteArr)jnull;
 }
}

JCGO_NOSEP_STATIC jint CFASTCALL
package_ClientStream__readStream__( package_ClientStream This )
{
 {
  if (JCGO_FIELD_NZACCESS(This, closing))
  {
   return 0;
  }
  else
  {
   jObject jcgo_rcvrL1;
   return (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, instream),
    JCGO_CALL_VFUNC((java_io_InputStream)jcgo_rcvrL1)->read__(
    (java_io_InputStream)jcgo_rcvrL1));
  }
 }
}

JCGO_NOSEP_STATIC jint CFASTCALL
package_ClientStream__availableStream__( package_ClientStream This
 )
{
 {
  if (JCGO_FIELD_NZACCESS(This, closing))
  {
   return 0;
  }
  else
  {
   jObject jcgo_rcvrL1;
   return (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, instream),
    JCGO_CALL_VFUNC((java_io_InputStream)jcgo_rcvrL1)->available__(
    (java_io_InputStream)jcgo_rcvrL1));
  }
 }
}

JCGO_NOSEP_STATIC void CFASTCALL
package_ClientStream__readStreamBytes__IIBA( package_ClientStream
 This, jbyteArr buff, jint len, jint off )
{
 {
  jint k;
  jint l;
  jboolean flag;
  if (JCGO_FIELD_NZACCESS(This, closing))
  {
   return;
  }
  k= 0;
  flag= jfalse;
  for (; k < len; k+= l)
  {
   jObject jcgo_rcvrL1;
   if ((l= (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, instream),
    JCGO_CALL_VFUNC((java_io_InputStream)jcgo_rcvrL1)->read__BAII(
    (java_io_InputStream)jcgo_rcvrL1, buff, k + off, len - k))) <=
    0)
   {
    JCGO_THROW_EXC((java_io_IOException__new__Ls(
     JCGO_STRREF_OF(jcgo_string3_ClntStrm))));
   }
  }
 }
}

JCGO_NOSEP_STATIC void CFASTCALL
package_ClientStream__writeStreamBytes__BAII( package_ClientStream
 This, jbyteArr buff, jint off, jint len )
{
 {
  if (JCGO_FIELD_NZACCESS(This, closing))
  {
   return;
  }
  if (JCGO_FIELD_NZACCESS(This, buffer) == jnull)
  {
   JCGO_FIELD_NZACCESS(This, buffer)= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
    0, (jint)5000);
  }
  {
   JCGO_SYNC_BLOCKSAFENZ(This)
   {
    {
     jint l;
     l= 0;
     for (; l < len; l++)
     {
      jbyte jcgo_rcvrB1;
      (jcgo_rcvrB1= JCGO_ARRAY_BACCESS(buff, l + off), JCGO_ARRAY_BACCESS(JCGO_FIELD_NZACCESS(This,
       buffer), JCGO_FIELD_NZACCESS(This, offset))= jcgo_rcvrB1);
      JCGO_FIELD_NZACCESS(This, offset)= (JCGO_FIELD_NZACCESS(This,
       offset) + (jint)1) % (jint)5000;
      if (JCGO_FIELD_NZACCESS(This, offset) == (JCGO_FIELD_NZACCESS(This,
       endoffset) + (jint)4900) % (jint)5000)
      {
       JCGO_THROW_EXC((java_io_IOException__new__Ls(
        JCGO_STRREF_OF(jcgo_string4_ClntStrm))));
      }
     }
    }
    (java_lang_Object__notify__(
     (java_lang_Object)This));
   }
   JCGO_SYNC_END
  }
 }
}

JCGO_NOSEP_STATIC void CFASTCALL
package_ClientStream__run__( package_ClientStream This )
{
 {
  while (!JCGO_FIELD_NZACCESS(This, closed))
  {
   jint len;
   jint off;
   {
    JCGO_SYNC_BLOCKSAFENZ(This)
    {
     if (JCGO_FIELD_NZACCESS(This, offset) == JCGO_FIELD_NZACCESS(This,
      endoffset))
     {
      {
       JCGO_TRY_BLOCK
       {
        (java_lang_Object__wait__(
         (java_lang_Object)This));
       }
       JCGO_TRY_LEAVE
       JCGO_TRY_CATCHES(1)
       JCGO_TRY_CATCH(OBJT_java_lang_InterruptedException, MAXT_java_lang_InterruptedException)
       {
       }
       JCGO_TRY_RETHROW(1)
      }
     }
     if (JCGO_FIELD_NZACCESS(This, closed))
     {
#ifndef JCGO_SEHTRY
      JCGO_SYNC_JUMPLEAVE(0);
#endif
      return;
     }
     off= JCGO_FIELD_NZACCESS(This, endoffset);
     if (JCGO_FIELD_NZACCESS(This, offset) >= JCGO_FIELD_NZACCESS(This,
      endoffset))
     {
      len= JCGO_FIELD_NZACCESS(This, offset) - JCGO_FIELD_NZACCESS(This,
       endoffset);
     }
     else
     {
      len= (jint)5000 - JCGO_FIELD_NZACCESS(This, endoffset);
     }
    }
    JCGO_SYNC_END
   }
   if (len > 0)
   {
    {
     JCGO_TRY_BLOCK
     {
      jObject jcgo_rcvrL1;
      (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, outstream),
       JCGO_CALL_VFUNC((java_io_OutputStream)jcgo_rcvrL1)->write__BAII(
       (java_io_OutputStream)jcgo_rcvrL1, JCGO_FIELD_NZACCESS(This,
       buffer), off, len));
     }
     JCGO_TRY_LEAVE
     JCGO_TRY_CATCHES(2)
     JCGO_TRY_CATCH(OBJT_java_io_IOException, MAXT_java_io_IOException)
     {
      java_io_IOException ioexception;
      ioexception= (java_io_IOException)JCGO_TRY_THROWABLE(0);
      JCGO_FIELD_NZACCESS(This, socketException)= (jboolean)jtrue;
      JCGO_FIELD_NZACCESS(This, socketExceptionMessage)= java_lang_VMSystem__concat0X__LsLs(
       JCGO_STRREF_OF(jcgo_string5_ClntStrm), (java_lang_Throwable__toString__(
       (java_lang_Throwable)ioexception)));
     }
     JCGO_TRY_RETHROW(2)
    }
    JCGO_FIELD_NZACCESS(This, endoffset)= (JCGO_FIELD_NZACCESS(This,
     endoffset) + len) % (jint)5000;
    {
     JCGO_TRY_BLOCK
     {
      if (JCGO_FIELD_NZACCESS(This, offset) == JCGO_FIELD_NZACCESS(This,
       endoffset))
      {
       jObject jcgo_rcvrL1;
       (jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This, outstream),
        JCGO_CALL_VFUNC((java_io_OutputStream)jcgo_rcvrL1)->flush__(
        (java_io_OutputStream)jcgo_rcvrL1));
      }
     }
     JCGO_TRY_LEAVE
     JCGO_TRY_CATCHES(3)
     JCGO_TRY_CATCH(OBJT_java_io_IOException, MAXT_java_io_IOException)
     {
      java_io_IOException ioexception1;
      ioexception1= (java_io_IOException)JCGO_TRY_THROWABLE(0);
      JCGO_FIELD_NZACCESS(This, socketException)= (jboolean)jtrue;
      JCGO_FIELD_NZACCESS(This, socketExceptionMessage)= java_lang_VMSystem__concat0X__LsLs(
       JCGO_STRREF_OF(jcgo_string5_ClntStrm), (java_lang_Throwable__toString__(
       (java_lang_Throwable)ioexception1)));
     }
     JCGO_TRY_RETHROW(3)
    }
   }
  }
 }
}

JCGO_NOSEP_STATIC void CFASTCALL
package_ClientStream__class__0( void )
{
 JCGO_CLINIT_BEGIN(package_ClientStream__class);
 JCGO_CLINIT_TRIG(package_Packet__class);
 JCGO_CLINIT_DONE(package_ClientStream__class);
}

JCGO_NOSEP_DATA CONST struct package_ClientStream_methods_s package_ClientStream_methods=
{
 JCGO_CLASSREF_OF(package_ClientStream__class),
 JCGO_GCJDESCR_INIT(package_ClientStream_s, buffer)
 OBJT_package_ClientStream,
 (JCGO_OBJSIZE_T)sizeof(struct package_ClientStream_s),
 NULL,
 JCGO_CLINIT_INIT(package_ClientStream__class__0)
 0,
 java_lang_Object__equals__Lo,
 java_lang_Object__hashCode__,
 java_lang_Object__toString__,
 java_lang_Object__finalize__,
 package_ClientStream__run__,
 package_ClientStream__availableStream__,
 package_ClientStream__readStreamBytes__IIBA,
 package_ClientStream__writeStreamBytes__BAII,
 package_ClientStream__readStream__
};

JCGO_NOSEP_DATA struct package_ClientStream_class_s package_ClientStream__class
 ATTRIBNONGC=
{
 {
  &java_lang_Class_methods,
  JCGO_MON_INIT
  JCGO_OBJREF_OF(*(java_lang_Object)&package_ClientStream_methods),
  JCGO_STRREF_OF(jcgo_string1_ClntStrm),
  JCGO_CLASSREF_OF(package_Packet__class),
  ((jObjectArr)JCGO_OBJREF_OF(jcgo_array27_GameShll)),
  0xc1
 }
};

JCGO_NOSEP_DATA CONST jcgo_arrtype26_Object jcgo_array6_ClntStrm=
{
 (jvtable)&jbyteArr_methods,
 JCGO_MON_INIT
 12,
 {
  (jbyte)(jchar)67/*'C'*/, (jbyte)(jchar)108/*'l'*/, (jbyte)(jchar)105/*'i'*/,
   (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)110/*'n'*/, (jbyte)(jchar)116/*'t'*/,
   (jbyte)(jchar)83/*'S'*/, (jbyte)(jchar)116/*'t'*/, (jbyte)(jchar)114/*'r'*/,
   (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)109/*'m'*/
 }
};

JCGO_NOSEP_DATA CONST jcgo_arrtype23_Object jcgo_array7_ClntStrm=
{
 (jvtable)&jbyteArr_methods,
 JCGO_MON_INIT
 20,
 {
  (jbyte)(jchar)69/*'E'*/, (jbyte)(jchar)114/*'r'*/, (jbyte)(jchar)114/*'r'*/,
   (jbyte)(jchar)111/*'o'*/, (jbyte)(jchar)114/*'r'*/, (jbyte)(jchar)32/*' '*/,
   (jbyte)(jchar)99/*'c'*/, (jbyte)(jchar)108/*'l'*/, (jbyte)(jchar)111/*'o'*/,
   (jbyte)(jchar)115/*'s'*/, (jbyte)(jchar)105/*'i'*/, (jbyte)(jchar)110/*'n'*/,
   (jbyte)(jchar)103/*'g'*/, (jbyte)(jchar)32/*' '*/, (jbyte)(jchar)115/*'s'*/,
   (jbyte)(jchar)116/*'t'*/, (jbyte)(jchar)114/*'r'*/, (jbyte)(jchar)101/*'e'*/,
   (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)109/*'m'*/
 }
};

JCGO_NOSEP_DATA CONST jcgo_arrtype43_GameShll jcgo_array8_ClntStrm=
{
 (jvtable)&jbyteArr_methods,
 JCGO_MON_INIT
 15,
 {
  (jbyte)(jchar)98/*'b'*/, (jbyte)(jchar)117/*'u'*/, (jbyte)(jchar)102/*'f'*/,
   (jbyte)(jchar)102/*'f'*/, (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)114/*'r'*/,
   (jbyte)(jchar)32/*' '*/, (jbyte)(jchar)111/*'o'*/, (jbyte)(jchar)118/*'v'*/,
   (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)114/*'r'*/, (jbyte)(jchar)102/*'f'*/,
   (jbyte)(jchar)108/*'l'*/, (jbyte)(jchar)111/*'o'*/, (jbyte)(jchar)119/*'w'*/
 }
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string1_ClntStrm
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array6_ClntStrm),
 0, 12, (jint)0xb4673f4bL
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string2_ClntStrm
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array7_ClntStrm),
 0, 20, (jint)0x8109ee83L
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string3_ClntStrm
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array2_EOFExcpt),
 8, 3, (jint)0x10cdcL
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string4_ClntStrm
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array8_ClntStrm),
 0, 15, (jint)0xe866c7e2L
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string5_ClntStrm
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array10_FlPrmssn),
 0, 8, (jint)0x756ea353L
};

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

#endif
