IOEncodable.java

  1. package org.jruby.util.io;

  2. import org.jcodings.Encoding;
  3. import org.jruby.runtime.builtin.IRubyObject;

  4. /**
  5.  * Represents an IO encodable object.  This is IO/File/GZipFile/....
  6.  */
  7. public interface IOEncodable {
  8.     public void setEnc(Encoding enc);
  9.     public void setEnc2(Encoding enc2);
  10.     public Encoding getEnc();
  11.     public Encoding getEnc2();
  12.     public void setEcflags(int ecflags);
  13.     public int getEcflags();
  14.     public void setEcopts(IRubyObject ecopts);
  15.     public IRubyObject getEcopts();
  16.     public void setBOM(boolean bom);
  17.     public boolean getBOM();
  18.    
  19.     public static class ConvConfig implements IOEncodable {
  20.         public Encoding enc;
  21.         public Encoding enc2;
  22.         public int ecflags;
  23.         public IRubyObject ecopts;
  24.         public boolean bom;

  25.         public void copy(IOEncodable that) {
  26.             this.enc = that.getEnc();
  27.             this.enc2 = that.getEnc2();
  28.             this.ecflags = that.getEcflags();
  29.             this.ecopts = that.getEcopts();
  30.             this.bom = that.getBOM();
  31.         }

  32.         public Encoding getEnc() {
  33.             return enc;
  34.         }

  35.         public void setEnc(Encoding enc) {
  36.             this.enc = enc;
  37.         }

  38.         public Encoding getEnc2() {
  39.             return enc2;
  40.         }

  41.         public void setEnc2(Encoding enc2) {
  42.             this.enc2 = enc2;
  43.         }

  44.         public int getEcflags() {
  45.             return ecflags;
  46.         }

  47.         public void setEcflags(int ecflags) {
  48.             this.ecflags = ecflags;
  49.         }

  50.         public IRubyObject getEcopts() {
  51.             return ecopts;
  52.         }

  53.         public void setEcopts(IRubyObject ecopts) {
  54.             this.ecopts = ecopts;
  55.         }

  56.         public boolean getBOM() {
  57.             return bom;
  58.         }

  59.         public void setBOM(boolean bom) {
  60.             this.bom = bom;
  61.         }
  62.     }
  63. }