本文整理了Java中java.io.ObjectOutputStream.writeChars()
方法的一些代码示例,展示了ObjectOutputStream.writeChars()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectOutputStream.writeChars()
方法的具体详情如下:
包路径:java.io.ObjectOutputStream
类名称:ObjectOutputStream
方法名:writeChars
[英]Writes the string value as a sequence of characters to the target stream.
[中]将字符串值作为字符序列写入目标流。
代码示例来源:origin: wildfly/wildfly
/** {@inheritDoc} */
public void writeChars(final String str) throws IOException {
oos.writeChars(str);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void writeChars(@NotNull String s) throws IOException {
oos.writeChars(s);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void writeChars(@NotNull String s) throws IOException {
oos.writeChars(s);
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* JDK serialization hook for serializing
*
* @param oos The stream to write ourselves to
*
* @throws IOException Indicates an IO exception accessing the given stream
*/
public void serialize(ObjectOutputStream oos) throws IOException {
log.tracef( "Starting serialization of [%s] EntityEntry entries", count );
oos.writeInt( count );
if ( count == 0 ) {
return;
}
ManagedEntity managedEntity = head;
while ( managedEntity != null ) {
// so we know whether or not to build a ManagedEntityImpl on deserialize
oos.writeBoolean( managedEntity == managedEntity.$$_hibernate_getEntityInstance() );
oos.writeObject( managedEntity.$$_hibernate_getEntityInstance() );
// we need to know which implementation of EntityEntry is being serialized
oos.writeInt( managedEntity.$$_hibernate_getEntityEntry().getClass().getName().length() );
oos.writeChars( managedEntity.$$_hibernate_getEntityEntry().getClass().getName() );
managedEntity.$$_hibernate_getEntityEntry().serialize( oos );
managedEntity = managedEntity.$$_hibernate_getNextManagedEntity();
}
}
代码示例来源:origin: jboss-remoting/jboss-marshalling
/** {@inheritDoc} */
public void writeChars(final String str) throws IOException {
oos.writeChars(str);
}
代码示例来源:origin: org.jboss.marshalling/jboss-marshalling-osgi
/** {@inheritDoc} */
public void writeChars(final String str) throws IOException {
oos.writeChars(str);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/** {@inheritDoc} */
public void writeChars(final String str) throws IOException {
oos.writeChars(str);
}
代码示例来源:origin: babyfish-ct/babyfish
@Override
public void writeChars(String s) throws IOException {
this.raw.writeChars(s);
}
代码示例来源:origin: org.jboss.marshalling/jboss-marshalling
/** {@inheritDoc} */
public void writeChars(final String str) throws IOException {
oos.writeChars(str);
}
代码示例来源:origin: jboss-remoting/jboss-marshalling
/** {@inheritDoc} */
public void writeChars(final String str) throws IOException {
oos.writeChars(str);
}
代码示例来源:origin: org.apache.ignite/ignite-core
/** {@inheritDoc} */
@Override public void writeChars(@NotNull String s) throws IOException {
oos.writeChars(s);
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public void writeChars(String str) throws IOException {
super.writeChars(str);
super.flush();
}
代码示例来源:origin: org.apache.ignite/ignite-core
/** {@inheritDoc} */
@Override public void writeChars(@NotNull String s) throws IOException {
oos.writeChars(s);
}
代码示例来源:origin: stackoverflow.com
private void writeObject(ObjectOutputStream os){
try{
os.defaultWriteObject();
os.writeChars(spe.encryptPassword("your password"));
}
catch (Exception e){
e.printStackTrace();
}
}
代码示例来源:origin: stackoverflow.com
FileOutputStream fos = null;
ObjectOutputStream os = null;
try {
fos = new FileOutputStream(YOUR_FILE_NAME);
os = new ObjectOutputStream(fos);
for(YourObjectType current : YourQueue){
os.writeXXX(current); //Where XXX is the appropriate write method depending on your data type
os.writeChars(","); //Since you mentioned wanting a comma delimiter..
}
} catch(IOException e){
e.printStackTrace();
} finally {
if(fos != null) fos.close();
if(os != null) os.close();
}
代码示例来源:origin: stackoverflow.com
// writing
FileOutputStream outFile = new FileOutputStream("C:"+File.separatorChar+"transactions.dat");
ObjectOutputStream out = new ObjectOutputStream(outFile);
String s = brokerageAcc1.toString();
out.writeInt(s.length());
System.out.println(s.length());
out.writeChars(s);
// reading
FileInputStream inFile = new FileInputStream("C:"+File.separatorChar+"transactions.dat");
ObjectInputStream in = new ObjectInputStream(inFile);
int length = in.readInt(); // get the number of chars
System.out.println(""+length);
StringBuilder result = new StringBuilder();
for (int i = 0; i < length; i++)
result.append(in.readChar());
System.out.println(result.toString());
代码示例来源:origin: org.hibernate.orm/hibernate-core
/**
* JDK serialization hook for serializing
*
* @param oos The stream to write ourselves to
*
* @throws IOException Indicates an IO exception accessing the given stream
*/
public void serialize(ObjectOutputStream oos) throws IOException {
log.tracef( "Starting serialization of [%s] EntityEntry entries", count );
oos.writeInt( count );
if ( count == 0 ) {
return;
}
ManagedEntity managedEntity = head;
while ( managedEntity != null ) {
// so we know whether or not to build a ManagedEntityImpl on deserialize
oos.writeBoolean( managedEntity == managedEntity.$$_hibernate_getEntityInstance() );
oos.writeObject( managedEntity.$$_hibernate_getEntityInstance() );
// we need to know which implementation of EntityEntry is being serialized
oos.writeInt( managedEntity.$$_hibernate_getEntityEntry().getClass().getName().length() );
oos.writeChars( managedEntity.$$_hibernate_getEntityEntry().getClass().getName() );
managedEntity.$$_hibernate_getEntityEntry().serialize( oos );
managedEntity = managedEntity.$$_hibernate_getNextManagedEntity();
}
}
内容来源于网络,如有侵权,请联系作者删除!