
org.gedml.AnselOutputStreamWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gedcom Show documentation
Show all versions of gedcom Show documentation
GEDCOM 5.x Reader/Writer
The newest version!
package org.gedml;
import java.io.*;
/*
* org.lm.gedml.AnselOutputStreamWriter
* This class produces an output stream of bytes representing
* ANSEL-encoded characters, from UNICODE characters supplied as
* input.
* @Author: [email protected]
* @Version: 20 May 1998
* 20 May 1998: conversion tables updated with input from John Cowan
* Nov 2011: conversion tables updated again based upon
* http://www.heiner-eichmann.de/gedcom/oldansset.htm and http://lcweb2.loc.gov/diglib/codetables/45.html
*/
public class AnselOutputStreamWriter extends OutputStreamWriter
{
private OutputStream output;
public AnselOutputStreamWriter(OutputStream out)
throws IOException
{
super(out);
output = out;
}
/*
* Write one UNICODE character
*/
public void write(int c) throws IOException
{
int ansel;
if (c<128) output.write(c);
else {
ansel = convert(c);
if (ansel < 256) {
output.write(ansel);
} else {
output.write(ansel / 256);
output.write(ansel % 256);
}
}
}
/*
* Write part of an array of UNICODE characters
*/
public void write(char cbuf[], int off, int len)
throws IOException
{
for (int i=off; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy