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

JCGO_NOSEP_INLINE void CFASTCALL
java_io_BufferedInputStream__void( java_io_BufferedInputStream This
 )
{
 JCGO_FIELD_NZACCESS(This, markpos)= (-(jint)1);
}

JCGO_NOSEP_STATIC java_io_BufferedInputStream CFASTCALL
java_io_BufferedInputStream__this__L0gpraI( java_io_BufferedInputStream
 This, java_io_InputStream in, jint size )
{
 {
  (java_io_FilterInputStream__this__L0gpra((java_io_FilterInputStream)This,
   in));
  java_io_BufferedInputStream__void(This);
  if (size <= 0)
  {
   JCGO_THROW_EXC(java_lang_IllegalArgumentException__new__());
  }
  if (in != jnull)
  {
   JCGO_FIELD_NZACCESS(This, buf)= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
    0, size);
   JCGO_FIELD_NZACCESS(This, pos)= JCGO_FIELD_NZACCESS(This, count)=
    size;
  }
  JCGO_FIELD_NZACCESS(This, bufferSize)= size;
 }
 return This;
}

JCGO_NOSEP_INLINE java_io_BufferedInputStream CFASTCALL
java_io_BufferedInputStream__this__L0gpra( java_io_BufferedInputStream
 This, java_io_InputStream in )
{
 {
  (java_io_BufferedInputStream__this__L0gpraI((java_io_BufferedInputStream)This,
   in, java_io_BufferedInputStream__DEFAULT_BUFFER_SIZE));
 }
 return This;
}

JCGO_NOSEP_FRWINL java_io_BufferedInputStream CFASTCALL
java_io_BufferedInputStream__new__L0gpra( java_io_InputStream in )
{
 return java_io_BufferedInputStream__this__L0gpra(
  (java_io_BufferedInputStream)jcgo_newObject((jvtable)&java_io_BufferedInputStream_methods),
  in);
}

JCGO_NOSEP_STATIC jint CFASTCALL
java_io_BufferedInputStream__available__( java_io_BufferedInputStream
 This )
{
 JCGO_SYNC_BLOCKSAFENZ(This)
 {
  jint jcgo_rcvrI1;
  if (JCGO_FIELD_NZACCESS(This, buf) == jnull)
  {
   JCGO_THROW_EXC((java_io_IOException__new__Ls(
    JCGO_STRREF_OF(jcgo_string4_PrntStrm))));
  }
  {
   jint jcgo_retval= (jcgo_rcvrI1= JCGO_FIELD_NZACCESS(This, count) -
    JCGO_FIELD_NZACCESS(This, pos), jcgo_rcvrI1 + (java_io_FilterInputStream__available__(
    (java_io_FilterInputStream)This)));
#ifndef JCGO_SEHTRY
   JCGO_SYNC_JUMPLEAVE(0);
#endif
   return jcgo_retval;
  }
 }
 JCGO_SYNC_ENDUNREACH
}

JCGO_NOSEP_STATIC void CFASTCALL
java_io_BufferedInputStream__close__( java_io_BufferedInputStream
 This )
{
 {
  if (JCGO_FIELD_NZACCESS(This, buf) != jnull)
  {
   JCGO_FIELD_NZACCESS(This, buf)= (jbyteArr)jnull;
   JCGO_FIELD_NZACCESS(This, pos)= JCGO_FIELD_NZACCESS(This, count)=
    0;
   JCGO_FIELD_NZACCESS(This, markpos)= (-(jint)1);
   (java_io_FilterInputStream__close__(
    (java_io_FilterInputStream)This));
  }
 }
}

JCGO_NOSEP_STATIC jint CFASTCALL
java_io_BufferedInputStream__read__( java_io_BufferedInputStream This
 )
{
 JCGO_SYNC_BLOCKSAFENZ(This)
 {
  jObject jcgo_rcvrL1;
  if (JCGO_FIELD_NZACCESS(This, pos) >= JCGO_FIELD_NZACCESS(This, count) &&
   !(java_io_BufferedInputStream__refill__(
   This)))
  {
#ifndef JCGO_SEHTRY
   JCGO_SYNC_JUMPLEAVE(0);
#endif
   return (-(jint)1);
  }
  {
   jint jcgo_retval= (jint)((unsigned char)(jcgo_rcvrL1= (jObject)JCGO_FIELD_NZACCESS(This,
    buf), JCGO_ARRAY_BACCESS((jbyteArr)jcgo_rcvrL1, JCGO_FIELD_NZACCESS(This,
    pos)++)));
#ifndef JCGO_SEHTRY
   JCGO_SYNC_JUMPLEAVE(0);
#endif
   return jcgo_retval;
  }
 }
 JCGO_SYNC_ENDUNREACH
}

JCGO_NOSEP_STATIC jint CFASTCALL
java_io_BufferedInputStream__read__BAII( java_io_BufferedInputStream
 This, jbyteArr b, jint off, jint len )
{
 JCGO_SYNC_BLOCKSAFENZ(This)
 {
  jint totalBytesRead;
  if (off < 0 || len < 0 || JCGO_ARRAY_LENGTH(b) - off < len)
  {
   JCGO_THROW_EXC(java_lang_IndexOutOfBoundsException__new__());
  }
  if (len == 0)
  {
#ifndef JCGO_SEHTRY
   JCGO_SYNC_JUMPLEAVE(0);
#endif
   return 0;
  }
  if (JCGO_FIELD_NZACCESS(This, pos) >= JCGO_FIELD_NZACCESS(This, count) &&
   !(java_io_BufferedInputStream__refill__(
   This)))
  {
#ifndef JCGO_SEHTRY
   JCGO_SYNC_JUMPLEAVE(0);
#endif
   return (-(jint)1);
  }
  totalBytesRead= (java_lang_Math__min__II(
   JCGO_FIELD_NZACCESS(This, count) - JCGO_FIELD_NZACCESS(This, pos),
   len));
  (java_lang_System__arraycopy__LoILoII(
   (java_lang_Object)JCGO_FIELD_NZACCESS(This, buf), (java_lang_Object)b,
   JCGO_FIELD_NZACCESS(This, pos), off, totalBytesRead));
  JCGO_FIELD_NZACCESS(This, pos)+= totalBytesRead;
  off+= totalBytesRead;
  len-= totalBytesRead;
  while (len > 0 && (java_io_FilterInputStream__available__(
   (java_io_FilterInputStream)This)) > 0 && (java_io_BufferedInputStream__refill__(
   This)))
  {
   jint remain;
   remain= (java_lang_Math__min__II(
    JCGO_FIELD_NZACCESS(This, count) - JCGO_FIELD_NZACCESS(This, pos),
    len));
   (java_lang_System__arraycopy__LoILoII(
    (java_lang_Object)JCGO_FIELD_NZACCESS(This, buf), (java_lang_Object)b,
    JCGO_FIELD_NZACCESS(This, pos), off, remain));
   JCGO_FIELD_NZACCESS(This, pos)+= remain;
   off+= remain;
   len-= remain;
   totalBytesRead+= remain;
  }
#ifndef JCGO_SEHTRY
  JCGO_SYNC_JUMPLEAVE(0);
#endif
  return totalBytesRead;
 }
 JCGO_SYNC_ENDUNREACH
}

