com.ibm.as400.access.IFSFileInputStreamImplProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400 Show documentation
Show all versions of jt400 Show documentation
The Open Source version of the IBM Toolbox for Java
The newest version!
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: IFSFileInputStreamImplProxy.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 1997-2000 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package com.ibm.as400.access;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
/**
Provides a local proxy implementation for the IFSFileInputStream and
IFSTextFileInputStream classes.
**/
class IFSFileInputStreamImplProxy
extends AbstractProxyImpl
implements IFSFileInputStreamImpl
{
IFSFileInputStreamImplProxy ()
{
super ("IFSFileInputStream");
}
public int available()
throws IOException
{
try {
return connection_.callMethod (pxId_, "available").getReturnValueInt();
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
public void close()
throws IOException
{
try {
connection_.callMethod (pxId_, "close");
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
public void connectAndOpen()
throws AS400SecurityException, IOException
{
try {
connection_.callMethod (pxId_, "connectAndOpen");
}
catch (InvocationTargetException e) {
Throwable e1 = e.getTargetException ();
if (e1 instanceof AS400SecurityException)
throw (AS400SecurityException) e1;
else
throw ProxyClientConnection.rethrow1 (e);
}
}
public IFSKey lock(long length)
throws IOException
{
try {
return (IFSKey) connection_.callMethod (pxId_, "lock",
new Class[] { Long.TYPE },
new Object[] { Long.valueOf(length)})
.getReturnValue();
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
public void open()
throws IOException
{
try {
connection_.callMethod (pxId_, "open");
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
private static final boolean[] ARGS_TO_RETURN = new boolean[] {true, false, false};
public int read(byte[] data,
int dataOffset,
int length)
throws IOException
{
try {
ProxyReturnValue rv = connection_.callMethod (pxId_, "read",
new Class[] { byte[].class,
Integer.TYPE,
Integer.TYPE },
new Object[] { data,
Integer.valueOf(dataOffset),
Integer.valueOf(length) },
ARGS_TO_RETURN, false );
byte [] returnDataBuffer = (byte[])rv.getArgument(0);
System.arraycopy(returnDataBuffer, 0, data, 0, data.length);
return rv.getReturnValueInt();
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
public String readText(int length)
throws IOException
{
try {
return (String) connection_.callMethod (pxId_, "readText",
new Class[] { Integer.TYPE },
new Object[] { Integer.valueOf(length) })
.getReturnValue();
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
public void setFD(IFSFileDescriptorImpl fd)
{
try {
connection_.callMethod (pxId_, "setFD",
new Class[] { IFSFileDescriptorImpl.class },
new Object[] { fd });
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow (e);
}
}
public long skip(long bytesToSkip)
throws IOException
{
try {
return connection_.callMethod (pxId_, "skip",
new Class[] { Long.TYPE },
new Object[] { Long.valueOf(bytesToSkip)})
.getReturnValueLong();
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
public void unlock(IFSKey key)
throws IOException
{
try {
connection_.callMethod (pxId_, "unlock",
new Class[] { IFSKey.class },
new Object[] { key });
}
catch (InvocationTargetException e) {
throw ProxyClientConnection.rethrow1 (e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy