public class SmbRandomAccessFile extends Object implements SmbRandomAccess
Constructor and Description |
---|
SmbRandomAccessFile(SmbFile file,
String mode)
Instantiate a random access file from a
SmbFile |
SmbRandomAccessFile(String url,
String mode,
int sharing,
CIFSContext tc)
Instantiate a random access file from URL
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the file
|
long |
getFilePointer()
Current position in file
|
long |
length()
Get the current file length
|
void |
open()
Ensures that the file descriptor is openend
|
int |
read()
Read a single byte from the current position
|
int |
read(byte[] b)
Read into buffer from current position
|
int |
read(byte[] b,
int off,
int len)
Read into buffer from current position
|
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
String |
readLine() |
long |
readLong() |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
String |
readUTF() |
void |
seek(long pos)
Seek to new position
|
void |
setLength(long newLength)
Expand/truncate file length
|
int |
skipBytes(int n) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(String str) |
public SmbRandomAccessFile(String url, String mode, int sharing, CIFSContext tc) throws SmbException, MalformedURLException
url
- mode
- sharing
- tc
- SmbException
MalformedURLException
public SmbRandomAccessFile(SmbFile file, String mode) throws SmbException
SmbFile
file
- mode
- SmbException
public void open() throws CIFSException
CIFSException
public void close() throws SmbException
SmbRandomAccess
close
in interface AutoCloseable
close
in interface SmbRandomAccess
SmbException
public int read() throws SmbException
SmbRandomAccess
read
in interface SmbRandomAccess
SmbException
public int read(byte[] b) throws SmbException
SmbRandomAccess
read
in interface SmbRandomAccess
b
- bufferSmbException
public int read(byte[] b, int off, int len) throws SmbException
SmbRandomAccess
read
in interface SmbRandomAccess
b
- bufferoff
- offset into bufferlen
- read up to len bytesSmbException
public final void readFully(byte[] b) throws SmbException
readFully
in interface DataInput
SmbException
public final void readFully(byte[] b, int off, int len) throws SmbException
readFully
in interface DataInput
SmbException
public int skipBytes(int n) throws SmbException
skipBytes
in interface DataInput
SmbException
public void write(int b) throws SmbException
write
in interface DataOutput
SmbException
public void write(byte[] b) throws SmbException
write
in interface DataOutput
SmbException
public void write(byte[] b, int off, int len) throws SmbException
write
in interface DataOutput
SmbException
public long getFilePointer()
SmbRandomAccess
getFilePointer
in interface SmbRandomAccess
public void seek(long pos)
SmbRandomAccess
seek
in interface SmbRandomAccess
public long length() throws SmbException
SmbRandomAccess
length
in interface SmbRandomAccess
SmbException
public void setLength(long newLength) throws SmbException
SmbRandomAccess
setLength
in interface SmbRandomAccess
newLength
- new file lengthSmbException
public final boolean readBoolean() throws SmbException
readBoolean
in interface DataInput
SmbException
public final byte readByte() throws SmbException
readByte
in interface DataInput
SmbException
public final int readUnsignedByte() throws SmbException
readUnsignedByte
in interface DataInput
SmbException
public final short readShort() throws SmbException
readShort
in interface DataInput
SmbException
public final int readUnsignedShort() throws SmbException
readUnsignedShort
in interface DataInput
SmbException
public final char readChar() throws SmbException
readChar
in interface DataInput
SmbException
public final int readInt() throws SmbException
readInt
in interface DataInput
SmbException
public final long readLong() throws SmbException
readLong
in interface DataInput
SmbException
public final float readFloat() throws SmbException
readFloat
in interface DataInput
SmbException
public final double readDouble() throws SmbException
readDouble
in interface DataInput
SmbException
public final String readLine() throws SmbException
readLine
in interface DataInput
SmbException
public final String readUTF() throws SmbException
readUTF
in interface DataInput
SmbException
public final void writeBoolean(boolean v) throws SmbException
writeBoolean
in interface DataOutput
SmbException
public final void writeByte(int v) throws SmbException
writeByte
in interface DataOutput
SmbException
public final void writeShort(int v) throws SmbException
writeShort
in interface DataOutput
SmbException
public final void writeChar(int v) throws SmbException
writeChar
in interface DataOutput
SmbException
public final void writeInt(int v) throws SmbException
writeInt
in interface DataOutput
SmbException
public final void writeLong(long v) throws SmbException
writeLong
in interface DataOutput
SmbException
public final void writeFloat(float v) throws SmbException
writeFloat
in interface DataOutput
SmbException
public final void writeDouble(double v) throws SmbException
writeDouble
in interface DataOutput
SmbException
public final void writeBytes(String s) throws SmbException
writeBytes
in interface DataOutput
SmbException
public final void writeChars(String s) throws SmbException
writeChars
in interface DataOutput
SmbException
public final void writeUTF(String str) throws SmbException
writeUTF
in interface DataOutput
SmbException
Copyright © 2020. All rights reserved.