TextFileWriteStream.java
/**
* Copyright 2010,2021 Nikolas S Boyd.
Permission is granted to copy this work provided this copyright statement is retained in all copies.
*/
package Hoot.Streams;
import Hoot.Runtime.Functions.*;
import Hoot.Runtime.Faces.*;
import Hoot.Runtime.Values.*;
import Hoot.Runtime.Blocks.*;
import Smalltalk.Core.*;
import Smalltalk.Blocks.*;
import Smalltalk.Magnitudes.*;
import Hoot.Behaviors.*;
import Hoot.Behaviors.Nil;
import Hoot.Behaviors.Object;
import Hoot.Behaviors.True;
import Hoot.Behaviors.False;
import Hoot.Behaviors.Boolean;
import Hoot.Magnitudes.*;
import Hoot.Magnitudes.Integer;
import Hoot.Magnitudes.Character;
import Hoot.Magnitudes.Float;
import Hoot.Magnitudes.Double;
import Hoot.Collections.*;
import Hoot.Collections.String;
import java.io.*;
import Hoot.Magnitudes.Integer;
import Hoot.Collections.CharacterString;
import Hoot.Runtime.Functions.Exceptional.Handler;
import Smalltalk.Magnitudes.Ordinal;
import Smalltalk.Collections.ReadableString;
import Smalltalk.Collections.CollectedReadably;
import Smalltalk.Streams.*;
public class TextFileWriteStream extends FileWriteStream<Character>
{
public static Metaclass type() { return (Metaclass)Metaclass.$class; }
@Override public Metaclass $class() { return (Metaclass)Metaclass.$class; }
public static class Metaclass extends FileWriteStream.Metaclass
{
static final TextFileWriteStream.Metaclass $class = new TextFileWriteStream.Metaclass();
public Metaclass() {
this(TextFileWriteStream.Metaclass.class);
}
public Metaclass(java.lang.Class aClass) {
super(aClass);
}
@Override public java.lang.Class outerClass() { return TextFileWriteStream.class; }
/**
* @return
*/
protected TextFileWriteStream on(final RandomAccessFile primitiveFile)
{
java.lang.String exitID = "TextFileWriteStreamMetatype>>on";
Frame f0 = new Frame(exitID);
return f0.evaluate(() -> {
return (TextFileWriteStream)f0.exit(exitID, new TextFileWriteStream(primitiveFile));
});
}
}
/**
*
*/
protected TextFileWriteStream(final RandomAccessFile primitiveFile)
{
super(primitiveFile);
java.lang.String exitID = "TextFileWriteStream>>TextFileWriteStream";
Frame f0 = new Frame(exitID);
}
/**
* @return
*/
public static TextFileWriteStream write(final String fileName)
{
java.lang.String exitID = "TextFileWriteStream>>$write";
Frame f0 = new Frame(exitID);
return (TextFileWriteStream)FileWriteStream.type().write(fileName);
}
/**
* @return
*/
public String contents()
{
java.lang.String exitID = "TextFileWriteStream>>contents";
Frame f0 = new Frame(exitID);
Integer pose = this.position();
this.reset();
String result = this.nextString(this.length());
this.position(pose);
return (String)result;
}
/**
* @return
*/
@Override public TextFileWriteStream nextPut(final Character element)
{
java.lang.String exitID = "TextFileWriteStream>>nextPut";
Frame f0 = new Frame(exitID);
Closure.with(f2 -> {
file.writeByte(element.primitiveByte());
return null;
}, "").runLoud();
return (TextFileWriteStream)this;
}
/**
* @return
*/
public TextFileWriteStream nextPutAll(final CollectedReadably<Character> elements)
{
java.lang.String exitID = "TextFileWriteStream>>nextPutAll";
Frame f0 = new Frame(exitID);
Closure.with(f2 -> {
file.writeBytes(((CharacterString)elements).primitiveString());
return null;
}, "").runLoud();
return (TextFileWriteStream)this;
}
/**
* @return
*/
public Boolean isText()
{
java.lang.String exitID = "TextFileWriteStream>>isText";
Frame f0 = new Frame(exitID);
return (Boolean)True.literal();
}
/**
* @return
*/
public Boolean isBinary()
{
java.lang.String exitID = "TextFileWriteStream>>isBinary";
Frame f0 = new Frame(exitID);
return (Boolean)False.literal();
}
/**
* @return
*/
public Symbol externalType()
{
java.lang.String exitID = "TextFileWriteStream>>externalType";
Frame f0 = new Frame(exitID);
return (Symbol)Symbol.from("text");
}
}