JCGO_NOSEP_STATIC jboolean CFASTCALL
java_io_BufferedInputStream__refill__( java_io_BufferedInputStream
 This )
{
 {
  jint numread;
  if (JCGO_FIELD_NZACCESS(This, buf) == jnull)
  {
   JCGO_THROW_EXC((java_io_IOException__new__Ls(
    JCGO_STRREF_OF(jcgo_string4_PrntStrm))));
  }
  if (JCGO_FIELD_NZACCESS(This, markpos) == (-(jint)1) || JCGO_FIELD_NZACCESS(This,
   count) - JCGO_FIELD_NZACCESS(This, markpos) >= (jint)0)
  {
   JCGO_FIELD_NZACCESS(This, markpos)= (-(jint)1);
   JCGO_FIELD_NZACCESS(This, pos)= JCGO_FIELD_NZACCESS(This, count)=
    0;
  }
  else
  {
   jbyteArr newbuf;
   newbuf= JCGO_FIELD_NZACCESS(This, buf);
   if (JCGO_FIELD_NZACCESS(This, markpos) < JCGO_FIELD_NZACCESS(This,
    bufferSize))
   {
    newbuf= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
     0, JCGO_FIELD_NZACCESS(This, count) - JCGO_FIELD_NZACCESS(This,
     markpos) + JCGO_FIELD_NZACCESS(This, bufferSize));
   }
   (java_lang_System__arraycopy__LoILoII(
    (java_lang_Object)JCGO_FIELD_NZACCESS(This, buf), (java_lang_Object)newbuf,
    JCGO_FIELD_NZACCESS(This, markpos), 0, JCGO_FIELD_NZACCESS(This,
    count) - JCGO_FIELD_NZACCESS(This, markpos)));
   JCGO_FIELD_NZACCESS(This, buf)= newbuf;
   JCGO_FIELD_NZACCESS(This, count)-= JCGO_FIELD_NZACCESS(This, markpos);
   JCGO_FIELD_NZACCESS(This, pos)-= JCGO_FIELD_NZACCESS(This, markpos);
   JCGO_FIELD_NZACCESS(This, markpos)= 0;
  }
  numread= (java_io_FilterInputStream__read__BAII(
   (java_io_FilterInputStream)This, JCGO_FIELD_NZACCESS(This, buf),
   JCGO_FIELD_NZACCESS(This, count), JCGO_FIELD_NZACCESS(This, bufferSize)));
  if (numread <= 0)
  {
   return (jboolean)jfalse;
  }
  JCGO_FIELD_NZACCESS(This, count)+= numread;
  return (jboolean)jtrue;
 }
}

JCGO_NOSEP_DATA CONST struct java_io_BufferedInputStream_methods_s
 java_io_BufferedInputStream_methods=
{
 JCGO_CLASSREF_OF(java_io_BufferedInputStream__class),
 JCGO_GCJDESCR_INIT(java_io_BufferedInputStream_s, buf)
 OBJT_java_io_BufferedInputStream,
 (JCGO_OBJSIZE_T)sizeof(struct java_io_BufferedInputStream_s),
 NULL,
 JCGO_CLINIT_INIT(0)
 0,
 java_lang_Object__equals__Lo,
 java_lang_Object__hashCode__,
 java_lang_Object__toString__,
 java_lang_Object__finalize__,
 java_io_BufferedInputStream__available__,
 java_io_BufferedInputStream__close__,
 java_io_BufferedInputStream__read__,
 java_io_BufferedInputStream__read__BAII
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_io_BufferedInputStream_class_s
 java_io_BufferedInputStream__class JCGO_THRD_ATTRNONGC=
{
 {
  &java_lang_Class_methods,
  JCGO_MON_INIT
  JCGO_OBJREF_OF(*(java_lang_Object)&java_io_BufferedInputStream_methods),
  JCGO_STRREF_OF(jcgo_string1_BffrInSt),
  JCGO_CLASSREF_OF(java_io_FilterInputStream__class),
  ((jObjectArr)JCGO_OBJREF_OF(jcgo_array3_Object)),
  0x1
 }
};

JCGO_NOSEP_DATA CONST jcgo_arrtype38_Object jcgo_array2_BffrInSt=
{
 (jvtable)&jbyteArr_methods,
 JCGO_MON_INIT
 27,
 {
  (jbyte)(jchar)106/*'j'*/, (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)118/*'v'*/,
   (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)46/*'.'*/, (jbyte)(jchar)105/*'i'*/,
   (jbyte)(jchar)111/*'o'*/, (jbyte)(jchar)46/*'.'*/, (jbyte)(jchar)66/*'B'*/,
   (jbyte)(jchar)117/*'u'*/, (jbyte)(jchar)102/*'f'*/, (jbyte)(jchar)102/*'f'*/,
   (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)114/*'r'*/, (jbyte)(jchar)101/*'e'*/,
   (jbyte)(jchar)100/*'d'*/, (jbyte)(jchar)73/*'I'*/, (jbyte)(jchar)110/*'n'*/,
   (jbyte)(jchar)112/*'p'*/, (jbyte)(jchar)117/*'u'*/, (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 JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string1_BffrInSt
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array2_BffrInSt),
 0, 27, (jint)0xc5ec1defL
};

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

#endif
