Java 类com.google.common.io.GwtWorkarounds.CharOutput 实例源码

项目:bts    文件:BaseEncoding.java   
/**
 * Encodes the specified range of the specified byte array, and returns the encoded
 * {@code String}.
 */
public final String encode(byte[] bytes, int off, int len) {
  checkNotNull(bytes);
  checkPositionIndexes(off, off + len, bytes.length);
  CharOutput result = stringBuilderOutput(maxEncodedSize(len));
  ByteOutput byteOutput = encodingStream(result);
  try {
    for (int i = 0; i < len; i++) {
      byteOutput.write(bytes[off + i]);
    }
    byteOutput.close();
  } catch (IOException impossible) {
    throw new AssertionError("impossible");
  }
  return result.toString();
}
项目:j2objc    文件:BaseEncoding.java   
/**
 * Encodes the specified range of the specified byte array, and returns the encoded
 * {@code String}.
 */
public final String encode(byte[] bytes, int off, int len) {
  checkNotNull(bytes);
  checkPositionIndexes(off, off + len, bytes.length);
  CharOutput result = stringBuilderOutput(maxEncodedSize(len));
  ByteOutput byteOutput = encodingStream(result);
  try {
    for (int i = 0; i < len; i++) {
      byteOutput.write(bytes[off + i]);
    }
    byteOutput.close();
  } catch (IOException impossible) {
    throw new AssertionError("impossible");
  }
  return result.toString();
}
项目:guava-libraries    文件:BaseEncoding.java   
/**
 * Encodes the specified range of the specified byte array, and returns the encoded
 * {@code String}.
 */
public final String encode(byte[] bytes, int off, int len) {
  checkNotNull(bytes);
  checkPositionIndexes(off, off + len, bytes.length);
  CharOutput result = stringBuilderOutput(maxEncodedSize(len));
  ByteOutput byteOutput = encodingStream(result);
  try {
    for (int i = 0; i < len; i++) {
      byteOutput.write(bytes[off + i]);
    }
    byteOutput.close();
  } catch (IOException impossible) {
    throw new AssertionError("impossible");
  }
  return result.toString();
}
项目:guava-libraries    文件:BaseEncoding.java   
/**
 * Encodes the specified range of the specified byte array, and returns the encoded
 * {@code String}.
 */
public final String encode(byte[] bytes, int off, int len) {
  checkNotNull(bytes);
  checkPositionIndexes(off, off + len, bytes.length);
  CharOutput result = stringBuilderOutput(maxEncodedSize(len));
  ByteOutput byteOutput = encodingStream(result);
  try {
    for (int i = 0; i < len; i++) {
      byteOutput.write(bytes[off + i]);
    }
    byteOutput.close();
  } catch (IOException impossible) {
    throw new AssertionError("impossible");
  }
  return result.toString();
}
项目:cnGuava    文件:BaseEncoding.java   
/**
 * Encodes the specified range of the specified byte array, and returns the encoded
 * {@code String}.
 */
public final String encode(byte[] bytes, int off, int len) {
  checkNotNull(bytes);
  checkPositionIndexes(off, off + len, bytes.length);
  CharOutput result = stringBuilderOutput(maxEncodedSize(len));
  ByteOutput byteOutput = encodingStream(result);
  try {
    for (int i = 0; i < len; i++) {
      byteOutput.write(bytes[off + i]);
    }
    byteOutput.close();
  } catch (IOException impossible) {
    throw new AssertionError("impossible");
  }
  return result.toString();
}
项目:org.openntf.domino    文件:BaseEncoding.java   
/**
 * Encodes the specified range of the specified byte array, and returns the encoded
 * {@code String}.
 */
