Class OpenFile

java.lang.Object
org.jruby.util.io.OpenFile
All Implemented Interfaces:
Finalizable

public class OpenFile extends Object implements Finalizable
  • Field Details

  • Constructor Details

  • Method Details

    • ascii8bitBinmode

      public void ascii8bitBinmode(Ruby runtime)
    • checkReopenSeek

      public void checkReopenSeek(ThreadContext context, Ruby runtime, long pos)
    • clearStdio

      public void clearStdio()
    • PREP_STDIO_NAME

      public String PREP_STDIO_NAME()
    • READ_DATA_PENDING

      public boolean READ_DATA_PENDING()
    • READ_DATA_PENDING_COUNT

      public int READ_DATA_PENDING_COUNT()
    • READ_DATA_PENDING_PTR

      public byte[] READ_DATA_PENDING_PTR()
    • READ_DATA_PENDING_OFF

      public int READ_DATA_PENDING_OFF()
    • READ_DATA_PENDING_START

      public int READ_DATA_PENDING_START()
    • READ_DATA_BUFFERED

      public boolean READ_DATA_BUFFERED()
    • READ_CHAR_PENDING

      public boolean READ_CHAR_PENDING()
    • READ_CHAR_PENDING_COUNT

      public int READ_CHAR_PENDING_COUNT()
    • READ_CHAR_PENDING_PTR

      public byte[] READ_CHAR_PENDING_PTR()
    • READ_CHAR_PENDING_OFF

      public int READ_CHAR_PENDING_OFF()
    • READ_CHAR_PENDING_START

      public int READ_CHAR_PENDING_START()
    • READ_CHECK

      public void READ_CHECK(ThreadContext context)
    • IS_PREP_STDIO

      public boolean IS_PREP_STDIO()
    • setFD

      public void setFD(ChannelFD fd)
    • setChannel

      public void setChannel(Channel fd)
    • getMode

      public int getMode()
    • getModeAsString

      @Deprecated public String getModeAsString(Ruby runtime)
      Deprecated.
    • getModeAsString

      public String getModeAsString(ThreadContext context)
    • getModeFlagsAsIntFrom

      public static int getModeFlagsAsIntFrom(int fmode)
    • ioOflagsModestr

      @Deprecated public static String ioOflagsModestr(Ruby runtime, int oflags)
      Deprecated.
    • ioOflagsModestr

      public static String ioOflagsModestr(ThreadContext context, int oflags)
    • ioModestrOflags

      @Deprecated public static int ioModestrOflags(Ruby runtime, String modestr)
      Deprecated.
    • ioModestrOflags

      public static int ioModestrOflags(ThreadContext context, String modestr)
    • ioFmodeOflags

      public static int ioFmodeOflags(int fmode)
    • ioModestrFmode

      @Deprecated public static int ioModestrFmode(Ruby runtime, String modestr)
      Deprecated.
    • ioModestrFmode

      public static int ioModestrFmode(ThreadContext context, String modestr)
    • getStringFromMode

      public static String getStringFromMode(int mode)
    • checkCharReadable

      public void checkCharReadable(ThreadContext context)
    • checkByteReadable

      public void checkByteReadable(ThreadContext context)
    • checkReadable

      public void checkReadable(ThreadContext context)
    • io_fflush

      public int io_fflush(ThreadContext context)
    • waitWritable

      public boolean waitWritable(ThreadContext context, long timeout)
    • waitWritable

      public boolean waitWritable(ThreadContext context)
    • waitReadable

      public boolean waitReadable(ThreadContext context, long timeout)
    • waitReadable

      public boolean waitReadable(ThreadContext context)
    • ready

      public boolean ready(Ruby runtime, RubyThread thread, int ops, long timeout)
      Wait until the channel is available for the given operations or the timeout expires.
      Parameters:
      runtime -
      ops -
      timeout -
      Returns:
      See Also:
    • readyNow

      public boolean readyNow(ThreadContext context)
      Like ready(org.jruby.Ruby, org.jruby.RubyThread, int, long) but returns a result immediately.
      Parameters:
      context -
      Returns:
    • flushBuffer

      public int flushBuffer()
    • flushBufferAsync2

      public int flushBufferAsync2()
    • seek

      public long seek(ThreadContext context, long offset, int whence)
    • checkWritable

      public void checkWritable(ThreadContext context)
    • checkClosed

      public void checkClosed()
    • isBinmode

      public boolean isBinmode()
    • isTextMode

      public boolean isTextMode()
    • setTextMode

      public void setTextMode()
    • clearTextMode

      public void clearTextMode()
    • setBinmode

      public void setBinmode()
    • isOpen

      public boolean isOpen()
    • isReadable

      public boolean isReadable()
    • isWritable

      public boolean isWritable()
    • isDuplex

      public boolean isDuplex()
    • isReadBuffered

      public boolean isReadBuffered()
    • isWriteBuffered

      public boolean isWriteBuffered()
    • setSync

      public void setSync(boolean sync)
    • isSync

      public boolean isSync()
    • setMode

      public void setMode(int modes)
    • getProcess

      public Process getProcess()
    • setProcess

      public void setProcess(Process process)
    • getPid

      public long getPid()
    • setPid

      public void setPid(long pid)
    • getLineNumber

      public int getLineNumber()
    • setLineNumber

      public void setLineNumber(int lineNumber)
    • getPath

      public String getPath()
    • setPath

      public void setPath(String path)
    • isAutoclose

      public boolean isAutoclose()
    • setAutoclose

      public void setAutoclose(boolean autoclose)
    • getFinalizer

      public OpenFile.Finalizer getFinalizer()
    • setFinalizer

      public void setFinalizer(OpenFile.Finalizer finalizer)
    • cleanup

      public void cleanup(Ruby runtime, boolean noraise)
    • finalize

      public void finalize()
      Specified by:
      finalize in interface Finalizable
      Overrides:
      finalize in class Object
    • finalize

      public void finalize(ThreadContext context, boolean noraise)
    • finalizeFlush

      public void finalizeFlush(ThreadContext context, boolean noraise)
    • needsReadConversion

      public boolean needsReadConversion()
    • needsWriteConversion

      public boolean needsWriteConversion(ThreadContext context)
    • makeReadConversion

      public void makeReadConversion(ThreadContext context, int size)
    • makeReadConversion

      public void makeReadConversion(ThreadContext context)
    • makeWriteConversion

      public void makeWriteConversion(ThreadContext context)
    • clearReadConversion

      public void clearReadConversion()
    • clearCodeConversion

      public void clearCodeConversion()
    • IO_RBUF_CAPA_FOR

      public int IO_RBUF_CAPA_FOR()
    • appendline

      public int appendline(ThreadContext context, int delim, ByteList[] strp, int[] lp, org.jcodings.Encoding enc)
    • NEED_NEWLINE_DECORATOR_ON_READ_CHECK

      public void NEED_NEWLINE_DECORATOR_ON_READ_CHECK()
    • NEED_NEWLINE_DECORATOR_ON_READ

      public boolean NEED_NEWLINE_DECORATOR_ON_READ()
    • NEED_NEWLINE_DECORATOR_ON_WRITE

      public boolean NEED_NEWLINE_DECORATOR_ON_WRITE()
    • moreChar

      public int moreChar(ThreadContext context)
    • readBufferedData

      public int readBufferedData(byte[] ptrBytes, int ptr, int len)
    • fillbuf

      public int fillbuf(ThreadContext context)
    • readInternal

      public static int readInternal(ThreadContext context, OpenFile fptr, ChannelFD fd, byte[] bufBytes, int buf, int count)
    • readInternal

      public static int readInternal(ThreadContext context, OpenFile fptr, ChannelFD fd, ByteBuffer buffer, int buf, int count)
    • preadInternal

      public static int preadInternal(ThreadContext context, OpenFile fptr, ChannelFD fd, ByteBuffer buffer, int from, int length)
    • pwriteInternal

      public static int pwriteInternal(ThreadContext context, OpenFile fptr, ChannelFD fd, ByteBuffer buffer, int from, int length)
    • readEncoding

      public org.jcodings.Encoding readEncoding(Ruby runtime)
    • inputEncoding

      public org.jcodings.Encoding inputEncoding(Ruby runtime)
    • swallow

      public boolean swallow(ThreadContext context, int term)
    • shiftCbuf

      public RubyString shiftCbuf(ThreadContext context, int len, IRubyObject strp)
    • shiftCbuf

      public RubyString shiftCbuf(int len, RubyString str)
    • getlineFast

      public IRubyObject getlineFast(ThreadContext context, org.jcodings.Encoding enc, RubyIO io, boolean chomp)
    • incrementLineno

      public void incrementLineno(Ruby runtime, RubyIO io)
    • incrementLineno

      @Deprecated public void incrementLineno(Ruby runtime)
      Deprecated.
    • readAll

      public IRubyObject readAll(ThreadContext context, int siz, IRubyObject str)
    • fread

      public int fread(ThreadContext context, byte[] buffer, int offset, int size)
    • ungetbyte

      public void ungetbyte(ThreadContext context, IRubyObject str)
    • getc

      public IRubyObject getc(ThreadContext context, org.jcodings.Encoding enc)
    • tell

      public long tell(ThreadContext context)
    • unread

      public void unread(ThreadContext context)
    • fwrite

      public long fwrite(ThreadContext context, RubyString str, boolean nosync)
    • fwrite

      public int fwrite(ThreadContext context, byte[] bytes, int start, int length, org.jcodings.Encoding encoding, boolean nosync)
    • rbW32WriteConsole

      public static long rbW32WriteConsole(RubyString buffer)
    • rbW32WriteConsole

      public static int rbW32WriteConsole(byte[] bytes, int start, int length, org.jcodings.Encoding encoding)
    • doWriteconv

      public RubyString doWriteconv(ThreadContext context, RubyString str)
    • getCommonEncodingForWriteConv

      protected org.jcodings.Encoding getCommonEncodingForWriteConv(ThreadContext context, org.jcodings.Encoding strEncoding)
    • doWriteconv

      public ByteList doWriteconv(ThreadContext context, byte[] bytes, int start, int length, org.jcodings.Encoding encoding)
    • binwriteInt

      public int binwriteInt(ThreadContext context, byte[] ptrBytes, int ptr, int len, boolean nosync)
    • writeInternal

      public static int writeInternal(ThreadContext context, OpenFile fptr, byte[] bufBytes, int buf, int count)
    • writeInternal

      public static int writeInternal(ThreadContext context, OpenFile fptr, ByteBuffer bufBytes, int buf, int count)
    • fd

      public ChannelFD fd()
    • channel

      public Channel channel()
    • readChannel

      public ReadableByteChannel readChannel()
    • writeChannel

      public WritableByteChannel writeChannel()
    • seekChannel

      public SeekableByteChannel seekChannel()
    • selectChannel

      public SelectableChannel selectChannel()
    • fileChannel

      public FileChannel fileChannel()
    • socketChannel

      public SocketChannel socketChannel()
    • setNonblock

      public void setNonblock(Ruby runtime)
    • setBlock

      public void setBlock(Ruby runtime)
    • setBlocking

      public void setBlocking(Ruby runtime, boolean blocking)
    • isBlocking

      public boolean isBlocking()
    • checkTTY

      public void checkTTY()
    • isBOM

      public boolean isBOM()
    • setBOM

      public void setBOM(boolean bom)
    • isStdio

      public boolean isStdio()
    • readPending

      public int readPending()
    • getFModeFromString

      @Deprecated public static int getFModeFromString(String modesString) throws InvalidValueException
      Deprecated.
      Throws:
      InvalidValueException
    • getFileno

      public int getFileno()
    • threadFlock

      public int threadFlock(ThreadContext context, int lockMode)
    • errno

      public jnr.constants.platform.Errno errno()
    • errno

      public void errno(jnr.constants.platform.Errno newErrno)
    • cloexecDup2

      public static int cloexecDup2(PosixShim posix, ChannelFD oldfd, ChannelFD newfd)
    • fdFixCloexec

      public static void fdFixCloexec(PosixShim posix, int fd)
    • addBlockingThread

      public void addBlockingThread(RubyThread thread)
      Add a thread to the list of blocking threads for this IO.
      Parameters:
      thread - A thread blocking on this IO
    • removeBlockingThread

      public void removeBlockingThread(RubyThread thread)
      Remove a thread from the list of blocking threads for this IO.
      Parameters:
      thread - A thread blocking on this IO
    • interruptBlockingThreads

      public void interruptBlockingThreads(ThreadContext context)
      Fire an IOError in all threads blocking on this IO object
    • waitForBlockingThreads

      public void waitForBlockingThreads(ThreadContext context)
      Wait until all blocking threads have exited their blocking area. Use in combination with interruptBlockingThreads to ensure every blocking thread has moved on before proceding to manipulate the IO.
    • SET_BINARY_MODE

      public void SET_BINARY_MODE()
    • remainSize

      public int remainSize()
    • lock

      public boolean lock()
    • unlock

      public void unlock()
    • lockedByMe

      public boolean lockedByMe()
    • binwrite

      @Deprecated public long binwrite(ThreadContext context, byte[] ptrBytes, int ptr, int len, boolean nosync)
      Deprecated.