3d5aea8366
2001-07-30 Tom Tromey <tromey@redhat.com> Corey Minyard <minyard@acm.org> * gnu/gcj/convert/natIconv.cc (done): New methods. * gnu/gcj/convert/Output_iconv.java (done): New method. * gnu/gcj/convert/Input_iconv.java (done): New method. * gnu/gcj/convert/UnicodeToBytes.java (defaultEncodingClass): Removed. (getDefaultEncodingClass): Removed. (getDefaultEncoder): Use getEncoder. (done): New method. (defaultEncoding, CACHE_SIZE, encoderCache, currCachePos): New static fields. * gnu/gcj/convert/BytesToUnicode.java (defaultDecodingClass): Removed. (defaultEncoding, CACHE_SIZE, decoderCache, currCachePos): New static fields. (getDefaultDecodingClass): Removed. (getDefaultDecoder): Use getDecoder. (getDecoder): Look up decoder in cache. (done): New method. * java/lang/natString.cc (init): Call `done' on converter. (getBytes): Likewise. Co-Authored-By: Corey Minyard <minyard@acm.org> From-SVN: r44484
44 lines
1.1 KiB
Java
44 lines
1.1 KiB
Java
// Output_iconv.java -- Java side of iconv() writer.
|
|
|
|
/* Copyright (C) 2000, 2001 Free Software Foundation
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
package gnu.gcj.convert;
|
|
import gnu.gcj.RawData;
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
/**
|
|
* Convert Unicode to bytes in some iconv-supported encoding.
|
|
* @author Tom Tromey <tromey@redhat.com>
|
|
* @date January 30, 2000
|
|
*/
|
|
|
|
public class Output_iconv extends UnicodeToBytes
|
|
{
|
|
public Output_iconv (String encoding) throws UnsupportedEncodingException
|
|
{
|
|
this.encoding = encoding;
|
|
this.handle = null;
|
|
init (encoding);
|
|
}
|
|
|
|
public String getName() { return encoding; }
|
|
|
|
public native void finalize ();
|
|
private native void init (String encoding)
|
|
throws UnsupportedEncodingException;
|
|
public native int write (char[] inbuffer, int inpos, int count);
|
|
public native void done ();
|
|
|
|
// The encoding we're using.
|
|
private String encoding;
|
|
|
|
// The iconv handle.
|
|
private RawData handle;
|
|
}
|