public final String encode(byte[] bytes, int off, int len) {
  checkNotNull(bytes);
  checkPositionIndexes(off, off + len, bytes.length);
  CharOutput result = stringBuilderOutput(maxEncodedSize(len));
  ByteOutput byteOutput = encodingStream(result);
  try {
    for (int i = 0; i < len; i++) {
      byteOutput.write(bytes[off + i]);
    }
    byteOutput.close();
  } catch (IOException impossible) {
    throw new AssertionError("impossible");
  }
  return result.toString();
}
项目:bts    文件:BaseEncoding.java   
static CharOutput separatingOutput(
    final CharOutput delegate, final String separator, final int afterEveryChars) {
  checkNotNull(delegate);
  checkNotNull(separator);
  checkArgument(afterEveryChars > 0);
  return new CharOutput() {
    int charsUntilSeparator = afterEveryChars;

    @Override
    public void write(char c) throws IOException {
      if (charsUntilSeparator == 0) {
        for (int i = 0; i < separator.length(); i++) {
          delegate.write(separator.charAt(i));
        }
        charsUntilSeparator = afterEveryChars;
      }
      delegate.write(c);
      charsUntilSeparator--;
    }

    @Override
    public void flush() throws IOException {
      delegate.flush();
    }

    @Override
    public void close() throws IOException {
      delegate.close();
    }
  };
}
项目:j2objc    文件:BaseEncoding.java   
static CharOutput separatingOutput(
    final CharOutput delegate, final String separator, final int afterEveryChars) {
  checkNotNull(delegate);
  checkNotNull(separator);
  checkArgument(afterEveryChars > 0);
  return new CharOutput() {
    int charsUntilSeparator = afterEveryChars;

    @Override
    public void write(char c) throws IOException {
      if (charsUntilSeparator == 0) {
        for (int i = 0; i < separator.length(); i++) {
          delegate.write(separator.charAt(i));
        }
        charsUntilSeparator = afterEveryChars;
      }
      delegate.write(c);
      charsUntilSeparator--;
    }

    @Override
    public void flush() throws IOException {
      delegate.flush();
    }

    @Override
    public void close() throws IOException {
      delegate.close();
    }
  };
}
项目:guava-libraries    文件:BaseEncoding.java   
static CharOutput separatingOutput(
    final CharOutput delegate, final String separator, final int afterEveryChars) {
  checkNotNull(delegate);
  checkNotNull(separator);
  checkArgument(afterEveryChars > 0);
  return new CharOutput() {
    int charsUntilSeparator = afterEveryChars;

    @Override
    public void write(char c) throws IOException {
      if (charsUntilSeparator == 0) {
        for (int i = 0; i < separator.length(); i++) {
          delegate.write(separator.charAt(i));
        }
        charsUntilSeparator = afterEveryChars;
      }
      delegate.write(c);
      charsUntilSeparator--;
    }

    @Override
    public void flush() throws IOException {
      delegate.flush();
    }

    @Override
    public void close() throws IOException {
      delegate.close();
    }
  };
}
项目:guava-libraries    文件:BaseEncoding.java   
static CharOutput separatingOutput(
    final CharOutput delegate, final String separator, final int afterEveryChars) {
  checkNotNull(delegate);
  checkNotNull(separator);
  checkArgument(afterEveryChars > 0);
  return new CharOutput() {
    int charsUntilSeparator = afterEveryChars;

    @Override
    public void write(char c) throws IOException {
      if (charsUntilSeparator == 0) {
        for (int i = 0; i < separator.length(); i++) {
          delegate.write(separator.charAt(i));
        }
        charsUntilSeparator = afterEveryChars;
      }
      delegate.write(c);
      charsUntilSeparator--;
    }

    @Override
    public void flush() throws IOException {
      delegate.flush();
    }

    @Override
    public void close() throws IOException {
      delegate.close();
    }
  };
}
项目:cnGuava    文件:BaseEncoding.java   
static CharOutput separatingOutput(
    final CharOutput delegate, final String separator, final int afterEveryChars) {
  checkNotNull(delegate);
  checkNotNull(separator);
  checkArgument(afterEveryChars > 0);
  return new CharOutput() {
    int charsUntilSeparator = afterEveryChars;

    @Override
    public void write(char c) throws IOException {
      if (charsUntilSeparator == 0) {
        for (int i = 0; i < separator.length(); i++) {
          delegate.write(separator.charAt(i));
        }
        charsUntilSeparator = afterEveryChars;
      }
      delegate.write(c);
      charsUntilSeparator--;
    }

    @Override
    public void flush() throws IOException {
      delegate.flush();
    }

    @Override
    public void close() throws IOException {
      delegate.close();
    }
  };
}
项目:org.openntf.domino    文件:BaseEncoding.java   
static CharOutput separatingOutput(
    final CharOutput delegate, final String separator, final int afterEveryChars) {
  checkNotNull(delegate);
  checkNotNull(separator);
  checkArgument(afterEveryChars > 0);
  return new CharOutput() {
    int charsUntilSeparator = afterEveryChars;

    @Override
    public void write(char c) throws IOException {
      if (charsUntilSeparator == 0) {
        for (int i = 0; i < separator.length(); i++) {
          delegate.write(separator.charAt(i));
        }
        charsUntilSeparator = afterEveryChars;
      }
      delegate.write(c);
      charsUntilSeparator--;
    }

    @Override
    public void flush() throws IOException {
      delegate.flush();
    }

    @Override
    public void close() throws IOException {
      delegate.close();
    }
  };
}
项目:bts    文件:BaseEncoding.java   
@Override
ByteOutput encodingStream(final CharOutput output) {
  return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
项目:j2objc    文件:BaseEncoding.java   
@Override
ByteOutput encodingStream(final CharOutput output) {
  return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
项目:guava-libraries    文件:BaseEncoding.java   
@Override
ByteOutput encodingStream(final CharOutput output) {
  return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
项目:guava-libraries    文件:BaseEncoding.java   
@Override
ByteOutput encodingStream(final CharOutput output) {
  return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
项目:cnGuava    文件:BaseEncoding.java   
@Override
ByteOutput encodingStream(final CharOutput output) {
  return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
项目:org.openntf.domino    文件:BaseEncoding.java   
@Override
ByteOutput encodingStream(final CharOutput output) {
  return delegate.encodingStream(separatingOutput(output, separator, afterEveryChars));
}
项目:bts    文件:BaseEncoding.java   
abstract ByteOutput encodingStream(CharOutput charOutput);
项目:j2objc    文件:BaseEncoding.java   
abstract ByteOutput encodingStream(CharOutput charOutput);
项目:guava-libraries    文件:BaseEncoding.java   
abstract ByteOutput encodingStream(CharOutput charOutput);
项目:guava-libraries    文件:BaseEncoding.java   
abstract ByteOutput encodingStream(CharOutput charOutput);
项目:cnGuava    文件:BaseEncoding.java   
abstract ByteOutput encodingStream(CharOutput charOutput);
项目:org.openntf.domino    文件:BaseEncoding.java   
abstract ByteOutput encodingStream(CharOutput charOutput);