public void ascii8bitBinmode(Ruby runtime) { if (readconv != null) { readconv.close(); readconv = null; } if (writeconv != null) { writeconv.close(); writeconv = null; } setBinmode(); clearTextMode(); // TODO: Windows //SET_BINARY_MODE_WITH_SEEK_CUR() encs.enc = EncodingUtils.ascii8bitEncoding(runtime); encs.enc2 = null; encs.ecflags = 0; encs.ecopts = runtime.getNil(); clearCodeConversion(); }
public void ascii8bitBinmode(Ruby runtime) { if (readconv != null) { readconv.close(); readconv = null; } if (writeconv != null) { writeconv.close(); writeconv = null; } setBinmode(); clearTextMode(); // TODO: Windows //SET_BINARY_MODE_WITH_SEEK_CUR() encs.enc = EncodingUtils.ascii8bitEncoding(runtime); encs.enc2 = null; encs.ecflags = 0; encs.ecopts = runtime.getNil(); clearCodeConversion(); }
protected void setAscii8bitBinmode() { Encoding ascii8bit = getRuntime().getEncodingService().getAscii8bitEncoding(); if (readconv != null) { readconv = null; } if (writeconv != null) { writeconv = null; } openFile.setBinmode(); openFile.clearTextMode(); enc = ascii8bit; enc2 = null; ecflags = 0; ecopts = getRuntime().getNil(); clearCodeConversion(); }
protected void setAscii8bitBinmode() { Encoding ascii8bit = getRuntime().getEncodingService().getAscii8bitEncoding(); if (readconv != null) { readconv = null; } if (writeconv != null) { writeconv = null; } openFile.setBinmode(); openFile.clearTextMode(); enc = ascii8bit; enc2 = null; ecflags = 0; ecopts = getRuntime().getNil(); clearCodeConversion(); }
private void setBinmode() { OpenFile fptr; fptr = getOpenFileChecked(); boolean locked = fptr.lock(); try { if (fptr.readconv != null) fptr.readconv.binmode(); if (fptr.writeconv != null) fptr.writeconv.binmode(); fptr.setBinmode(); fptr.clearTextMode(); fptr.writeconvPreEcflags &= ~EConvFlags.NEWLINE_DECORATOR_MASK; if (OpenFlags.O_BINARY.defined()) { // TODO: Windows // if (fptr.readconv == null) { // SET_BINARY_MODE_WITH_SEEK_CUR(fptr); // } // else { // TODO: setmode O_BINARY means what via NIO? // setmode(fptr->fd, O_BINARY); // } } } finally { if (locked) fptr.unlock(); } }
private void setBinmode() { OpenFile fptr; fptr = getOpenFileChecked(); boolean locked = fptr.lock(); try { if (fptr.readconv != null) fptr.readconv.binmode(); if (fptr.writeconv != null) fptr.writeconv.binmode(); fptr.setBinmode(); fptr.clearTextMode(); fptr.writeconvPreEcflags &= ~EConvFlags.NEWLINE_DECORATOR_MASK; if (OpenFlags.O_BINARY.defined()) { // TODO: Windows // if (fptr.readconv == null) { // SET_BINARY_MODE_WITH_SEEK_CUR(fptr); // } // else { // TODO: setmode O_BINARY means what via NIO? // setmode(fptr->fd, O_BINARY); // } } } finally { if (locked) fptr.unlock(); } }
protected IRubyObject readAll(ThreadContext context) throws BadDescriptorException, EOFException, IOException { Ruby runtime = getRuntime(); if (runtime.is1_9() && needsReadConversion()) { openFile.setBinmode(); makeReadConversion(context); // TODO: handle writing into original buffer better ByteList buf = readAllCommon(runtime); if (readconv != null) buf = readconv.transcode(runtime.getCurrentContext(), buf); clearReadConversion(); return ioEncStr(runtime.newString(buf)); } // TODO: handle writing into original buffer better ByteList buf = readAllCommon(runtime); RubyString str; if (buf == null) { str = RubyString.newEmptyString(runtime); } else { str = makeString(runtime, buf, false); } str.setTaint(true); return str; }
protected IRubyObject readAll(ThreadContext context) throws BadDescriptorException, EOFException, IOException { Ruby runtime = getRuntime(); if (runtime.is1_9() && needsReadConversion()) { openFile.setBinmode(); makeReadConversion(context); // TODO: handle writing into original buffer better ByteList buf = readAllCommon(runtime); if (readconv != null) buf = readconv.transcode(runtime.getCurrentContext(), buf); clearReadConversion(); return ioEncStr(runtime.newString(buf)); } // TODO: handle writing into original buffer better ByteList buf = readAllCommon(runtime); RubyString str; if (buf == null) { str = RubyString.newEmptyString(runtime); } else { str = makeString(runtime, buf, false); } str.setTaint(true); return str; }
openFile.setBinmode(); // In MRI this does not affect flags like we do in OpenFile makeWriteConversion(context);
openFile.setBinmode(); // In MRI this does not affect flags like we do in OpenFile makeWriteConversion(context);