Closed tvessiere closed 2 years ago
Session session = startConnection(context);
DiskShare share = (DiskShare) session.connectShare("YOUR_SHARED_FOLDER_NAME");
ArrayList<DATA_CLASS_OUT_FILE> fileContentArrayList = new ArrayList<>();
com.hierynomus.smbj.share.File f = share.openFile("YOUR_HS3CASHOUTPATH", of(FILE_READ_DATA), null, SMB2ShareAccess.ALL, FILE_OPEN, null);
InputStream in = f.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
print(line)
}
in.close();
f.close();
You can check it
Hello, what is H3CashOut class ?
Hi @tvessiere , You must have a data class where you define the values you hold in the HS3CASH.OUT file as variables
var reservationNumber: String,
var objectNumber: String,
var guestName: String,
etc...
what is H3CashOut
You must have a data class where you define the values you hold in the HS3CASH.OUT file as variables
The FileInputStream
will always return 0
, as per the contract of java.io.InputStream
, which is:
Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.
The
FileInputStream
will always return0
, as per the contract ofjava.io.InputStream
, which is:Note that while some implementations of InputStream will return the total number of bytes in the stream, many will not. It is never correct to use the return value of this method to allocate a buffer intended to hold all data in this stream.
Can you give some advice on what I can use for this?
File file = share.openFile("testPGMVT.txt",
EnumSet.of(AccessMask.GENERIC_READ),
null,
SMB2ShareAccess.ALL,
SMB2CreateDisposition.FILE_OPEN,
null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
file.read(baos);
byte[] b = baos.toByteArray();
File file = share.openFile("testPGMVT.txt", EnumSet.of(AccessMask.GENERIC_READ), null, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); file.read(baos); byte[] b = baos.toByteArray();
thanks :)
File file = share.openFile("testPGMVT.txt", EnumSet.of(AccessMask.GENERIC_READ), null, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); file.read(baos); byte[] b = baos.toByteArray();
thanks :)
Thansk you man, i was busy at work, can't check it now, but i will run it quickly in the next days :)
have a nice week all of you.
Hello there.
I'm a bit confuse... I'm not able to read the data in a file, the InputStream returned as no bytes inside.
Here is the code : ` try (DiskShare share = (DiskShare) session.connectShare("MyShare")) {
The output :
Bytes available : 0 Data in file : `Can you help me ?
Thanks you.